Repository navigation
Conversation
Add AiterMxfp8LinearKernel ahead of the Triton dot_scaled kernel on ROCm. It claims the (N, K) shapes AITER's gemm_a8w8_blockscale_bpreshuffle has tuned 1x32 E8M0 rows for (the MiniMax-M3 table), (16, 16)-preshuffles the weight once at load and keeps row-major E8M0 scales, so the activation quant is unchanged. Other shapes fall through to dot_scaled; set VLLM_DISABLED_KERNELS=AiterMxfp8LinearKernel to turn it off. The kernel steps aside under VLLM_ROCM_MINIMAX_M3_MONO=1: mono decode re-tiles the MXFP8 QKV, output and shared-expert weights from the row-major layout. Signed-off-by: Micah Williamson <micah.williamson@amd.com>
| # MiniMax-M3 mono decode re-tiles the MXFP8 QKV, output and separate | ||
| # shared-expert weights from the row-major layout; only the shared | ||
| # experts check for preshuffled weights. | ||
| if os.getenv("VLLM_ROCM_MINIMAX_M3_MONO", "0") in ("1", "true", "True"): |
There was a problem hiding this comment.
I know we shouldn't have os.getenv here, it's because MiniMax-M3.1 mono added its own envs file https://github.com/vllm-project/vllm/blob/main/vllm/models/minimax_m3/amd/mono/envs.py, I am going to make a separate PR to clean that up
…Kernel The kernel runs AITER's Triton gemm_afp8wfp8. Name it after the Triton path, so that the AITER FlyDSL MXFP8 kernel (vllm-project#65479) can use its own name. The custom op and its wrapper follow the existing triton_* names in _aiter_ops.py: - AiterMxfp8LinearKernel -> AiterTritonMxfp8LinearKernel - rocm_aiter_mxfp8_gemm_dynamic_quant -> rocm_aiter_triton_mxfp8_gemm_dynamic_quant - rocm_aiter_ops.mxfp8_gemm_dynamic_quant -> rocm_aiter_ops.triton_mxfp8_gemm_dynamic_quant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Andy Friedrich <afriedri@amd.com>
Fangzhou-Ai
left a comment
There was a problem hiding this comment.
why we need to wait for AITER PR 7411? From that PR seems that untuned aiter gemm is still faster than vllm tl.dot kernel.
|
Is this new gemm path guarded by |
Sorry that note was supposed to link the other AITER PR ROCm/aiter#6060, I fixed the description. The second PR ROCm/aiter#7411 is not strictly require for this one since the N=1280 layer will just fall back to Triton. |
Yep it's guarded under |
|
Thanks! LGTM, let's wait for aiter v0.1.28 |
|
Thanks for this, the per-GEMM numbers look good. One compatibility question with two open MiniMax-M3.1 PRs that feed this GEMM a pre-quantized activation: #65478 (fuses the MXFP8 quant into the post-attention norm and into swiglu) and #65508 (the NVFP4 sparse decode kernel emits the MXFP8 input for Both pass a
Could
The scale layout needs no change: the row-major E8M0 scales those fusions write are what |
PR Pundit review(Testing PR Pundit Code Review agent. Not all comments may be relevant. This is a one-time automated pass: please address what is useful, no need to request a re-review. Please reply to each point, whether it applies or not: we harvest these replies, and both kinds are enormously helpful for tuning the agent. Reach out to @peymanr for suggestions.)
1. 🟠 Should fix: Engine startup fails with 'Failed to find a kernel' when --linear-backend=aiter and shape untuned: this PR registers a shape-gated kernel under 'aiter'
Adding Who is affected: ROCm (gfx950) users serving MXFP8 models with Checked against the code by an independent pass. Related past reviews: #48735 on 2. 🟠 Should fix: Model load aborts with AITER exception instead of falling back: this PR's tuned probe catches only ImportError
Who is affected: ROCm gfx95x users with AITER linear enabled whose AITER install has a broken or overridden mxscale bpreshuffle tuned CSV, or a mismatched AITER version. Checked against the code by an independent pass. Related past reviews: #46184 on 3. 🟠 Should fix: Weight-cache daemon and IPC loader fail with UnsupportedQuantForIPCError on tuned shapes: this PR precedes RocmDotScaled without setting supports_pre_processed_weights=True
Who is affected: Users of ModelOpt MXFP8 checkpoints with Checked against the code by an independent pass. 4. 🟠 Should fix: New default-first ROCm MXFP8 kernel has no selection-gating or output-parity tests
The PR adds Who is affected: ROCm gfx950 users serving MXFP8 checkpoints (e.g. MiniMax-M3.1) whose (N, K) shapes AITER has tuned; a regression in this path would not be caught by CI. Checked against the code by an independent pass. Related past reviews: #15433 on Shared from a pilot of PR Pundit, an agentic code reviewer that builds and tests the change and reads the project's past reviews. Reviewed at |
NOTE: We should wait to merge this one after this AITER PR makes it into a release ROCm/aiter#6060
Overview
Adds
AiterMxfp8LinearKernel, an MXFP8 linear kernel for gfx950 that runs AITER's tuned FlyDSL GEMM (gemm_a8w8_blockscale_bpreshufflewith 1x32 E8M0 scales). It is placed ahead ofRocmDotScaledMxfp8LinearKernel(Tritontl.dot_scaled) in the ROCm MXFP8 kernel list. It only claims (N, K) shapes that AITER has tuned rows for; all other shapes fall through to Triton unchanged.AITER configs: ROCm/aiter#6060 and ROCm/aiter#7411.
Claims
dot_scaledkernel on the MiniMax-M3.1-Flash TP4 MXFP8 shapes at decode/verify sizes (M = 32-512). The rotating-weight micro-benchmark is below.Validation
Kernel selection. I logged the kernel chosen for every MXFP8 linear while loading MiniMax-M3.1-Flash-Quark-MXFP4 with TP4 and DSpark:
self_attn.qkv_projself_attn.o_projshared_experts.gate_up_projshared_experts.down_projmlp.gate_up_proj(main 3, draft 5)mlp.down_proj(main 3, draft 5)qkv_projo_projWith
VLLM_ROCM_MINIMAX_M3_MONO=1, every layer selectsRocmDotScaledMxfp8LinearKernel.Per-GEMM latency (µs), Triton
dot_scaled-> AITER FlyDSL.apply_weightspath, so the activation MXFP8 quantization is included.Decode profile. I compared torch-profiler traces of MiniMax-M3.1-Flash (DSpark3, conc 32, TP4) with and without this kernel. The traces also contain my other MiniMax-M3 ROCm changes, which don't touch the MXFP8 linears.
dot_scaledAccuracy. GSM8K 5-shot strict-match, measured with the full MiniMax-M3 ROCm branch (including this kernel) against main:
e2e results
Details
Opt-out: Set
VLLM_DISABLED_KERNELS=AiterMxfp8LinearKernel.