pub struct ConditionalCudaGraphSequenceBuilder { /* private fields */ }Expand description
Builds one dependency-ordered parent graph containing ordinary captured segments, one-shot conditional-IF bodies and conditional-WHILE loops.
Stratified Datalog uses this topology so work before a
recursive strongly connected component executes once, only that component
is placed in a device-controlled WHILE, and later strata depend on its
completion. An IF body instead admits or skips a whole bounded step after
its device preflight. The finished value launches through one cuGraphLaunch.
Implementations§
Source§impl ConditionalCudaGraphSequenceBuilder
impl ConditionalCudaGraphSequenceBuilder
Sourcepub fn new(stream: &CudaStream) -> Result<Self, CudaConditionalGraphUnavailable>
pub fn new(stream: &CudaStream) -> Result<Self, CudaConditionalGraphUnavailable>
Create an empty parent graph bound to stream’s CUDA context.
Sourcepub fn capture_segment_on_stream<F, E>(
&mut self,
stream: &CudaStream,
record: F,
) -> Result<(), CudaConditionalGraphUnavailable>
pub fn capture_segment_on_stream<F, E>( &mut self, stream: &CudaStream, record: F, ) -> Result<(), CudaConditionalGraphUnavailable>
Capture one ordinary graph segment after the current dependency frontier. The callback may enqueue only capture-compatible operations. Capture setup and cleanup may wait for deferred destruction under the module-level lifecycle contract.
Sourcepub fn add_conditional_while<F>(
&mut self,
initial_value: u32,
assign_default_on_launch: bool,
populate_body: F,
) -> Result<CUgraphConditionalHandle, CudaConditionalGraphUnavailable>
pub fn add_conditional_while<F>( &mut self, initial_value: u32, assign_default_on_launch: bool, populate_body: F, ) -> Result<CUgraphConditionalHandle, CudaConditionalGraphUnavailable>
Append one conditional-WHILE node after the current frontier.
Sourcepub fn add_conditional_if<P, F, E>(
&mut self,
stream: &CudaStream,
preflight: P,
populate_body: F,
) -> Result<CUgraphConditionalHandle, CudaConditionalGraphUnavailable>where
P: FnOnce(CUgraphConditionalHandle) -> Result<(), E>,
E: Display,
F: FnOnce(&ConditionalCudaGraphBody) -> Result<(), CudaConditionalGraphUnavailable>,
pub fn add_conditional_if<P, F, E>(
&mut self,
stream: &CudaStream,
preflight: P,
populate_body: F,
) -> Result<CUgraphConditionalHandle, CudaConditionalGraphUnavailable>where
P: FnOnce(CUgraphConditionalHandle) -> Result<(), E>,
E: Display,
F: FnOnce(&ConditionalCudaGraphBody) -> Result<(), CudaConditionalGraphUnavailable>,
Capture a device admission test, then execute its body at most once.
The preflight receives the actual graph handle and must set it on every replay. Its nodes precede the IF node on the same dependency frontier; a rejected step never enters the body. The handle defaults to false on each launch. Neither callback runs when the finished graph is replayed.
Sourcepub fn instantiate(
self,
) -> Result<CapturedCudaGraph, CudaConditionalGraphUnavailable>
pub fn instantiate( self, ) -> Result<CapturedCudaGraph, CudaConditionalGraphUnavailable>
Instantiate the complete parent graph exactly once.