pub struct ExpertLayout {
pub num_layers: u32,
pub num_experts: u32,
pub record_stride: u64,
pub fs_block_size: u64,
}Expand description
Deterministic file geometry for a directory of per-MoE-layer expert files.
One file per MoE layer (experts_{layer:05}.xpr), each holding
num_experts fixed-stride records back to back. record_stride is the raw
record size rounded up to fs_block_size (O_DIRECT requires the read
offset and length to be block-aligned). Mirrors group::GroupLayout’s
fd/offset/*_bytes surface so the KV backends drive it verbatim.
Fields§
§num_layers: u32§num_experts: u32§record_stride: u64Fixed per-expert record stride on disk (a multiple of fs_block_size).
fs_block_size: u64Implementations§
Source§impl ExpertLayout
impl ExpertLayout
Sourcepub fn from_spec(
num_layers: u32,
num_experts: u32,
spec: &ExpertRecordSpec,
fs_block_size: u64,
) -> Self
pub fn from_spec( num_layers: u32, num_experts: u32, spec: &ExpertRecordSpec, fs_block_size: u64, ) -> Self
Build a layout from a record spec. record_stride is spec.raw_bytes()
rounded up to fs_block_size.
Sourcepub fn bytes_per_layer(&self) -> u64
pub fn bytes_per_layer(&self) -> u64
Bytes occupied by one MoE layer’s file (all experts, back to back).
Sourcepub fn file_offset(&self, key: ExpertKey) -> u64
pub fn file_offset(&self, key: ExpertKey) -> u64
File offset of key’s record within its layer file.
Sourcepub fn record_id(&self, key: ExpertKey) -> ExpertRecordId
pub fn record_id(&self, key: ExpertKey) -> ExpertRecordId
Dense record id across the whole model (layer-major).
Sourcepub fn record_bytes(&self) -> u64
pub fn record_bytes(&self) -> u64
Bytes of one record on disk (== record_stride); the fixed read size.
Trait Implementations§
Source§impl Clone for ExpertLayout
impl Clone for ExpertLayout
Source§fn clone(&self) -> ExpertLayout
fn clone(&self) -> ExpertLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExpertLayout
impl Debug for ExpertLayout
Source§impl PartialEq for ExpertLayout
impl PartialEq for ExpertLayout
impl Copy for ExpertLayout
impl Eq for ExpertLayout
impl StructuralPartialEq for ExpertLayout
Auto Trait Implementations§
impl Freeze for ExpertLayout
impl RefUnwindSafe for ExpertLayout
impl Send for ExpertLayout
impl Sync for ExpertLayout
impl Unpin for ExpertLayout
impl UnwindSafe for ExpertLayout
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.