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:
- HostFn —
cuLaunchHostFunc/hipLaunchHostFunc/MTLCommandBuffer.addCompletedHandlercallback. Sub-µs wakeup, no host-side blocking. - Sync — explicit
cudaStreamSynchronize. Easy reasoning, parks a host thread. - Polled — periodic
cuEventQuerywith a timeout. Hard upper bound at the cost of a polling loop.
Required Methods§
Sourcefn 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,
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.