pub struct CapabilityRegistry { /* private fields */ }Expand description
Collection of backend capabilities, queried during DAG construction to pick which backend handles each op.
Implementations§
Source§impl CapabilityRegistry
impl CapabilityRegistry
Sourcepub fn register(&mut self, caps: BackendCapabilities)
pub fn register(&mut self, caps: BackendCapabilities)
Register a backend’s capabilities. Order of registration is preserved; lookup methods return registrations in their original order so callers can encode preference (CPU fallback last; GPU first).
Sourcepub fn backends(&self) -> &[BackendCapabilities]
pub fn backends(&self) -> &[BackendCapabilities]
All registered backends.
Sourcepub fn find_backends(
&self,
op: OpKind,
dtype: DType,
) -> Vec<&BackendCapabilities>
pub fn find_backends( &self, op: OpKind, dtype: DType, ) -> Vec<&BackendCapabilities>
Backends supporting (op, dtype), in registration order.
Sourcepub fn find_backend_for(
&self,
op: OpKind,
dtype: DType,
) -> Result<&BackendCapabilities>
pub fn find_backend_for( &self, op: OpKind, dtype: DType, ) -> Result<&BackendCapabilities>
Pick the first registered backend that supports
(op, dtype). Returns
Error::NoBackendForOp
with diagnostic data if none does. Production-correct: never
panics, always surfaces the gap as a typed error.
“First” follows the order of register calls. Convention:
register GPU before CPU so GPU wins ties; the universal CPU
fallback gets picked iff no GPU registered for (op, dtype).
Sourcepub fn build_transfer_matrix(&self) -> TransferMatrix
pub fn build_transfer_matrix(&self) -> TransferMatrix
Build a TransferMatrix from the registered backends’
advertised transfer paths. Each backend contributes its
outbound paths; the matrix consolidates them into a
(src, dst) -> TransferPath lookup.
Trait Implementations§
Source§impl Debug for CapabilityRegistry
impl Debug for CapabilityRegistry
Auto Trait Implementations§
impl Freeze for CapabilityRegistry
impl RefUnwindSafe for CapabilityRegistry
impl Send for CapabilityRegistry
impl Sync for CapabilityRegistry
impl Unpin for CapabilityRegistry
impl UnsafeUnpin for CapabilityRegistry
impl UnwindSafe for CapabilityRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more