SsmLayerState

Struct SsmLayerState 

Source
pub struct SsmLayerState {
    pub h_state: DevicePtr,
    pub conv_state: DevicePtr,
    pub h_state_checkpoint: Option<DevicePtr>,
    pub conv_state_checkpoint: Option<DevicePtr>,
    pub h_state_intermediates: Vec<DevicePtr>,
    pub conv_state_intermediates: Vec<DevicePtr>,
    pub h_is_f16: bool,
    pub h_prefill_stage: Option<DevicePtr>,
    pub ple: Option<PleSeqState>,
}
Expand description

2026-09-25: Per-sequence state of a recurrent (SSM/GDN) layer: the recurrent h state and the conv1d window, plus the copies speculative decode rolls back to.

Fields§

§h_state: DevicePtr

2026-09-25: Recurrent state; FP32, or FP16 when h_is_f16.

§conv_state: DevicePtr

2026-09-25: Conv1d window, FP32 [conv_dim, d_conv].

§h_state_checkpoint: Option<DevicePtr>

2026-09-25: Copy of h_state restored when a verify accepts no draft. A pool address, or allocated on first use by the checkpoint save (checkpoint_ssm_states_dispatch, start_checkpoint_async_dispatch).

§conv_state_checkpoint: Option<DevicePtr>

2026-09-25: Copy of conv_state, restored with h_state_checkpoint.

§h_state_intermediates: Vec<DevicePtr>

2026-09-25: Per-token h states of a verify: element i holds the state after verify token i. A rollback to n accepted tokens copies element n - 1.

§conv_state_intermediates: Vec<DevicePtr>

2026-09-25: Per-token conv states of a verify, indexed like h_state_intermediates.

§h_is_f16: bool

2026-09-25: Storage format of h_state: false = FP32, true = FP16.

A sequence on an f16-sized pool (h_prefill_stage is Some) starts true: the slot holds only 2 bytes per element. On an FP32-sized pool it starts false, and TransformerModel::ssm_h_to_f16_dispatch converts the state and sets it true on the first decode step when FP16 h-state is enabled.

§h_prefill_stage: Option<DevicePtr>

2026-09-25: FP32 staging blob for this sequence’s slot when the pool is f16-sized (--ssm-h-dtype f16-pool). GDN prefill widens h_state into it before its FP32 kernels and narrows it back after (qwen3_ssm::ssm_h_fp16). None means the slot is FP32 and prefill writes h_state in place. One blob per slot, shared by every layer of the sequence.

§ple: Option<PleSeqState>

2026-09-25: PLE per-sequence carry (token history and dilated-conv state), created on first use, only on a layer that hosts a PleLayer.

Trait Implementations§

Source§

impl LayerState for SsmLayerState

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

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,