IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo module

device_graph

This module provides functionality for building and replaying device graphs. A device graph captures a sequence of GPU operations (such as kernel launches, memory copies, and memsets) as a reusable graph that can be replayed at a lower overhead than re-enqueueing each operation individually. The main entry point is DeviceGraph.create(), which hands a DeviceGraphBuilder to a scoped callback.

Graph capture is currently implemented for CUDA and HIP devices only. Creating a graph on any other device, such as an Apple GPU or a CPU, raises.

comptime values​

DeviceGraph​

comptime DeviceGraph = LegacyDeviceGraph

A captured sequence of device operations that can be replayed.

DeviceGraphBuilder​

comptime DeviceGraphBuilder[arena_origin: ImmOrigin] = LegacyDeviceGraphBuilder[arena_origin]

Records operations into a device graph.

Parameters​

DeviceGraphCache​

comptime DeviceGraphCache = LegacyDeviceGraphCache

Reuses instantiated graphs across calls.

DeviceGraphInput​

comptime DeviceGraphInput = LegacyDeviceGraphInput

A device graph input that contributes to the graph's cache key.

DeviceGraphInputKind​

comptime DeviceGraphInputKind = LegacyDeviceGraphInputKind

How a graph input is stored and keyed.

DeviceGraphNode​

comptime DeviceGraphNode[arena_origin: ImmOrigin] = LegacyDeviceGraphNode[arena_origin]

A node of a device graph under construction.

Parameters​

StableAddr​

comptime StableAddr = LegacyStableAddr

A graph-lifetime slot that holds one device address.

Was this page helpful?