vllm.models.kimi_k3.common.dsa_cache
¶
Kimi-K3.1 DSA indexer cache, shared by the NVIDIA and ROCm stacks.
Classes:
-
KimiK3IndexerMetadataBuilder–Writes the indexer keys at slots derived from the block table, as the
Functions:
-
dense_mla_draft_bytes_per_token–Per-token bytes of a dense MLA draft's caches, which share the DSA row:
-
indexer_cache_entry_bytes–Indexer key cache bytes per token: FP8 values + one 4 B scale, or MXFP4
-
kimi_k3_indexer_uses_fp4–FP8 (132 B/token) indexer keys by default (
indexer_kv_dtype='auto'); -
packed_dsa_block_size–Block size of the packed cache of a KDA-hybrid DSA model, else None.
KimiK3IndexerMetadataBuilder
¶
Bases: DeepseekV32IndexerMetadataBuilder
Writes the indexer keys at slots derived from the block table, as the compressed indexers are written: in a packed block row the block table addresses 64-token kernel pages, which manager slots do not.
Source code in vllm/models/kimi_k3/common/dsa_cache.py
dense_mla_draft_bytes_per_token(vllm_config)
¶
Per-token bytes of a dense MLA draft's caches, which share the DSA row:
their full-attention MLA specs group with the target's (see
configure_dense_draft).
Source code in vllm/models/kimi_k3/common/dsa_cache.py
indexer_cache_entry_bytes(head_dim, use_fp4_cache)
¶
Indexer key cache bytes per token: FP8 values + one 4 B scale, or MXFP4 values (two per byte) + one UE8M0 byte per 32 values.
Source code in vllm/models/kimi_k3/common/dsa_cache.py
kimi_k3_indexer_uses_fp4(vllm_config)
¶
FP8 (132 B/token) indexer keys by default (indexer_kv_dtype='auto');
MXFP4 (68 B/token) only when requested with --attention-config
'{"indexer_kv_dtype": "mxfp4"}'. MXFP4 needs SM10x (checked by
dsa_indexer_uses_fp4), the fused key insert (layernorm k-norm, no indexer
RoPE) and no PCP; anything else raises instead of writing another format.
Source code in vllm/models/kimi_k3/common/dsa_cache.py
packed_dsa_block_size(vllm_config, mla_bytes_per_token, state_bytes, alignment)
¶
Block size of the packed cache of a KDA-hybrid DSA model, else None.
A block row holds every DSA layer's MLA and indexer pages, plus a dense
MLA draft's pages; size it to fit as many KDA states as there are DSA
layers. The KDA state shards with TP and the row does not, so the block is
rounded at _PD_REFERENCE_TP and scaled by _PD_REFERENCE_TP / tp.
Block sizes of different TP sizes stay divisible, and the rounding stays
fine: a power of two would leave up to half the row empty once spec
decoding grows the conv state past one.