Skip to main content

BankResidency

Struct BankResidency 

Source
pub struct BankResidency { /* private fields */ }
Expand description

The validated per-layer residency of an attached set of expert banks.

Constructing one is the check; holding one is the proof the three invariants in the module docs hold for this configuration.

Implementations§

Source§

impl BankResidency

Source

pub fn new( labels: &[HostResidency], num_layers: usize, cpu_layers: &BTreeSet<u32>, prefill_overlap: bool, ) -> Result<Self, ResidencyError>

Attach labels (the achieved ones) to a model of num_layers MoE layers.

cpu_layers is the set already routed to the CPU executor and prefill_overlap is whether the overlap path is still enabled. Both are inputs, not outputs: this refuses a bad combination rather than repairing it, because repairing it here would mean silently moving a layer to another executor after the cache geometry was already sized against the old answer.

Source

pub fn all_pinned(num_layers: usize) -> Self

The default when no plan was in force: every layer pinned, no invariant to check, prefill overlap free to stay on.

Source

pub fn num_layers(&self) -> usize

Source

pub fn labels(&self) -> &[HostResidency]

Source

pub fn label(&self, layer_id: u32) -> HostResidency

§Panics

If layer_id is not a layer of this model.

Source

pub fn unpinned_layers(&self) -> &BTreeSet<u32>

Layers with no device address. The copy plan skips their rows entirely.

Source

pub fn is_unpinned(&self, layer_id: u32) -> bool

Source

pub fn has_unpinned(&self) -> bool

Whether any layer is locked or pageable – the same signal that must have turned prefill overlap off.

Source

pub fn copy_route( &self, layer_id: u32, whole_layer: bool, ) -> Result<CopyRoute, ResidencyError>

How a copy staged for layer_id must be carried out.

whole_layer is whether the caller staged the whole-layer materialize (every expert, slot e for expert e) rather than an LRU ensure. An unpinned layer accepts only the former; a pinned layer takes the indexed device path either way, since a registered bank can serve both.

Trait Implementations§

Source§

impl Clone for BankResidency

Source§

fn clone(&self) -> BankResidency

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BankResidency

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BankResidency

Source§

impl PartialEq for BankResidency

Source§

fn eq(&self, other: &BankResidency) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BankResidency

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.