pub struct GraphRecordCtx<'a> {
pub stream: Option<&'a Arc<CudaStream>>,
pub blas: Option<&'a CudaBlas>,
pub rng: Option<&'a CudaRng>,
pub fft: Option<&'a CudaFft>,
pub parent_graph: Option<CUgraph>,
}Expand description
Recording context handed to each GraphOp::record call.
Holds a borrow of the captured stream (or None in the
host-only mock context used by unit tests) plus optional
handles that some op kinds need (cuBLAS for SGEMM, cuRAND for
RNG fill, cuFFT for R2C). Op implementations that need a
handle their context lacks must return GpuError::Unrecoverable.
New impl GraphOp types added by future phases (cuBLASLt
epilogues, cuSPARSE, cuTENSOR, NCCL, FlashAttention, …) extend
this struct with new optional handle slots — additive, never a
breaking change for existing recorders.
Fields§
§stream: Option<&'a Arc<CudaStream>>The CUDA stream currently in stream-capture mode. Real
recorders unwrap and use this; the host-side mock context
used in unit tests passes None and ops that need a real
stream return GpuError::Unrecoverable.
blas: Option<&'a CudaBlas>Borrowed cuBLAS handle for SGEMM-style ops. None means
the GraphActor was constructed without a working cuBLAS.
rng: Option<&'a CudaRng>Borrowed cuRAND handle for RNG-fill ops.
fft: Option<&'a CudaFft>Borrowed cuFFT plan, installed by GraphMsg::SetFftPlan.
parent_graph: Option<CUgraph>Phase 3 child-graph parent handle. None for top-level
recordings; Some(parent) when this context is recording into
a child graph node.
Implementations§
Source§impl<'a> GraphRecordCtx<'a>
impl<'a> GraphRecordCtx<'a>
Sourcepub fn require_stream(&self) -> Result<&'a Arc<CudaStream>, GpuError>
pub fn require_stream(&self) -> Result<&'a Arc<CudaStream>, GpuError>
Helper for recorders: pull stream out or return a clean
“no stream” error so the recording is aborted.
Sourcepub fn parent_graph(&self) -> CUgraph
pub fn parent_graph(&self) -> CUgraph
Phase 3 child-graph helper: returns the parent CUgraph handle
when one was attached via [Self::with_parent_graph]. Most
GraphOp impls don’t need this — only [super::child::ChildGraphOp]
and [super::conditional] do.