pub struct DeviceMap { /* private fields */ }Expand description
Per-node device assignment for a graph. Indexed by NodeId. Source nodes
(Op::Input / Op::Param) are external, so their entry is unused.
Implementations§
Source§impl DeviceMap
impl DeviceMap
Sourcepub fn single(graph: &Graph, device: Device) -> Self
pub fn single(graph: &Graph, device: Device) -> Self
Every node on device (one segment — the degenerate case).
Sourcepub fn from_fn(graph: &Graph, f: impl Fn(&Node) -> Device) -> Self
pub fn from_fn(graph: &Graph, f: impl Fn(&Node) -> Device) -> Self
Assign each node a device from f.
Sourcepub fn auto_fallback(graph: &Graph, primary: Device, fallback: Device) -> Self
pub fn auto_fallback(graph: &Graph, primary: Device, fallback: Device) -> Self
Run each op on primary, except ops primary’s backend can’t lower —
those go to fallback. Uses Backend::supported_ops; an empty list
means “accepts everything” (no split). primary’s backend must be
registered (its feature enabled), else everything falls back.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeviceMap
impl RefUnwindSafe for DeviceMap
impl Send for DeviceMap
impl Sync for DeviceMap
impl Unpin for DeviceMap
impl UnsafeUnpin for DeviceMap
impl UnwindSafe for DeviceMap
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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