Skip to main content

Module async_launch

Module async_launch 

Source
Expand description

Async kernel launch with completion futures.

This module provides AsyncKernel for launching GPU kernels that return Futures, enabling integration with Rust’s async/await ecosystem without depending on any specific async runtime.

§Architecture

Since the OxiCUDA driver crate does not expose CUDA callback registration, completion is detected by polling Event::query(). The PollStrategy enum controls how aggressively the future polls:

  • Spin — busy-poll with no yielding.
  • Yield — call std::thread::yield_now() between polls.
  • BackoffMicros — sleep a fixed number of microseconds between polls.

§Example

let async_kernel = AsyncKernel::new(kernel);
let stream = Stream::new(&ctx)?;
let params = LaunchParams::new(4u32, 256u32);

// Fire-and-await
let completion = async_kernel.launch_async(&params, &stream, &(42u32,))?;
completion.await?;

Structs§

AsyncKernel
A kernel wrapper with async launch capability.
AsyncLaunchConfig
Configuration for async kernel launch behaviour.
LaunchCompletion
A Future that resolves when a GPU kernel finishes execution.
LaunchTiming
Timing information for a completed kernel launch.
TimedLaunchCompletion
A Future that resolves to LaunchTiming when a GPU kernel finishes, measuring elapsed GPU time via CUDA events.

Enums§

CompletionStatus
Status of a GPU kernel completion.
PollStrategy
Strategy for polling GPU event completion.

Traits§

ErasedKernelArgs
Object-safe trait for kernel arguments, enabling heterogeneous argument lists in multi_launch_async.

Functions§

multi_launch_async
Launches multiple kernels on the same stream and returns a combined LaunchCompletion future that resolves when all have finished.