Skip to main content

Module graph

Module graph 

Source
Expand description

GraphActor — record a CUDA stream-capture once, replay many.

Two lifecycle paths:

  1. Caller-driven capture — user calls stream.begin_capture() directly, performs operations, calls stream.end_capture() to get a CudaGraph, then wraps via GraphHandle::from_graph and sends Launch to replay.
  2. Actor-driven capture — caller sends Record { script }; actor runs begin_capture → drives each GraphOp in the script via its record method → end_capture → returns a GraphHandle.

Both paths produce the same GraphHandle type; on Launch the actor validates state.generation() and replays the graph, replying after stream completion.

§Open extension

GraphOp is a trait, not a closed enum. New kernel actors land their ops by implementing GraphOp in their own module — no central enum to edit. Legacy callers that built GraphOpLegacy::Sgemm { ... } enum values still compile via the GraphOpLegacy back-compat wrapper.

Re-exports§

pub use record::fft_r2c::FftR2COp;
pub use record::memcpy::MemcpyOp;
pub use record::rng_fill_uniform::RngFillUniformOp;
pub use record::sgemm::SgemmOp;
pub use child::ChildGraphOp;
pub use dot::export_dot;
pub use dot::DotFlags;
pub use exec_update::exec_update;
pub use exec_update::GraphExecUpdateOutcome;

Modules§

child
Child-graph composition.
conditional
Conditional graph nodes (cudaGraphConditionalNode, CUDA 12.4+).
dot
cudaGraphDebugDotPrint round-trip — emit a Graphviz DOT file describing a captured graph for tooling / visualisation.
exec_update
cuGraphExecUpdate — in-place parameter update for an instantiated graph. Lets callers re-bind GpuRef pointers without re-running cuGraphInstantiate.
record
Per-op recorders that implement super::GraphOp.

Structs§

GraphActor
GraphHandle
GraphRecordCtx
Recording context handed to each GraphOp::record call.
SendGraph
Send/Sync newtype around Arc<CudaGraph>. cudarc marks CudaGraph !Sync because of interior mutability via the CUDA driver. The actor enforces single-threaded access.

Enums§

GraphMsg
GraphOpLegacyDeprecated
Back-compat wrapper preserving the closed-enum API of pre-0.5 graph ops. New code should construct the per-variant op types (SgemmOp, MemcpyOp, RngFillUniformOp, FftR2COp) directly and box them as Box<dyn GraphOp>.

Traits§

GraphOp
A single op in a graph script.
GraphOpRecord
Phase 3 record-mode trait. Lighter than RecordMode (no associated Op type) — implementors are typically one op carrying the typed request inline.