Skip to main content

GraphRecordCtx

Struct GraphRecordCtx 

Source
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>

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for GraphRecordCtx<'a>

§

impl<'a> RefUnwindSafe for GraphRecordCtx<'a>

§

impl<'a> !Send for GraphRecordCtx<'a>

§

impl<'a> !Sync for GraphRecordCtx<'a>

§

impl<'a> Unpin for GraphRecordCtx<'a>

§

impl<'a> UnsafeUnpin for GraphRecordCtx<'a>

§

impl<'a> UnwindSafe for GraphRecordCtx<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more