vllm.model_executor.kernels.attention.dsa.dcp_indexer_rocm
¶
ROCm DCP candidates ordered by descending FP32 score, then ascending token id.
Functions:
-
gather_global_indexer_keys–Every rank's index keys for one prefill chunk, in global token order.
-
pack_dcp_candidates–Pack each local candidate into one sortable int64 collective element.
-
select_dcp_candidates–Select global candidates without floating-point conversion of token ids.
_pack_local_keys(Cache, Table, Cu, Packed, cache_page_bytes, table_stride, PAGE, HEAD_DIM, WIDTH, TILE)
¶
Copy this rank's index keys out of the cache into one row per token.
A cache page holds PAGE value rows of HEAD_DIM bytes followed by
PAGE four-byte scales, the layout
cp_gather_indexer_k_quant_cache_triton reads. Values and scale travel
together so the all-gather below moves one buffer instead of two.
Source code in vllm/model_executor/kernels/attention/dsa/dcp_indexer_rocm.py
_restore_global_keys(Packed, TokenToSeq, GlobalCu, AllLocalCu, Keys, Scales, Total, MaxLocal, World, Interleave, HEAD_DIM, WIDTH)
¶
Undo the DCP interleave: rank-major gathered rows to token order.
Source code in vllm/model_executor/kernels/attention/dsa/dcp_indexer_rocm.py
gather_global_indexer_keys(kv_cache, chunk, dcp_world_size, cp_interleave, head_dim)
¶
Every rank's index keys for one prefill chunk, in global token order.
Returns (keys, scales) of shape [chunk.total_seq_lens, head_dim]
and [chunk.total_seq_lens]: the whole context of every request in the
chunk, so a row scored against them needs no candidate merge afterwards.
Source code in vllm/model_executor/kernels/attention/dsa/dcp_indexer_rocm.py
pack_dcp_candidates(logits, indices, rank, world_size, interleave, row_starts=None)
¶
Pack each local candidate into one sortable int64 collective element.
Source code in vllm/model_executor/kernels/attention/dsa/dcp_indexer_rocm.py
select_dcp_candidates(gathered, out)
¶
Select global candidates without floating-point conversion of token ids.
The selected set follows the packed (score, token id) order, but the ids are written in no particular order within a row.