pub struct ExpertSlots { /* private fields */ }Expand description
A bounded pool of expert slots, and the executor for the plans that fill it.
Holds no bytes: occupant is the pool’s own record of what the
device contains, kept separately from the planner’s residency map
on purpose. The two agreeing is the invariant; a single map could
not disagree, and so could never reveal that a copy failed.
Implementations§
Source§impl ExpertSlots
impl ExpertSlots
Sourcepub fn new(geometry: SlotGeometry) -> Result<Self, SlotFault>
pub fn new(geometry: SlotGeometry) -> Result<Self, SlotFault>
Builds a pool, refusing a geometry no plan could be valid against.
A zero-width bank is refused rather than tolerated: it would make every row size check pass trivially and every copy a no-op, so the pool would report warm plans forever while holding nothing.
Sourcepub fn with_residency(self, residency: BankResidency) -> Self
pub fn with_residency(self, residency: BankResidency) -> Self
Attaches the per-layer host residency this pool copies from.
Without it every layer is assumed device-addressable, which is what an all-pinned host actually is. With it, a plan for an unpinned layer is refused here rather than issued to a device that has no address for those host rows.
pub fn geometry(&self) -> &SlotGeometry
pub fn stats(&self) -> SlotStats
pub fn reset_stats(&mut self)
Sourcepub fn occupant(&self, slot: u32) -> Option<ExpertId>
pub fn occupant(&self, slot: u32) -> Option<ExpertId>
Which expert the device holds in slot, as far as this pool
knows. None for an empty slot and for one whose last copy
failed.
Sourcepub fn invalidate_slot(&mut self, slot: u32)
pub fn invalidate_slot(&mut self, slot: u32)
Marks a slot as holding nothing known. Idempotent.
Sourcepub fn invalidate_all(&mut self)
pub fn invalidate_all(&mut self)
Forgets the whole pool. The counters survive: they describe traffic that really happened, and a resize does not unmake it.
Sourcepub fn resize(&mut self, slots: usize) -> Result<(), SlotFault>
pub fn resize(&mut self, slots: usize) -> Result<(), SlotFault>
Resizes the pool, dropping everything resident.
Slot ids are positions in an allocation that no longer exists,
so keeping the occupancy map would point at other experts’
bytes – the same reasoning as
ExpertCache::rebuild,
and the two must be resized together or the planner will name
slots this pool does not have.
Sourcepub fn apply_copy_plan(
&mut self,
layer: u32,
plan: &CopyPlan,
rows: &dyn ExpertRows,
device: &mut dyn SlotDevice,
) -> Result<Applied, SlotFault>
pub fn apply_copy_plan( &mut self, layer: u32, plan: &CopyPlan, rows: &dyn ExpertRows, device: &mut dyn SlotDevice, ) -> Result<Applied, SlotFault>
Applies an ensure
plan: the LRU picked the slots, so this is the indexed device
path and an unpinned layer cannot take it.
Sourcepub fn apply_materialize(
&mut self,
layer: u32,
plan: &CopyPlan,
rows: &dyn ExpertRows,
device: &mut dyn SlotDevice,
) -> Result<Applied, SlotFault>
pub fn apply_materialize( &mut self, layer: u32, plan: &CopyPlan, rows: &dyn ExpertRows, device: &mut dyn SlotDevice, ) -> Result<Applied, SlotFault>
Applies a
materialize_layer
plan: the whole layer, slot e for expert e. This is the one
shape an unpinned layer accepts, because it needs no device
alias for the host rows.
Sourcepub fn apply_gather_plan(
&mut self,
plan: &GatherPlan,
device: &mut dyn SlotDevice,
) -> Result<Applied, SlotFault>
pub fn apply_gather_plan( &mut self, plan: &GatherPlan, device: &mut dyn SlotDevice, ) -> Result<Applied, SlotFault>
Applies a GatherPlan: rows the prefill buffer can take from
slots that already hold them, rather than from the host.
A source slot whose occupant is unknown is refused. The planner believes it is resident; this pool knows a copy into it failed, and gathering from it would propagate garbage into a second slot while both are recorded as valid.
Auto Trait Implementations§
impl Freeze for ExpertSlots
impl RefUnwindSafe for ExpertSlots
impl Send for ExpertSlots
impl Sync for ExpertSlots
impl Unpin for ExpertSlots
impl UnsafeUnpin for ExpertSlots
impl UnwindSafe for ExpertSlots
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
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