vllm.models.minimax_m3.amd.ops
¶
AMD/ROCm fused Triton ops for MiniMax-M3.
These replace per-element PyTorch fallbacks (FlashInfer / fused HIP kernels are unavailable on ROCm) with single-pass Triton kernels to cut launch overhead and intermediate-tensor traffic during decode.
Modules:
-
gemma_rmsnorm–Fused Gemma-style RMSNorm for AMD ROCm via Triton.
-
index_topk–Triton kernels for MiniMax M3 lightning-indexer block scoring + top-k.
-
indexer_context_parallel–Opt-in M3 compute-only index context partitioning, independent of global DCP.
-
indexer_cp_exchange–Candidate exchange for MiniMax-M3 Triton indexer CP (graph-safe).
-
sparse_attn–ROCm gfx942/gfx950 block-sparse GQA prefill kernel for MiniMax-M3.
-
sparse_pa–AITER page-16 sparse paged-attention helpers for MiniMax-M3 on ROCm.
-
swiglu_oai–Fused SwiGLU-OAI activation (split layout) for AMD ROCm via Triton.
Functions:
-
gemma_fused_add_rmsnorm_mxfp8–gemma_fused_add_rmsnormwith the normed output quantized to MXFP8. -
swiglu_oai_quantize_mxfp8–SwiGLU-OAI on split-layout
[M, 2I]fused with MXFP8 activation-quant. -
swiglu_oai_split–SwiGLU-OAI on a split-layout
[*, 2I]tensor ->[*, I].
gemma_fused_add_rmsnorm_mxfp8(x, residual, weight, eps)
¶
gemma_fused_add_rmsnorm with the normed output quantized to MXFP8.
Bit-identical to mxfp8_e4m3_quantize(gemma_fused_add_rmsnorm(...)[0]).
Returns:
-
Tensor–(x_q, x_scale, residual_out):x_qfloat8_e4m3fn[M, N]and -
Tensor–x_scaleuint8 E8M0[M, N // 32](row-major, not swizzled), with -
Tensor–the leading dims of
xflattened intoM;residual_outhas -
tuple[Tensor, Tensor, Tensor]–the shape of
x.
Source code in vllm/models/minimax_m3/amd/ops/gemma_rmsnorm.py
swiglu_oai_quantize_mxfp8(gate_up, alpha, beta, limit, block_m=64)
¶
SwiGLU-OAI on split-layout [M, 2I] fused with MXFP8 activation-quant.
Returns (act_q [M, I] float8_e4m3fn, act_scale [M, I//32] uint8 E8M0),
identical to mxfp8_e4m3_quantize(swiglu_oai_split(gate_up)) but in a
single Triton pass (no bf16 intermediate). Used between the two GEMMs of the
native MXFP8 MoE. Numerically equivalent to the unfused chain (bit-exact on
measured MoE shapes); marginally more accurate (fp32 act, no bf16 round-trip).
Source code in vllm/models/minimax_m3/amd/ops/swiglu_oai.py
swiglu_oai_split(gate_up, alpha, beta, limit, out_dtype=None)
¶
SwiGLU-OAI on a split-layout [*, 2I] tensor -> [*, I].