Expand description
K3 KDA CPU ref (twin 8×32 conv-4; prod 96×128 bound −5).
Not a GDN/Mamba reuse. CUDA: super::kda_cuda (K3_CUDA_KDA=0 disables).
Structs§
- KdaConfig
- KDA geometry. Tiny dims are legal for CPU tests; production is 128/4.
- KdaState
- Per-sequence KDA state. Both buffers are FP32, read-modify-write.
Constants§
- KDA_
L2_ EPS - FLA
use_qk_l2norm_in_kerneleps. CUDAk3_kda_recurrent_step_f32uses the same.
Functions§
- bounded_
gate - KDA forget-gate in log space (FLA
use_gate_in_kernel). - conv_
update - Causal depthwise conv + SiLU. Shifts Atlas-width state left, writes
xinto the last slot, theny[c] = silu(dot(w[c], state[c])). - cuda_
kda_ enabled - LinearAttention BoundLayer uses CUDA
kda_decodeunlessK3_CUDA_KDA=0. Projections, AttnRes, and MLP stay on the host either way. - full_
rank_ output_ gate - Full-rank output gate:
sigmoid(g) ⊙ RMSNorm(core)per head. - kda_
decode_ token - One decode token: conv update then recurrent step.
- kda_
from - Map parsed
ModelConfigonto KDA geometry. - kda_
recurrent_ step - One-token KDA core.
qkvis post-conv[3 * qkv_dim](q|k|v). Updatesstate.recurrentin place. q/k are L2-normalised here.