PleLayer

Struct PleLayer 

Source
pub struct PleLayer { /* private fields */ }

Implementations§

Source§

impl PleLayer

Source

pub fn snapshot_aux( &self, st: &PleSeqState, gpu: &dyn GpuBackend, stream: u64, ) -> Result<Vec<u8>>

2026-09-25: The aux blob: hist_len (u32), the history (u32 each), then the conv state’s f32 bytes, all little-endian.

Source

pub fn restore_aux( &self, st: &mut PleSeqState, blob: &[u8], gpu: &dyn GpuBackend, stream: u64, ) -> Result<()>

2026-09-25: Restore a blob from Self::snapshot_aux and clear prestaged_va. Errors when the blob’s size does not match.

Source§

impl PleLayer

Source

pub fn prestage( &self, st: &mut PleSeqState, tokens: &[u32], gpu: &dyn GpuBackend, stream: u64, ) -> Result<()>

2026-09-25: The per-step host work of a decode step: the n-gram hash, the row gather (gather_host, which uploads the slots into slots_dev from host memory) and the history advance. It runs through decode_prestage before any graph replay or capture; the next forward consumes prestaged_va and does not advance the history again.

Source

pub fn release_seq_state( &self, st: &mut PleSeqState, gpu: &dyn GpuBackend, ) -> Result<()>

2026-09-25: Free one sequence’s PLE carry; conv is a bare DevicePtr, so dropping PleSeqState frees nothing. Idempotent: conv is nulled, and the state cleared, even when the free fails, whose error is returned.

Source§

impl PleLayer

Source

pub fn new( dims: PleIdDims, head_dim: usize, hidden: usize, hc_mult: usize, k_size: usize, dilation: usize, eps: f32, weights: PleWeights, table: NgramTable, max_tokens: usize, gpu: &dyn GpuBackend, ) -> Result<Self>

Source

pub fn new_seq_state(&self, gpu: &dyn GpuBackend) -> Result<PleSeqState>

2026-09-25: Allocate one sequence’s PLE carry (conv buffer + empty history). The conv buffer is not initialised here; the first forward or prestage sees the empty history and runs reset.

Source

pub fn rearm(&self, st: &mut PleSeqState)

2026-09-25: Restore the prestaged state after a failed CUDA-graph capture attempt (the eager re-run calls forward again, and the first call consumed prestaged_va).

Source

pub fn forward_row( &self, st: &mut PleSeqState, highway_row: DevicePtr, ids: &[u32], ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

2026-09-25: One highway row with an explicit id: the multi-seq decode entry (ctx.host_token_ids holds the whole batch; the caller slices). It never consumes a prestage.

Source

pub fn forward( &self, st: &mut PleSeqState, highway: DevicePtr, num_tokens: usize, fresh: bool, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

2026-09-25: Inject into highway [T, hc_mult*hidden] FP32, in place. fresh starts a new sequence (prefill from position 0).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,