Skip to main content

EpMap

Struct EpMap 

Source
pub struct EpMap {
    pub n_experts: usize,
    pub ranks: usize,
    pub entry_rank: usize,
    pub layers: BTreeMap<usize, Vec<u8>>,
}
Expand description

One parsed placement map: per layer, owners[expert] = rank.

Fields§

§n_experts: usize§ranks: usize§entry_rank: usize

The first-hop card of the law: the rank the always-active bundle is pinned to. The glm5 TP-2 loader requires 0 (root).

§layers: BTreeMap<usize, Vec<u8>>

layer index -> owner rank per expert (n_experts entries, each < ranks).

Implementations§

Source§

impl EpMap

Source

pub fn even_owners(n_experts: usize, ranks: usize) -> Vec<u8>

The even split this map format generalizes: rank = expert / (n/ranks), contiguous halves — byte-for-byte the pre-map arm_moe_ep ownership, and exactly the tool’s even strategy (the control arm).

Source

pub fn parse(text: &str) -> Result<EpMap, String>

Fail-closed parse of a memra-ep-map-v1 JSON document. Every refusal names the field and the law it broke.

Source

pub fn render(&self) -> String

Deterministic minimal serialization (gate harnesses and tests emit through this; carries exactly the load-bearing fields, keys in the tool’s sorted order). The MINT tool is the artifact producer in production — this exists so the gate’s skew/red maps are real memra-ep-map-v1 documents.

Source

pub fn validate_layer_cover(&self, ep_layers: &[usize]) -> Result<(), String>

Loader-side cover law: the map’s layer set must EXACTLY match the EP-armed MoE layers of the load. A missing layer would silently fall to the even split (the trap this refusal exists for); an extra layer is a map minted for a different arrangement.

Trait Implementations§

Source§

impl Clone for EpMap

Source§

fn clone(&self) -> EpMap

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 EpMap

Source§

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

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

impl Eq for EpMap

Source§

impl PartialEq for EpMap

Source§

fn eq(&self, other: &EpMap) -> 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 EpMap

Auto Trait Implementations§

§

impl Freeze for EpMap

§

impl RefUnwindSafe for EpMap

§

impl Send for EpMap

§

impl Sync for EpMap

§

impl Unpin for EpMap

§

impl UnsafeUnpin for EpMap

§

impl UnwindSafe for EpMap

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> 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, !>

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.