pub trait AccelRef<T, B: AccelBackend>:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn len(&self) -> usize;
fn generation(&self) -> u64;
fn device_id(&self) -> Option<u32>;
fn check(&self) -> Result<(), AccelError>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Trait implemented by every backend’s typed-pointer wrapper.
The generation token check is the contract: each backend’s
access() returns Err(AccelError::AccelRefStale) if the
device generation has advanced past the one the ref was minted
against. Code that walks AccelRefs never has to know which
backend is underneath.
Required Methods§
Sourcefn generation(&self) -> u64
fn generation(&self) -> u64
Generation token captured at allocation time. Backends mint
fresh refs against device.generation() and validate the
match on every access().
Sourcefn device_id(&self) -> Option<u32>
fn device_id(&self) -> Option<u32>
Originating device id. Used by multi-device routing to reject cross-device misuse (e.g. AllReduce input mismatch).
Sourcefn check(&self) -> Result<(), AccelError>
fn check(&self) -> Result<(), AccelError>
Validate the ref is still usable. Returns Err if the
device generation has moved or the device is shutting down.
Provided Methods§
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.