Repository navigation
[Triton/Gluon] moe_gemm_a8w8: fnuz FP8 and MXFP8 on gfx942 - #6219
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
9131e08 to
343e229
Compare
343e229 to
1e92200
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Configuration duplication, Python-side tuning, and uncovered fnuz dispatch variants should be addressed.
4 open findings
What changed in this PR
Adds gfx942 fnuz FP8/MXFP8 support to the Triton MoE A8W8 kernel.
Changes:
- Adds fnuz-aware dot and quantization scaling paths.
- Introduces gfx942 MXFP8 dispatch tuning.
- Adds gfx942 correctness and quantization tests.
| File | Description |
|---|---|
aiter/ops/triton/moe/moe_op_gemm_a8w8.py |
Adds fnuz dispatch and configuration selection. |
aiter/ops/triton/_triton_kernels/moe/moe_op_gemm_a8w8.py |
Implements fnuz FP8 dot paths. |
aiter/ops/triton/quant/quant.py |
Selects the fnuz quantization range. |
aiter/ops/triton/_triton_kernels/quant/quant.py |
Parameterizes MXFP8 scale derivation. |
aiter/ops/triton/configs/gfx942/triton/moe/a8w8/DEFAULT.json |
Adds gfx942 tuned configurations. |
op_tests/triton_tests/moe/test_moe_gemm_a8w8.py |
Adds gfx942 correctness coverage. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@lburzawa @nsusanto @Boss2002n the last push goes beyond just the test fix:
Per-GEMM speedup over the BLOCK_K=32 table (MI300X, 256 experts, top-8):
bm32 and bm64 entries gain 1.1-3.2x. Short-K prefill needs kernel work, which I'll do in a follow-up PR later Tested on MI300X: a8w8 160 passed, mxfp8 quant 104 passed |
|
Can you post performance comparison of the split-k approach on BLOCK_K=64 and BLOCK_K=128 as compared to existing approach which upcasts the operands to fp32 before the tl.dot? |
|
@lburzawa here is the comparison with the fp32 upcast on main. Setup: MI325X, MXFP8 activations and weights, 256 experts, top-8. Same wrapper, config and inputs on both sides. Only the kernel differs. Time is the full moe_gemm_a8w8 call.
The upcast runs fp32 MFMA and spills registers at BLOCK_K=128. This PR stays on FP8 MFMA with no spills. All 28 cases (µs)
|
|
Updates since the last review:
On the target models (MI325X), 13 of 32 keys change. They are 1.23x to 3.54x faster, geomean 2.19x. The other 19 stay within 1%, and outputs are identical before and after. The 13 keys that change (µs)
Tests on MI325X: 176 passed in test_moe_gemm_a8w8.py and 104 passed in test_quant_mxfp8.py. |
There was a problem hiding this comment.
🟡 Changes recommended
The fallback tile lookup fails for supported partial-K inputs, and the fnuz quantization range still lacks an independent regression check.
6 open issues
Prevent StopIteration for unpadded K values · New Move fallback tuning values into gfx942 JSON config · New Add independent fnuz quantization range coverage · New Reuse shared helper for fnuz dequantization · New Add tests covering block_m=32 configurations Update dtype limit documentation for fnuz exponent
2 resolved since last review
Review effort: Balanced
|
@akii96 Thanks for the comparison. I requested one more change and please review new copilot comments. Otherwise we should be good to go. |
Enable gfx942 FP8 and MXFP8 paths in moe_gemm_a8w8, add tuned gfx942 configurations, preserve split-K correctness, and quantize FNUZ payloads against their native range. Add gfx942 MoE coverage and integrate the representative FNUZ quant case into the existing MXFP8 parameterized test without increasing its workload. Signed-off-by: Aakif Nawaz <[email protected]>
d6d8cea to
b764e89
Compare
|
@Boss2002n @lburzawa The MI35X Shard 5 failures (8× test_batched_gemm_afp4_wfp4[*-2-256-3584-2112]) don't look related to this PR. This PR doesn't touch the batched FP4 GEMM It looks like the OOB e8m0 scale read on the ragged-K path that #7047 fixes I would like to land this soon now as this brings huge perf benefit on recently released Minimax-3,1 so happy to take more feedback on this PR and test hardening while we wait for the other PR to merge and then lets land this soon after! |
lburzawa
left a comment
There was a problem hiding this comment.
LGTM, thanks for taking into account all feedback.
* [Triton/Gluon] support fnuz FP8 and MXFP8 MoE on gfx942 Enable gfx942 FP8 and MXFP8 paths in moe_gemm_a8w8, add tuned gfx942 configurations, preserve split-K correctness, and quantize FNUZ payloads against their native range. Add gfx942 MoE coverage and integrate the representative FNUZ quant case into the existing MXFP8 parameterized test without increasing its workload. Signed-off-by: Aakif Nawaz <[email protected]> * [Triton] test native MXFP8 dtype on each arch Signed-off-by: Aakif Nawaz <[email protected]> --------- Signed-off-by: Aakif Nawaz <[email protected]>
Adds the AITER_MXFP8_A8W8 backend for ModelOpt MXFP8 MoE on MI300 and MI325 (gfx942), selected ahead of EMULATION or explicitly with --moe-backend aiter_a8w8. EMULATION dequantizes every expert weight to BF16 at load, roughly doubling MoE weight memory; with this backend the weights stay MXFP8 (Hy4-preview-FP8, TP8: 185.87 -> 99.27 GiB per rank), which is what lets Hy4-preview-FP8 TP8 fit on 192 GB MI300X. - At load, OCP e4m3fn weights are reinterpreted as fnuz in place (E8M0 exponent + 1, 0x80 -> 0), keeping one byte per element, and the E8M0 scales are stored N-contiguous so per-K-step scale loads coalesce (gate/up GEMM 10-19% faster). - Monolithic experts: router logits go through AITER's fused top-k and sort, then two moe_gemm_a8w8 calls with MXFP8 activations and vLLM's activation op in between. The path is CUDA-graph capturable. Requires ROCm/aiter#6219 (gfx942 fnuz support in moe_gemm_a8w8). Co-authored-by: Claude Signed-off-by: Aakif Nawaz <[email protected]>
Adds the AITER_MXFP8_A8W8 backend for MXFP8 MoE on MI300 and MI325 (gfx942), selected ahead of EMULATION or explicitly with --moe-backend aiter_mxfp8_a8w8. EMULATION dequantizes every expert weight to BF16 at load, roughly doubling MoE weight memory; with this backend the weights stay MXFP8 (Hy4-preview-FP8, TP8: 195.8 -> 109.1 GiB per rank), which is what lets Hy4-preview-FP8 TP8 fit on 192 GB MI300X. - gfx942 has no MX matrix cores, so moe_gemm_a8w8 runs each 32-wide K step as an FP8 MFMA and applies the E8M0 scales to the accumulator. - At load, e4m3fn weights are reinterpreted as e4m3fnuz in place (mxfp8_e4m3fn_to_e4m3fnuz: E8M0 exponent + 1, 0x80 -> 0, exponents that cannot be bumped become NaN), and the scales are stored N-contiguous so per-K-step scale loads coalesce. - Monolithic experts: router logits go through AITER's top-k and sort, then two moe_gemm_a8w8 calls with vLLM's activation in between. Supports Renormalize, RenormalizeNaive, MiniMax2 and DeepSeekV3 routing, routed-experts capture, and CUDA graphs. Rejects EP/DP, expert bias and fused shared experts. - Opt out with VLLM_ROCM_USE_AITER_MOE=0, like the other AITER MoE paths. - INCMxfp8MoEMethod gets apply_monolithic, since auto-selection can now return a monolithic kernel for it on gfx942. Needs ROCm/aiter#6219, which is in the pinned AITER v0.1.28.post1. Signed-off-by: Aakif Nawaz <[email protected]>
Adds the AITER_MXFP8_A8W8 backend for MXFP8 MoE on MI300 and MI325 (gfx942), selected ahead of EMULATION or explicitly with --moe-backend aiter_mxfp8_a8w8. EMULATION dequantizes every expert weight to BF16 at load, roughly doubling MoE weight memory; with this backend the weights stay MXFP8 (Hy4-preview-FP8, TP8: 195.8 -> 109.1 GiB per rank), which is what lets Hy4-preview-FP8 TP8 fit on 192 GB MI300X. - gfx942 has no MX matrix cores, so moe_gemm_a8w8 runs each 32-wide K step as an FP8 MFMA and applies the E8M0 scales to the accumulator. - At load, e4m3fn weights are reinterpreted as e4m3fnuz in place (mxfp8_e4m3fn_to_e4m3fnuz: E8M0 exponent + 1, 0x80 -> 0, exponents that cannot be bumped become NaN), and the scales are stored N-contiguous so per-K-step scale loads coalesce. - Monolithic experts: router logits go through AITER's top-k and sort, then two moe_gemm_a8w8 calls with vLLM's activation in between. Supports Renormalize, RenormalizeNaive, MiniMax2 and DeepSeekV3 routing, routed-experts capture, and CUDA graphs. Rejects EP/DP, expert bias and fused shared experts. - Opt out with VLLM_ROCM_USE_AITER_MOE=0, like the other AITER MoE paths. - INCMxfp8MoEMethod gets apply_monolithic, since auto-selection can now return a monolithic kernel for it on gfx942. Needs ROCm/aiter#6219, which is in the pinned AITER v0.1.28.post1. Signed-off-by: Aakif Nawaz <[email protected]>
* [Triton/Gluon] support fnuz FP8 and MXFP8 MoE on gfx942 Enable gfx942 FP8 and MXFP8 paths in moe_gemm_a8w8, add tuned gfx942 configurations, preserve split-K correctness, and quantize FNUZ payloads against their native range. Add gfx942 MoE coverage and integrate the representative FNUZ quant case into the existing MXFP8 parameterized test without increasing its workload. Signed-off-by: Aakif Nawaz <[email protected]> * [Triton] test native MXFP8 dtype on each arch Signed-off-by: Aakif Nawaz <[email protected]> --------- Signed-off-by: Aakif Nawaz <[email protected]>


