Expand description
GLM-5.3 DSA attention — the launcher for the selected-index NoPE MLA paged decode.
Consumes what super::select produced: a [q_rows, out_width] i32 row of token
ids with -1 holes. Gathers exactly those tokens from the paged FP8 latent cache.
§Why this is not the masked kernel
dsa_mla_masked_attn is an oracle (see super::MASKED_ATTN_MAX_KEYS). The
production path gathers per row, which is what HF says the reference cannot do
(_supports_flash_attn = False, “cannot be mapped to FA without a custom kernel that
can select on a per indices bases per row”) and what vLLM ships. The gather is
exactly equivalent, not an approximation: the reference mask is pure set
membership, with duplicates collapsed and no additive weighting.
§🪤 NoPE, and why no common/ kernel would do
GLM-5.3 has qk_rope_head_dim == 0: the latent is the whole cache token.
common/mla_paged_decode.cu declares kv_cache_dim and never reads it (its strides
come from #define ROPE_DIM 64); common/mla_paged_decode_fp8.cu uses the runtime
stride but then overwrites dims 448–511 with rope taken from the next token. Both
fail silently. Hence a GLM-target kernel with no rope arm at all.
Structs§
- DsaDecode
Inputs - Everything the decode reads, all caller-owned.
- DsaDecode
Paging - Paging geometry the decode needs and the selection does not.
- Glm5
Next DsaDecode Kernel - The selected-index MLA decode entry point.
Constants§
- DSA_
DECODE_ MODULE - Module name the DSA decode kernel resolves from — an unlisted
.cutakes its file stem, and this one lives in theglm-5.3-flashtarget, notcommon/.
Functions§
- decode_
attention - Launch the selected-index decode. Enqueued on
stream, not synchronised.