kda_recurrent_prenorm

Function kda_recurrent_prenorm 

Source
pub fn kda_recurrent_prenorm(
    qn: &[f32],
    kn: &[f32],
    v: &[f32],
    gate: &[f32],
    beta: &[f32],
    dims: KdaDims,
    state: &mut [f32],
) -> Vec<f32>
Expand description

2026-09-25: Same recurrence, but q/k are already L2-normalised, the input the kda_recurrent GPU kernel gets from causal_conv1d_update_l2norm.

Passing normalised vectors to kda_recurrent instead would normalise them again: nearly a no-op in fp32, but on bf16-rounded vectors it undoes the rounding error in the norm, so the reference would no longer match the kernel’s input.