pub struct HostSlotMemory { /* private fields */ }Expand description
A pool whose “device” is host memory.
A real implementation, not a stand-in: on a CPU-only build the expert pool is host memory and the link is a memcpy, so this is the backend that build uses. It is also what makes every rule above testable on a machine with no GPU, which is the whole reason the device lives behind a trait.
Implementations§
Trait Implementations§
Source§impl SlotDevice for HostSlotMemory
impl SlotDevice for HostSlotMemory
Source§fn write_slot(
&mut self,
bank: usize,
dst_slot: u32,
src: &[u8],
) -> Result<(), String>
fn write_slot( &mut self, bank: usize, dst_slot: u32, src: &[u8], ) -> Result<(), String>
Writes one expert row from host memory into
dst_slot. src
is exactly row_bytes[bank] long; the implementation may rely
on that.Source§fn copy_slot(
&mut self,
bank: usize,
dst_slot: u32,
src_slot: u32,
) -> Result<(), String>
fn copy_slot( &mut self, bank: usize, dst_slot: u32, src_slot: u32, ) -> Result<(), String>
Copies one slot onto another within the pool, without
touching the host. This is what makes a prefill gather cheaper
than a re-fetch: the bytes are already on the far side of the
link.
Auto Trait Implementations§
impl Freeze for HostSlotMemory
impl RefUnwindSafe for HostSlotMemory
impl Send for HostSlotMemory
impl Sync for HostSlotMemory
impl Unpin for HostSlotMemory
impl UnsafeUnpin for HostSlotMemory
impl UnwindSafe for HostSlotMemory
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> 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