ModelSsmState

Trait ModelSsmState 

Source
pub trait ModelSsmState {
Show 13 methods // Required methods fn checkpoint_ssm_states(&self, seq: &mut SequenceState) -> Result<()>; fn rollback_ssm_states( &self, seq: &mut SequenceState, num_accepted: usize, ) -> Result<()>; // Provided methods fn has_ssm_layers(&self) -> bool { ... } fn decode_rollback_unsupported(&self) -> bool { ... } fn decode_rollback_ring_slots(&self) -> usize { ... } fn save_decode_ssm_snapshot( &self, _seq: &SequenceState, _ring_slot: usize, ) -> Result<()> { ... } fn restore_decode_ssm_snapshot( &self, _seq: &SequenceState, _ring_slot: usize, ) -> Result<()> { ... } fn decode_marconi_checkpoint(&self, _seq: &mut SequenceState) { ... } fn start_checkpoint_async(&self, seq: &mut SequenceState) -> Result<()> { ... } fn start_rollback_and_checkpoint_async( &self, seq: &mut SequenceState, num_accepted: usize, ) -> Result<()> { ... } fn sync_secondary(&self) -> Result<()> { ... } fn commit_accepted_prefix( &self, _seq: &mut SequenceState, _num_accepted: usize, _k: usize, ) -> Result<()> { ... } fn ssm_snapshot_occupancy(&self) -> Option<(u32, u32)> { ... }
}
Expand description

2026-09-26: Recurrent (SSM) state: checkpoint and rollback around a verify, decode-rollback snapshots, and the commit of an accepted prefix on the secondary stream.

Required Methods§

Source

fn checkpoint_ssm_states(&self, seq: &mut SequenceState) -> Result<()>

Source

fn rollback_ssm_states( &self, seq: &mut SequenceState, num_accepted: usize, ) -> Result<()>

2026-09-25: Restore the SSM state to where num_accepted tokens of the last verify were accepted.

Provided Methods§

Source

fn has_ssm_layers(&self) -> bool

2026-09-25: Whether the model has recurrent SSM layers, whose state is advanced in place each token. Lowering seq_len rewinds paged KV but not that state, so a decode rollback must also restore it from a snapshot. Default false.

Source

fn decode_rollback_unsupported(&self) -> bool

2026-09-26: Whether some layer keeps per-sequence state that lowering the KV cursor does not rewind (LayerCapabilities::decode_rollback_unsupported); the scheduler then declines a decode rollback (rollback_to_boundary). Default false.

Source

fn decode_rollback_ring_slots(&self) -> usize

2026-09-25: Decode-rollback SSM snapshot slots per active sequence; the scheduler sizes each sequence’s snapshot ring from it. 0 (the default) means no decode-rollback snapshots. TransformerModel returns the depth ssm_reserve::decode_rollback_ring_slots chose.

Source

fn save_decode_ssm_snapshot( &self, _seq: &SequenceState, _ring_slot: usize, ) -> Result<()>

2026-09-25: Save seq’s SSM h_state and conv_state (every SSM layer) into its decode-rollback ring slot ring_slot, in 0..decode_rollback_ring_slots(). Default: Ok(()).

Source

fn restore_decode_ssm_snapshot( &self, _seq: &SequenceState, _ring_slot: usize, ) -> Result<()>

2026-09-25: Restore seq’s SSM state from ring slot ring_slot, written earlier by Self::save_decode_ssm_snapshot. Default: Ok(()).

Source

fn decode_marconi_checkpoint(&self, _seq: &mut SequenceState)

2026-09-25: During decode, save a block-aligned SSM snapshot at a checkpoint boundary, so the next turn’s prefix-cache hit can restore from decode-produced state. The scheduler calls it after a step’s SSM state is final. Default: no-op.

Source

fn start_checkpoint_async(&self, seq: &mut SequenceState) -> Result<()>

2026-09-25: Start the SSM checkpoint copies on the secondary stream; call Self::sync_secondary before the next verify. Default: the synchronous Self::checkpoint_ssm_states.

Source

fn start_rollback_and_checkpoint_async( &self, seq: &mut SequenceState, num_accepted: usize, ) -> Result<()>

2026-09-25: Roll the SSM state back to num_accepted and checkpoint it again, on the secondary stream. Default: the synchronous rollback, then checkpoint.

Source

fn sync_secondary(&self) -> Result<()>

2026-09-25: Wait for the secondary stream’s work. Default: Ok(()).

Source

fn commit_accepted_prefix( &self, _seq: &mut SequenceState, _num_accepted: usize, _k: usize, ) -> Result<()>

2026-09-25: Commit the accepted prefix of a verify onto the live SSM h_state and conv_state, on the secondary stream (pair with Self::sync_secondary). Default: Ok(()).

Source

fn ssm_snapshot_occupancy(&self) -> Option<(u32, u32)>

2026-09-25: SSM snapshot-pool occupancy (used, total), or None without a snapshot pool (the default; TransformerModel also returns None when the pool has no slots).

Implementors§