pub struct ConvHistory { /* private fields */ }Expand description
Zero-allocation flat ring buffer storing recent convolution state snapshots for speculative decoding rollback.
Implementations§
Source§impl ConvHistory
impl ConvHistory
Sourcepub fn new(buf_len: usize) -> Self
pub fn new(buf_len: usize) -> Self
Create a new pre-allocated history ring buffer for a convolution layer with buf_len elements.
Sourcepub fn push(&mut self, pos: usize, buffer: &[f32])
pub fn push(&mut self, pos: usize, buffer: &[f32])
Record a snapshot of buffer at sequence position pos.
Zero heap allocation: copies into the pre-allocated flat storage.
Sourcepub fn rollback_to(&mut self, target_pos: usize, buffer: &mut [f32]) -> bool
pub fn rollback_to(&mut self, target_pos: usize, buffer: &mut [f32]) -> bool
Roll back the convolution buffer to the state at target_pos.
Returns true if the state was successfully found and restored.
Trait Implementations§
Source§impl Clone for ConvHistory
impl Clone for ConvHistory
Source§fn clone(&self) -> ConvHistory
fn clone(&self) -> ConvHistory
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 ConvHistory
impl RefUnwindSafe for ConvHistory
impl Send for ConvHistory
impl Sync for ConvHistory
impl Unpin for ConvHistory
impl UnsafeUnpin for ConvHistory
impl UnwindSafe for ConvHistory
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