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
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
External-data path that supplied this catalog, when it is externally backed.
Sourcepub fn tensor_offset(&self) -> usize
pub fn tensor_offset(&self) -> usize
Absolute byte offset of the tensor in its external-data mapping.
Sourcepub fn tensor_len(&self) -> usize
pub fn tensor_len(&self) -> usize
Canonical tensor byte length validated by this catalog.
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.
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 moreSource§impl Debug for WeightRegionCatalog
impl Debug for WeightRegionCatalog
impl Eq for WeightRegionCatalog
Source§impl PartialEq for WeightRegionCatalog
impl PartialEq for WeightRegionCatalog
impl StructuralPartialEq for WeightRegionCatalog
Auto Trait Implementations§
impl Freeze for WeightRegionCatalog
impl RefUnwindSafe for WeightRegionCatalog
impl Send for WeightRegionCatalog
impl Sync for WeightRegionCatalog
impl Unpin for WeightRegionCatalog
impl UnsafeUnpin for WeightRegionCatalog
impl UnwindSafe for WeightRegionCatalog
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.