Skip to main content

CompletionStrategy

Trait CompletionStrategy 

Source
pub trait CompletionStrategy<B: AccelBackend>:
    Send
    + Sync
    + 'static {
    // Required method
    fn await_completion<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 B::Stream,
    ) -> Pin<Box<dyn Future<Output = Result<(), AccelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Strategy for awaiting kernel completion on a stream.

Three canonical implementations live in each backend:

  • HostFncuLaunchHostFunc / hipLaunchHostFunc / MTLCommandBuffer.addCompletedHandler callback. Sub-µs wakeup, no host-side blocking.
  • Sync — explicit cudaStreamSynchronize. Easy reasoning, parks a host thread.
  • Polled — periodic cuEventQuery with a timeout. Hard upper bound at the cost of a polling loop.

Required Methods§

Source

fn await_completion<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 B::Stream, ) -> Pin<Box<dyn Future<Output = Result<(), AccelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve once every kernel previously enqueued on stream has finished. Ok(()) on completion; Err if the device poisoned mid-flight.

Implementors§