vllm.models.minimax_m3.amd.ops.indexer_cp_exchange
¶
Candidate exchange for MiniMax-M3 Triton indexer CP (graph-safe).
Each rank keeps, per index head, its own top-k over a 1/P block shard, all-gathers the packed keys (payload independent of context length), then merges per head. The merge is exact only when every shard scored the same head, so callers must score every global head on every rank. Forced init/local blocks are pinned on both the shard and the merge so they cannot be dropped before the exchange.
Functions:
-
aiter_all_gather–AITER IPC all-gather over the TP group as
[world, *x.shape], or None. -
all_gather–All-gather contiguous
xovergroupto[world, *x.shape]. -
local_topk_keys–Write
[heads, tokens, topk]packed int64 keys for this shard. -
merge_topk_keys–Merge gathered
[world, heads, tokens, topk]keys into global top-k.
aiter_all_gather(x)
¶
AITER IPC all-gather over the TP group as [world, *x.shape], or None.
The payload is viewed as int32 so AITER's pybind layer (which has no
float64 after it relabels integers as floats) accepts it -- int64 keys and
bf16 index queries alike. Concatenates along dim 0,
then views back to x's dtype.
Source code in vllm/models/minimax_m3/amd/ops/indexer_cp_exchange.py
all_gather(x, group)
¶
All-gather contiguous x over group to [world, *x.shape].
AITER's IPC all-gather is tried first: on ROCm the TP communicator's
all_gather stays on the RCCL collective, and its AITER path is only
enabled for DP groups, so it would not pick AITER for these small
per-layer payloads.
Source code in vllm/models/minimax_m3/amd/ops/indexer_cp_exchange.py
local_topk_keys(scores, seq_lens, *, topk, rank, world, query_len, global_blocks, init_blocks, local_blocks, out)
¶
Write [heads, tokens, topk] packed int64 keys for this shard.
Source code in vllm/models/minimax_m3/amd/ops/indexer_cp_exchange.py
merge_topk_keys(keys, topk_idx, seq_lens, *, query_len, init_blocks, local_blocks, attention_block_table=None, sparse_block_table_out=None, sparse_context_lens_out=None, block_page_stride=None)
¶
Merge gathered [world, heads, tokens, topk] keys into global top-k.