pub struct Glm5NextKdaWorkspace {Show 13 fields
pub qkv_parts: DevicePtr,
pub qkv_proj: DevicePtr,
pub conv_out: DevicePtr,
pub q_f32: DevicePtr,
pub k_f32: DevicePtr,
pub v_f32: DevicePtr,
pub gate: DevicePtr,
pub beta: DevicePtr,
pub core: DevicePtr,
pub g_raw: DevicePtr,
pub out_gate: DevicePtr,
pub o_norm_out: DevicePtr,
pub final_out: DevicePtr,
/* private fields */
}Expand description
2026-09-25: Scratch for the forward path, sized once for max_tokens (prefill buffers padded
to a whole number of chunks). The loader shares one workspace across the KDA layers.
The intermediate buffers are pub so the numeric tests can compare each stage, not only the
layer output.
Fields§
§qkv_parts: DevicePtr2026-09-25: [3, T, qkv] BF16: the q, k and v projection outputs, before the pack.
qkv_proj: DevicePtr2026-09-25: [T, conv_dim] BF16: q|k|v per token, before the conv.
conv_out: DevicePtr2026-09-25: [T, conv_dim] BF16: after conv + SiLU, with q|k L2-normalised (inside the
conv kernel on decode, by l2_norm_bf16 in place on prefill).
q_f32: DevicePtr2026-09-25: [T_pad, qkv] FP32: q, k and v widened for the chunked prefill. Prefill only.
k_f32: DevicePtr§v_f32: DevicePtr§gate: DevicePtr2026-09-25: [T_pad, heads, head_dim] FP32: the bounded log-decay kda_gate writes.
beta: DevicePtr2026-09-25: [T_pad, heads] FP32: sigmoid(b_proj(h)).
core: DevicePtr2026-09-25: [T_pad, heads, head_dim] FP32: the KDA core output, before o_norm.
g_raw: DevicePtr2026-09-25: [T, qkv] BF16: f_b(f_a(h)), the forget-gate input kda_gate reads. It has
the same shape as out_gate and must not alias it.
out_gate: DevicePtr2026-09-25: [T, qkv] BF16: g_b(g_a(h)), the low-rank output gate.
o_norm_out: DevicePtr2026-09-25: [T, qkv] BF16: after the sigmoid-gated RMSNorm.
final_out: DevicePtr2026-09-25: [T, hidden] BF16: the block output.