Motivation
moe_gemm_a8w8 does not run on gfx942. The arch uses the fnuz FP8 encoding, which tl.dot_scaled rejects, so float8_e4m3fnuz inputs fail to compile. MXFP8 MoE models on MI300X therefore fall back to dequantizing expert weights to BF16 at load. For Hy4-preview-FP8 at TP8 that needs about 186 GiB per GPU and runs out of memory.
Replaces #5831. Per review, this extends moe_gemm_a8w8 instead of moe_gemm_mxfp8.py, which #6035 removes.
Changes
Test
test_op_gfx942 in the existing test_moe_gemm_a8w8.py, 5 cases: plain FP8, MXFP8 decode, MXFP8 w2, MXFP8 prefill, and one ragged MXFP8 shape that misses the tuned table. test_per_1x32_mxfp8_quant_fnuz in test_quant_mxfp8.py checks the fnuz quant range against the original bf16 input. It fails if the range goes back to 448. About 8 s on MI300X, skipped on other archs.
Results
Hy4-preview-FP8 TP8 through vLLM, Triton 3.8.0. These results are from d771de7, before the split-K fixes which should only make the numbers better
Memory
Performance
MI300X, dummy weights, 1024 in / 256 out:
Accuracy
GSM8K, MI325X, real weights, all 1,319 samples, 5-shot chat, temperature 0.9, top-p 1.0, seed 0, 32K output limit: