pub struct TransferMatrix { /* private fields */ }Expand description
Lookup table mapping (source_device, dest_device) pairs to the
cheapest available TransferPath. Built once at registration
time from each backend’s advertised outbound paths; consulted
every time the DAG inserts an Op::Move / Op::Copy.
Implementations§
Source§impl TransferMatrix
impl TransferMatrix
Sourcepub fn path(
&self,
src: DeviceLocation,
dst: DeviceLocation,
) -> Option<TransferPath>
pub fn path( &self, src: DeviceLocation, dst: DeviceLocation, ) -> Option<TransferPath>
Look up the registered path between two devices. Returns
None if no direct path was advertised; the caller can
fall back to host-staging via the universal HostStaging
path.
Sourcepub fn path_or_staging(
&self,
src: DeviceLocation,
dst: DeviceLocation,
) -> TransferPath
pub fn path_or_staging( &self, src: DeviceLocation, dst: DeviceLocation, ) -> TransferPath
Same as Self::path but always returns a path: falls back to
TransferPath::HostStaging (the universal fallback) when no
direct advertised path exists. CPU is reachable from every
backend through host-staging, so this never returns an error
for practical use cases — though see
Error::UnsupportedTransfer
for the case when a backend can’t even host-stage.
Sourcepub fn entries(
&self,
) -> impl Iterator<Item = (&(DeviceLocation, DeviceLocation), &TransferPath)>
pub fn entries( &self, ) -> impl Iterator<Item = (&(DeviceLocation, DeviceLocation), &TransferPath)>
All entries in the matrix.
Trait Implementations§
Source§impl Debug for TransferMatrix
impl Debug for TransferMatrix
Auto Trait Implementations§
impl Freeze for TransferMatrix
impl RefUnwindSafe for TransferMatrix
impl Send for TransferMatrix
impl Sync for TransferMatrix
impl Unpin for TransferMatrix
impl UnsafeUnpin for TransferMatrix
impl UnwindSafe for TransferMatrix
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