vllm.models.minimax_m3.amd.akr_attn
¶
The attention side of the MiniMax-M3.1 NVFP4 sparse layers on amd_kernels: the
qkv route (QKV GEMM + norms + RoPE + NVFP4 inserts), the attention route
(sparse decode / prefill; pure decode steps write o_proj's MXFP8 input) and the
indexer route (the decode top-16, run inside the same layer's sparse decode, and
the prefill top-16). The library owns the kernels, their dtypes and warm-up; this
module passes tensors.
Functions:
-
decode–The sparse decode: with this layer's indexer recorded, index top-16 +
-
index_decode–Record the decode rows' top-16 for the same layer's
decode. -
index_prefill–The prefill rows' top-16: scorer + top-k in one library call.
-
index_prefill_blocker–Why the library's prefill top-16 cannot serve this indexer (None: it can).
-
init_and_warm_up–At model build: the decode indexer (with
indexer_decode_cpa TP -
kernels–The amd_kernels layer entries, resolved once (the eager attention calls them).
-
oproj_input–oproj_quant's buffers, written by the attention, as o_proj's input. -
oproj_mxfp8_mode_ok–False while a breakable PIECEWISE graph is captured: its segments replay for
-
oproj_quant–(codes, scales, tile) for the NVFP4 sparse decode's MXFP8 output on a pure
-
qkv_norm_rope_nvfp4_insert–The layer's QKV + norms + RoPE + NVFP4 inserts -> (q, index-q): the library's
-
qkv_on–Whether the layer's QKV step (QKV GEMM + norms + RoPE + NVFP4 inserts) runs
decode(layer, q, kv_cache, topk, d, sm_scale, out, k_scale, v_scale, quant_out=None)
¶
The sparse decode: with this layer's indexer recorded, index top-16 + attention as one library call; else the attention alone.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
index_decode(indexer, iq, index_cache, d, init_blocks, local_blocks)
¶
Record the decode rows' top-16 for the same layer's decode.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
index_prefill(indexer, iq, index_cache, p, num_valid_pages, topk)
¶
The prefill rows' top-16: scorer + top-k in one library call.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
index_prefill_blocker(indexer)
¶
Why the library's prefill top-16 cannot serve this indexer (None: it can).
Source code in vllm/models/minimax_m3/amd/akr_attn.py
init_and_warm_up(vllm_config, num_heads, num_kv_heads, num_index_heads)
¶
At model build: the decode indexer (with indexer_decode_cp a TP
collective, every rank in order) and every variant the switched paths launch.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
kernels()
cached
¶
The amd_kernels layer entries, resolved once (the eager attention calls them).
Source code in vllm/models/minimax_m3/amd/akr_attn.py
oproj_input(quant, rows, k)
¶
oproj_quant's buffers, written by the attention, as o_proj's input.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
oproj_mxfp8_mode_ok()
¶
False while a breakable PIECEWISE graph is captured: its segments replay for any batch of the size, so the choice must not depend on the dummy batch.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
oproj_quant(attn, num_tokens)
¶
(codes, scales, tile) for the NVFP4 sparse decode's MXFP8 output on a pure decode step; None: bf16 output and o_proj's quantizer.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
qkv_norm_rope_nvfp4_insert(attn, x, positions, slot_mapping, index_slot_mapping)
¶
The layer's QKV + norms + RoPE + NVFP4 inserts -> (q, index-q): the library's one call from amd_kernels' codes, else the layer's linear, then the insert.
Source code in vllm/models/minimax_m3/amd/akr_attn.py
qkv_on(attn)
¶
Whether the layer's QKV step (QKV GEMM + norms + RoPE + NVFP4 inserts) runs amd_kernels; the library names why not (logged once).