pub struct WeightRegionCatalog { /* private fields */ }Expand description
Validated expert-region catalog over a WeightRef in a WeightStore.
A pageable catalog guarantees that each expert is represented by one overflow-checked external byte range. The quantization metadata is retained so a kernel can decode one range without inspecting or materializing peers.
Implementations§
Source§impl WeightRegionCatalog
impl WeightRegionCatalog
Sourcepub fn classify(weight: &WeightRef, layout: ExpertTensorLayout) -> Self
pub fn classify(weight: &WeightRef, layout: ExpertTensorLayout) -> Self
Classify a weight using an explicit model/package layout descriptor.
Invalid or non-expert-major layouts produce a non-pageable catalog rather than failing model load; callers must fall back to the resident path.
Sourcepub fn for_mapped_tensor_view(
dtype: DataType,
dims: &[usize],
tensor_len: usize,
layout: ExpertTensorLayout,
) -> Self
pub fn for_mapped_tensor_view( dtype: DataType, dims: &[usize], tensor_len: usize, layout: ExpertTensorLayout, ) -> Self
Build relative expert ranges for a tensor view that the caller has already established aliases an external mmap initializer.
This is the kernel-boundary counterpart to classify:
it cannot re-borrow through WeightStore, but applies the same shape,
layout, quantization, overflow, and isize::MAX validation.
pub fn pageability(&self) -> &Pageability
pub fn is_pageable(&self) -> bool
pub fn layout(&self) -> &ExpertTensorLayout
pub fn dtype(&self) -> DataType
pub fn mapped_bytes(&self) -> usize
pub fn region(&self, expert: usize) -> Option<&ExpertWeightRegion>
pub fn relative_range(&self, expert: usize) -> Option<Range<usize>>
Sourcepub fn expert_bytes<'a>(
&self,
store: &'a WeightStore,
expert: usize,
) -> Option<&'a [u8]>
pub fn expert_bytes<'a>( &self, store: &'a WeightStore, expert: usize, ) -> Option<&'a [u8]>
Borrow one expert directly from the live read-only mmap.
pub fn tensor_offset(&self) -> usize
Trait Implementations§
Source§impl Clone for WeightRegionCatalog
impl Clone for WeightRegionCatalog
Source§fn clone(&self) -> WeightRegionCatalog
fn clone(&self) -> WeightRegionCatalog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more