alloc_kda_ssm_state

Function alloc_kda_ssm_state 

Source
pub fn alloc_kda_ssm_state(
    gpu: &dyn GpuBackend,
    cfg: &Glm5NextKdaConfig,
) -> Result<SsmLayerState>
Expand description

Allocate and zero a KDA layer’s recurrent + conv state, pool-free.

Used only where a state is built outside the SSM pool; the serving path takes pool slots (Glm5NextLayer::uses_ssm_pool()), which is what carries the checkpoints and per-token intermediates a speculative rollback needs.

🪤 FP32 is not negotiable. HF casts the recurrent state to float32 and vLLM hardcodes kda_state_dtype, so a BF16/FP16 state is a deviation from the reference, not a memory setting. h_is_f16: false here, and Glm5NextLayer::kda_state refuses a narrowed slot.