pub struct StateSnapshot {
pub layers: Vec<LayerSnapshot>,
pub seq_len: usize,
pub anchor_depth: u32,
pub boundary_kind: u8,
pub semantic_hash: u64,
pub shift_offset: u32,
}Expand description
Snapshot of model KV + conv state after prefilling a token sequence. Backend-agnostic: stores raw bytes that the backend knows how to restore.
Fields§
§layers: Vec<LayerSnapshot>§seq_len: usize§anchor_depth: u32§boundary_kind: u8§semantic_hash: u64§shift_offset: u32Implementations§
Source§impl StateSnapshot
impl StateSnapshot
pub fn new(layers: Vec<LayerSnapshot>, seq_len: usize) -> Self
pub fn with_anchor( self, depth: u32, kind: SemanticBoundaryKind, semantic_hash: u64, ) -> Self
pub fn with_shift_offset(self, shift: u32) -> Self
Source§impl StateSnapshot
impl StateSnapshot
pub fn byte_size(&self) -> usize
Sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
true iff any attention layer in this snapshot is
compressed. Used by Lfm2Model::forward_prefill to skip
snapshots whose compression mode doesn’t match the live
state — treat as cache miss instead of panicking on
restore.
Sourcepub fn is_f16(&self) -> bool
pub fn is_f16(&self) -> bool
true iff any attention layer in this snapshot is f16
(AttentionF16). Used by Lfm2Model::forward_prefill’s
cross-mode gate to reject an f16 snapshot against an f32
(or compressed) live state — their byte widths differ, so a
cross-mode restore would corrupt the cache.
Trait Implementations§
Source§impl Clone for StateSnapshot
impl Clone for StateSnapshot
Source§fn clone(&self) -> StateSnapshot
fn clone(&self) -> StateSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StateSnapshot
impl RefUnwindSafe for StateSnapshot
impl Send for StateSnapshot
impl Sync for StateSnapshot
impl Unpin for StateSnapshot
impl UnsafeUnpin for StateSnapshot
impl UnwindSafe for StateSnapshot
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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