Expand description
2026-09-25: Per-sequence DSA indexer cache: the k_normed, gate and valid rows the
selector reads.
Owner: model-arch (GLM-5.3 DSA). Invariants:
len <= capacity:advanceandsync_torefuse to passcapacity, andrewind_toonly shrinks.
The indexer keys and gates are projections of the hidden state (indexer.wk,
index_kpool_compress_gate), which the MLA latent cache does not hold, so they get their
own cache. It is a LayerState, allocated per sequence by TransformerLayer::alloc_state.
§Flat, not paged
dsa_kpool_compress reads k[raw * D + d] and gate[raw * D + d] at absolute
positions, so this is one contiguous buffer per sequence. The MLA latent cache stays
paged.
Structs§
- Glm5
Next DsaState - 2026-09-25: One sequence’s indexer cache for one DSA layer, allocated once at
max_dsa_contextrows and never grown.
Functions§
- dsa_
capacity - 2026-09-25: Indexer cache rows for
max_contexttokens, rounded down to whole pools (a trailing partial pool is not a pool). - indexer_
state_ bytes - 2026-09-25: Bytes one sequence’s indexer cache takes for one DSA layer at
capacityrows:capacity * (4 * index_head_dim + 1), the sizesGlm5NextDsaState::allocallocates fork_normed,gateandvalid. The serve’s per-sequence reserve uses it. - max_
dsa_ context - 2026-09-25: Rows a sequence’s indexer cache holds:
cfg.max_contextrounded down to whole pools (dsa_capacity).