pub trait AccelBackend:
Send
+ Sync
+ 'static {
type Device: AccelDevice<Backend = Self>;
type Stream: AccelStream<Backend = Self>;
type Event: Debug + Send + Sync + 'static;
type Error: Error + Send + Sync + From<AccelError> + 'static;
const NAME: &'static str;
}Expand description
Marker trait identifying a compute-acceleration backend.
Implemented by the Backend zero-sized type in each backend
crate. Use as a trait bound:
fn observe_load<B: AccelBackend>(d: &B::Device) -> u32 { ... }The associated types name the lifetime-bounded handles a
backend hands out. They’re all Send + Sync + 'static so they
can travel across actor boundaries.
Required Associated Constants§
Required Associated Types§
Sourcetype Device: AccelDevice<Backend = Self>
type Device: AccelDevice<Backend = Self>
Device handle (e.g. cudarc::driver::CudaContext,
hipDevice_t, MTLDevice).
Sourcetype Stream: AccelStream<Backend = Self>
type Stream: AccelStream<Backend = Self>
Per-actor stream / queue handle (e.g.
cudarc::driver::CudaStream, hipStream_t,
MTLCommandQueue).
Sourcetype Event: Debug + Send + Sync + 'static
type Event: Debug + Send + Sync + 'static
Recordable / waitable synchronization primitive (e.g.
cudaEvent_t, hipEvent_t, MTLEvent).
Sourcetype Error: Error + Send + Sync + From<AccelError> + 'static
type Error: Error + Send + Sync + From<AccelError> + 'static
Backend-specific error variants supplement the core
AccelError enum via the LibraryError { lib, msg }
catch-all. Backends that need finer granularity wrap
AccelError in their own type; the core itself is
#[non_exhaustive] so adding variants is a minor bump,
not a breaking change.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.