Skip to content

[HIP] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant - #6000

Merged
vgokhale merged 2 commits into
ROCm:mainfrom
mjkvaak-amd:rocm/ar-rms-mxfp4-gemma
Oct 19, 2026
Merged

vgokhale merged 2 commits into
ROCm:mainfrom
mjkvaak-amd:rocm/ar-rms-mxfp4-gemma

Conversation

@mjkvaak-amd

@mjkvaak-amd mjkvaak-amd commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The 1-stage and 2-stage fused all-reduce + RMSNorm + MXFP4 quant kernels have no Gemma mode, so Gemma-norm models (Qwen3.5/3.8, Gemma) cannot use the fused MXFP4 epilogue. They pay a separate activation-quant launch before every MXFP4 linear fed by an AR+RMSNorm. On Qwen3.8 TP8 that is 68 per_1x32_f4_quant_hip launches per decode step in front of the GDN in_proj_qkvz. With this change the fused kernel is one launch where the unfused path is two or three, and 1.2x to 1.6x faster on the shapes it covers (Test Result).

The vLLM consumer is vllm-project/vllm#59483 (draft until this merges and is released). Follows up #6472, which enabled gemma_norm for per-group FP8 and removed the per-token-FP8-only restriction for that type.

Not a duplicate: searched open and merged PRs for gemma_norm mxfp4, gemma allreduce rmsnorm quant and fused_allreduce_rmsnorm mxfp4. #6472 covers per-group FP8 only; #6369 is a FlyDSL QuickReduce kernel.

Technical Details

  • A GEMMA_NORM template parameter goes through ar_fusion_epilogue_mxfp4 and both MXFP4 kernels. ar_fusion_epilogue_rms_norm already supports it: the 1 is added after widening w to fp32.
  • gemma_norm is exposed on fused_allreduce_rmsnorm_mxfp4_quant and the Python dist wrappers (CustomAllreduce.fused_ar_rms_mxfp4_quant, CudaCommunicator, parallel_state, communication_op), and passed to the unfused fallback.
  • Every quant type now accepts gemma_norm, so the guard in CudaCommunicator.fused_allreduce_rmsnorm_quant is removed and the communication_op.py docstring is corrected.
  • op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py: every case, including the no-argument CI smoke at TP 2/4/8, runs with and without gemma_norm (the --gemma-norm flag does not exist). It adds the (8, 8192) 1-stage shape and a mean relative L1 assertion (< 0.05) on the dequantized output.
    • Fails if a Gemma kernel ignores the 1 + w scale. The elementwise checkAllclose only warns on that, so the L1 assertion is what fails the test. With gemma_norm forced to False before the kernel call, the gemma_norm=True cases give a relative L1 of 0.8636 at (8, 8192) against at most 0.0062 with the fix. The fallback shape (128, 7168) is unaffected, as it should be.

Where it does not help: shapes outside the 1-stage and 2-stage gates (for example (128, 7168) at TP8) run the unfused fallback, which is unchanged.

Test Plan

8× MI355X (gfx950). AITER b66e114ff (one commit on main 3a80ec0cb), JIT-built from the source tree in vllm/vllm-openai-rocm:nightly-77154ca6116ae34cbfe314beef1016bde9b63989.

# CI invocation, TP 2/4/8
python3 op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py

# TP8, both kernels forced, with the bf16 side output
python3 op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py -t 8 --emit-bf16 --stage both \
  -s 1,8192 4,8192 8,8192 16,8192 24,8192 32,8192 8,7168 16,4096

Kernel time (harness not part of this PR): TP8, bf16, each arm captured in a CUDA graph, 5 rounds of 200 replays with the arm order alternated, device kernel durations summed from the torch profiler, median over ranks.

  • fused: tensor_model_parallel_fused_allreduce_rmsnorm_quant(quant_type="mxfp4", gemma_norm=True).
  • unfused (the path before this PR): tensor_model_parallel_fused_allreduce_rmsnorm(gemma_norm=True) followed by dynamic_mxfp4_quant.

Test Result

Both commands pass: 18 rows for the CI invocation (TP 2/4/8, three dispatch paths, gemma_norm on and off) and 80 rows for the TP8 command (28 direct_1stage, 52 direct_2stage, half with gemma_norm). Maximum over rows:

CI invocation TP8 command
MXFP4 dequant error vs reference 0.0 0.0
Residual error 0.0 0.0
bf16 side-output error 0.0 0.0
Mean relative L1 of the dequantized output, gemma_norm=False 0.0062 0.0049
Mean relative L1 of the dequantized output, gemma_norm=True 0.0037 0.0039

Kernel time per call, fused against unfused, Gemma weights, TP8, µs, lower is better:

Shape Fused kernel Fused Launches Unfused Launches Unfused / fused
1x8192 1-stage 12.4 1 17.9 2 1.44x
4x8192 1-stage 12.1 1 17.1 2 1.41x
8x8192 1-stage 13.0 1 17.7 2 1.35x
16x8192 2-stage 12.6 1 19.3 3 1.53x
24x8192 2-stage 12.1 1 19.2 3 1.59x
32x8192 2-stage 11.9 1 17.8 3 1.50x
8x7168 2-stage 15.1 1 18.4 2 1.22x
16x4096 2-stage 12.0 1 17.7 2 1.48x

The spread across ranks is under 1.1 µs for the fused arm (worst rank 13.8 µs at 16x8192). The unfused arm at 16x8192 to 32x8192 takes three launches because the 2-stage AR+RMSNorm is a reduce-scatter plus a norm kernel.

End to end on Qwen3.8 TP8 with the vLLM consumer (earlier run, before this rebase; the kernel code is unchanged by it), the fused kernel replaces 68 AR+RMSNorm + quant pairs per decode step, and the median decode step drops from 11.03 ms to 10.81 ms (−2.0%). GSM8K is 0.9680, against 0.9658 for the control.

Submission Checklist

Co-authored-by: Cursor [email protected]

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6000 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@mjkvaak-amd
mjkvaak-amd marked this pull request as ready for review September 30, 2026 18:44
@mjkvaak-amd
mjkvaak-amd requested a review from a team September 30, 2026 18:44
@mjkvaak-amd mjkvaak-amd changed the title Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant [HIP] [Perf] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant Sep 30, 2026
@github-actions github-actions Bot changed the title [HIP] [Perf] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant [HIP] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant Sep 30, 2026
@github-actions github-actions Bot added the HIP label Sep 30, 2026
@zufayu
zufayu requested a review from junhaha666 October 1, 2026 00:34
@mjkvaak-amd
mjkvaak-amd force-pushed the rocm/ar-rms-mxfp4-gemma branch from 7a6ed94 to 23e3945 Compare October 9, 2026 07:38
@mjkvaak-amd

Copy link
Copy Markdown
Contributor Author

@junhaha666 : could you have a look at your convenient time?

@mjkvaak-amd

Copy link
Copy Markdown
Contributor Author

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

ROCm/aiter PR #6000 — [HIP] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant

Threads a default-off gemma_norm flag from the vLLM-facing dist API down to a GEMMA_NORM template parameter on the 1-stage and 2-stage fused all-reduce+RMSNorm+MXFP4-quant kernels, so Gemma-style (1 + w) norm weights can ride the fused epilogue instead of paying a separate quant launch after every AR+RMSNorm.

Review (advisory): ⚠️ NEEDS WORK
Validation (deterministic): NOT RUN — REVIEW_AUTO_VALIDATE=0 (auto-validation disabled in this environment) and this box has no torch environment to run the multigpu target by hand; the only correctness evidence is the author's local 8×MI355X TP8 run
Perf (advisory): NOT RUN — the triaged target exposes no benchmark entry point (no --scenario bench, no perftest/@benchmark harness) and no torch environment exists here to hand-run one; the PR's 13.9 µs vs 12.0+4.5 µs and −2.0% decode-step numbers are author-side runs

⚠️ [verified] The PR no longer applies to main (patch fails at aiter/dist/device_communicators/communicator_cuda.py:413 and csrc/include/custom_all_reduce.cuh:2206), and the conflict is semantic: main's #6472 (landed 2026-10-14) changed the same gemma gate in the opposite direction (gemma_norm and quant_type not in ("per_token", "per_group")) and threaded gemma_norm through the per-group path and the same wrapper files, so a rebase that keeps this PR's gemma_norm and quant_type == "per_group" gate would re-reject the gemma+per-group FP8 combination main just enabled and ship the then-false message "supports per-token FP8 and MXFP4 only". Author must rebase onto main and reconcile the gate to allow per-token, per-group and mxfp4 under gemma_norm (or drop the gate), then re-run the test sweep on the rebased tree.
⚠️ [verified] No CI configuration exercises the new path: the only test target is op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py, which CI runs only behind the ci:multi-gpu label this PR does not carry, and even with the label the smoke lane invokes it with no arguments so gemma_norm_values stays [False] — the gemma dimension and the new (8, 8192) 1-stage shape sit behind --gemma-norm/--full — leaving the author's single TP8/MI355X run as the only validation while TP2/TP4 and gfx942 are enabled but unexercised. Author must add the ci:multi-gpu label and make the CI lane pass --gemma-norm (or fold one gemma case into the smoke defaults) so the path is covered before merge.
⚠️ [verified] The PR body's consumer link is the unfilled placeholder "vllm-project/vllm#<VLLM_PR>", so the new public gemma_norm kwarg on aiter/dist/parallel_state.py and its sibling dist wrappers has no linked vLLM PR, and the end-to-end numbers that justify the change (68 launches removed per decode step, 11.03→10.81 ms, GSM8K 0.9680 vs 0.9658) trace to no runnable source. Author must replace the placeholder with the actual vLLM PR link before merge.
⚠️ [inferred] The kernels in csrc/include/custom_all_reduce.cuh changed but no base-vs-head timing exists anywhere — the perf stage did not run and the target has no benchmark entry point — so the 13.9 µs vs 12.0+4.5 µs comparison and the −2.0% decode-step figure are single-box author runs; is the launch-elimination gain actually realized on a locked GPU with base reversed out? Reviewer should ask for the benchmark log behind the 13.9 µs vs 12.0+4.5 µs numbers, or re-measure the sweep on both sides before merge.

@mjkvaak-amd mjkvaak-amd added the ci:multi-gpu Trigger multi-GPU op tests on PR label Oct 15, 2026
The 1-stage and 2-stage fused all-reduce + RMSNorm + MXFP4 kernels had no
Gemma mode, so CudaCommunicator.fused_allreduce_rmsnorm_quant rejected
gemma_norm for MXFP4. Gemma-norm models (Qwen3.5/3.8, Gemma) therefore could
not use the fused MXFP4 epilogue and paid a separate activation-quant launch
before every MXFP4 linear fed by an AR+RMSNorm.

Thread a GEMMA_NORM template parameter through ar_fusion_epilogue_mxfp4 and
both kernels (ar_fusion_epilogue_rms_norm already supports it: the 1 is added
after widening w to fp32), expose gemma_norm on
fused_allreduce_rmsnorm_mxfp4_quant and the Python dist wrappers, and pass it
to the unfused fallback. With every quant type now accepting gemma_norm, the
guard in fused_allreduce_rmsnorm_quant goes away.

The multi-GPU test runs every case with and without gemma_norm, so the CI
smoke covers it at TP2/4/8. It also gains an (8, 8192) 1-stage shape and a
mean relative L1 assertion on the dequantized output, which the elementwise
tolerance is too loose to provide.

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
@mjkvaak-amd
mjkvaak-amd force-pushed the rocm/ar-rms-mxfp4-gemma branch from 23e3945 to b66e114 Compare October 15, 2026 07:16
@zufayu
zufayu requested a review from TennyWang1223 October 15, 2026 07:34
@mjkvaak-amd

Copy link
Copy Markdown
Contributor Author

ROCm/aiter PR #6000 — [HIP] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant

Threads a default-off gemma_norm flag from the vLLM-facing dist API down to a GEMMA_NORM template parameter on the 1-stage and 2-stage fused all-reduce+RMSNorm+MXFP4-quant kernels, so Gemma-style (1 + w) norm weights can ride the fused epilogue instead of paying a separate quant launch after every AR+RMSNorm.

Review (advisory): ⚠️ NEEDS WORK Validation (deterministic): NOT RUN — REVIEW_AUTO_VALIDATE=0 (auto-validation disabled in this environment) and this box has no torch environment to run the multigpu target by hand; the only correctness evidence is the author's local 8×MI355X TP8 run Perf (advisory): NOT RUN — the triaged target exposes no benchmark entry point (no --scenario bench, no perftest/@benchmark harness) and no torch environment exists here to hand-run one; the PR's 13.9 µs vs 12.0+4.5 µs and −2.0% decode-step numbers are author-side runs

⚠️ [verified] The PR no longer applies to main (patch fails at aiter/dist/device_communicators/communicator_cuda.py:413 and csrc/include/custom_all_reduce.cuh:2206), and the conflict is semantic: main's #6472 (landed 2026-10-14) changed the same gemma gate in the opposite direction (gemma_norm and quant_type not in ("per_token", "per_group")) and threaded gemma_norm through the per-group path and the same wrapper files, so a rebase that keeps this PR's gemma_norm and quant_type == "per_group" gate would re-reject the gemma+per-group FP8 combination main just enabled and ship the then-false message "supports per-token FP8 and MXFP4 only". Author must rebase onto main and reconcile the gate to allow per-token, per-group and mxfp4 under gemma_norm (or drop the gate), then re-run the test sweep on the rebased tree. ⚠️ [verified] No CI configuration exercises the new path: the only test target is op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py, which CI runs only behind the ci:multi-gpu label this PR does not carry, and even with the label the smoke lane invokes it with no arguments so gemma_norm_values stays [False] — the gemma dimension and the new (8, 8192) 1-stage shape sit behind --gemma-norm/--full — leaving the author's single TP8/MI355X run as the only validation while TP2/TP4 and gfx942 are enabled but unexercised. Author must add the ci:multi-gpu label and make the CI lane pass --gemma-norm (or fold one gemma case into the smoke defaults) so the path is covered before merge. ⚠️ [verified] The PR body's consumer link is the unfilled placeholder "vllm-project/vllm#<VLLM_PR>", so the new public gemma_norm kwarg on aiter/dist/parallel_state.py and its sibling dist wrappers has no linked vLLM PR, and the end-to-end numbers that justify the change (68 launches removed per decode step, 11.03→10.81 ms, GSM8K 0.9680 vs 0.9658) trace to no runnable source. Author must replace the placeholder with the actual vLLM PR link before merge. ⚠️ [inferred] The kernels in csrc/include/custom_all_reduce.cuh changed but no base-vs-head timing exists anywhere — the perf stage did not run and the target has no benchmark entry point — so the 13.9 µs vs 12.0+4.5 µs comparison and the −2.0% decode-step figure are single-box author runs; is the launch-elimination gain actually realized on a locked GPU with base reversed out? Reviewer should ask for the benchmark log behind the 13.9 µs vs 12.0+4.5 µs numbers, or re-measure the sweep on both sides before merge.

All four points are addressed in b66e114ff, rebased onto main 3a80ec0cb (one commit).

  1. Rebase and gate. The gemma_norm guard in CudaCommunicator.fused_allreduce_rmsnorm_quant is removed, since per-token, per-group and MXFP4 all accept it now, and the communication_op.py docstring is corrected. Per-group Gemma from [HIP] [Dist] Support gemma_norm in fused all-reduce + RMSNorm + per-group FP8 quant #6472 is untouched.
  2. CI coverage. The ci:multi-gpu label is set. The --gemma-norm flag is gone: every case, including the no-argument CI smoke at TP 2/4/8, runs with and without gemma_norm. The (8, 8192) 1-stage shape is added, and a mean relative L1 assertion (< 0.05) fails if a kernel ignores the 1 + w scale. With gemma_norm forced off before the kernel call, the relative L1 is 0.8636 at (8, 8192) against at most 0.0062 with the fix, while the elementwise check only warns. On 8× MI355X the no-argument run passes (18 rows) and so does the Test Plan command (80 rows). gfx942 was not run.
  3. Consumer link. The placeholder is replaced with [ROCm][Perf] Fuse the MXFP4 activation quant into AITER AR+RMSNorm in the Qwen3.5 AMD model vllm-project/vllm#59483 (draft until this merges).
  4. Benchmark. Kernel time per call at TP8, bf16, Gemma weights, CUDA-graph replay, summed profiler kernel durations, median over ranks (lower is better). Unfused is the path before this PR: fused AR+RMSNorm with gemma_norm=True, then dynamic_mxfp4_quant.
Shape Fused kernel Fused µs Launches Unfused µs Launches Unfused / fused
1x8192 1-stage 12.4 1 17.9 2 1.44x
4x8192 1-stage 12.1 1 17.1 2 1.41x
8x8192 1-stage 13.0 1 17.7 2 1.35x
16x8192 2-stage 12.6 1 19.3 3 1.53x
24x8192 2-stage 12.1 1 19.2 3 1.59x
32x8192 2-stage 11.9 1 17.8 3 1.50x
8x7168 2-stage 15.1 1 18.4 2 1.22x
16x4096 2-stage 12.0 1 17.7 2 1.48x

@mjkvaak-amd

Copy link
Copy Markdown
Contributor Author

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

ROCm/aiter PR #6000 — [HIP] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant

Threads a default-off gemma_norm flag from the vLLM-facing dist API down to a GEMMA_NORM template parameter on the 1-stage and 2-stage fused all-reduce+RMSNorm+MXFP4-quant kernels, so Gemma-style (1 + w) norm weights can ride the fused epilogue instead of paying a separate quant launch after every AR+RMSNorm.

Review (advisory): ⚠️ NEEDS WORK
Validation (deterministic): NOT RUN — REVIEW_AUTO_VALIDATE=0 (auto-validation disabled in this environment) and this box has no torch environment to run the multigpu target by hand; the only correctness evidence is the author's local 8×MI355X runs (CI smoke 18 rows, TP8 sweep 80 rows) at head b66e114
Perf (advisory): NOT RUN — the triaged target op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py ships no benchmark entry point (no --scenario bench, no perftest/@benchmark harness) and no torch environment exists here to hand-run one; the PR's 1.22x–1.59x kernel-time and −2.0% decode-step numbers are author-side single-box runs

⚠️ [verified] No base-vs-head timing of the changed kernels exists and none is re-runnable from the repo: op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py exposes no timing mode (argparse offers only -d/-t/-s/--emit-bf16/--stage/--full), and the PR's 1.22x–1.59x table comes from a harness the PR itself says is "not part of this PR" — so a latency regression on a config nobody timed (gfx942, TP2/TP4, or a shape outside the eight) would ship invisible behind the launch-count win. Author must add the fused-vs-unfused timing sweep to the multigpu test or a bench script under op_tests/multigpu_tests/ (bench_* files already live there) so the numbers are re-runnable from the repo.
📝 [verified] The gemma+mxfp4 path is never exercised on gfx942: op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py runs only in the multi-GPU CI lane, whose matrix is MI350X-only (linux-aiter-do-mi350x-8), the 1-GPU standard lane (which does have MI300X runners) excludes multigpu_tests, and the author states "gfx942 was not run" — so the first gfx942 build and run of the doubled GEMMA_NORM instantiation set would be a user's. Reviewer should ask for one gfx942 smoke run, or confirmation that the module's gfx942 build covers the new instantiations, before merge.
📝 [verified] The end-to-end numbers that justify the change (68 launches removed per decode step, 11.03→10.81 ms, GSM8K 0.9680 vs 0.9658) are the PR's own "earlier run, before this rebase": the kernel code in csrc/include/custom_all_reduce.cuh is unchanged by it, but the rebase reconciled the Python wrapper layer against main's #6472, so the e2e evidence describes a tree one rebase away from head b66e114. Author must re-confirm the decode-step and GSM8K numbers on the rebased head before merge.
📝 [verified] The strided/padded fallback computes the Gemma offset outside fp32: aiter/dist/device_communicators/communicator_cuda.py:384 (pre-existing from #6472) builds weight_ + 1.0 in bf16 for fused_add_rmsnorm_pad, while every kernel path and rmsnorm2d_fwd_with_add add the 1 in fp32 — and this PR's fallback threading newly routes mxfp4+gemma callers with strided or padded inputs into it, so (1+w) picks up a bf16 rounding there (the offset is lost entirely for |w| < 2^-9) that the fused kernels do not have. Reviewer should ask whether the fallback should pre-widen the offset in fp32 so all gemma paths agree.

@mjkvaak-amd

Copy link
Copy Markdown
Contributor Author

ROCm/aiter PR #6000 — [HIP] Support Gemma (1 + w) weights in fused AR+RMSNorm+MXFP4 quant

Threads a default-off gemma_norm flag from the vLLM-facing dist API down to a GEMMA_NORM template parameter on the 1-stage and 2-stage fused all-reduce+RMSNorm+MXFP4-quant kernels, so Gemma-style (1 + w) norm weights can ride the fused epilogue instead of paying a separate quant launch after every AR+RMSNorm.

Review (advisory): ⚠️ NEEDS WORK Validation (deterministic): NOT RUN — REVIEW_AUTO_VALIDATE=0 (auto-validation disabled in this environment) and this box has no torch environment to run the multigpu target by hand; the only correctness evidence is the author's local 8×MI355X runs (CI smoke 18 rows, TP8 sweep 80 rows) at head b66e114 Perf (advisory): NOT RUN — the triaged target op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py ships no benchmark entry point (no --scenario bench, no perftest/@benchmark harness) and no torch environment exists here to hand-run one; the PR's 1.22x–1.59x kernel-time and −2.0% decode-step numbers are author-side single-box runs

⚠️ [verified] No base-vs-head timing of the changed kernels exists and none is re-runnable from the repo: op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py exposes no timing mode (argparse offers only -d/-t/-s/--emit-bf16/--stage/--full), and the PR's 1.22x–1.59x table comes from a harness the PR itself says is "not part of this PR" — so a latency regression on a config nobody timed (gfx942, TP2/TP4, or a shape outside the eight) would ship invisible behind the launch-count win. Author must add the fused-vs-unfused timing sweep to the multigpu test or a bench script under op_tests/multigpu_tests/ (bench_* files already live there) so the numbers are re-runnable from the repo. 📝 [verified] The gemma+mxfp4 path is never exercised on gfx942: op_tests/multigpu_tests/test_fused_ar_rms_mxfp4_quant.py runs only in the multi-GPU CI lane, whose matrix is MI350X-only (linux-aiter-do-mi350x-8), the 1-GPU standard lane (which does have MI300X runners) excludes multigpu_tests, and the author states "gfx942 was not run" — so the first gfx942 build and run of the doubled GEMMA_NORM instantiation set would be a user's. Reviewer should ask for one gfx942 smoke run, or confirmation that the module's gfx942 build covers the new instantiations, before merge. 📝 [verified] The end-to-end numbers that justify the change (68 launches removed per decode step, 11.03→10.81 ms, GSM8K 0.9680 vs 0.9658) are the PR's own "earlier run, before this rebase": the kernel code in csrc/include/custom_all_reduce.cuh is unchanged by it, but the rebase reconciled the Python wrapper layer against main's #6472, so the e2e evidence describes a tree one rebase away from head b66e114. Author must re-confirm the decode-step and GSM8K numbers on the rebased head before merge. 📝 [verified] The strided/padded fallback computes the Gemma offset outside fp32: aiter/dist/device_communicators/communicator_cuda.py:384 (pre-existing from #6472) builds weight_ + 1.0 in bf16 for fused_add_rmsnorm_pad, while every kernel path and rmsnorm2d_fwd_with_add add the 1 in fp32 — and this PR's fallback threading newly routes mxfp4+gemma callers with strided or padded inputs into it, so (1+w) picks up a bf16 rounding there (the offset is lost entirely for |w| < 2^-9) that the fused kernels do not have. Reviewer should ask whether the fallback should pre-widen the offset in fp32 so all gemma paths agree.

  1. Timing in the repo. I have not added a benchmark. Neither Add fused Allreduce + RMSNorm + MXFP4 quant #3229, which added these kernels, nor [HIP] [Dist] Support gemma_norm in fused all-reduce + RMSNorm + per-group FP8 quant #6472, the per-group Gemma counterpart of this PR, added one, and the repo has no fused AR+RMSNorm benchmark to extend (the bench_* files in op_tests/multigpu_tests/ are MegaMoE). FWIW, the test already prints per-rank min_us/max_us for every row, though as single-call event timing, not a benchmark.

  2. gfx942. Gemma+MXFP4 has no gfx942 consumer. The only caller, [ROCm][Perf] Fuse the MXFP4 activation quant into AITER AR+RMSNorm in the Qwen3.5 AMD model vllm-project/vllm#59483, registers the pattern only when rocm_aiter_ops.is_asm_fp4_gemm_dynamic_quant_enabled(), which requires on_gfx950(), because the MXFP4 GEMM it feeds is gfx950-only. The kernel itself encodes FP4 in software and has no arch guard. That has been true of the non-Gemma MXFP4 kernels on gfx942 since Add fused Allreduce + RMSNorm + MXFP4 quant #3229, so this PR adds no gate there either. With GPU_ARCHS=gfx942, the module builds and its code object contains all 24 MXFP4 kernels, the 12 Gemma ones included.

  3. End-to-end numbers vs the rebased head. The csrc/ diff is identical line for line across all three pushes (7a6ed940, 23e39456, b66e114f). In the Python diff, only the gate changed: the earlier tree rejected gemma_norm for per_group, and head drops the guard because [HIP] [Dist] Support gemma_norm in fused all-reduce + RMSNorm + per-group FP8 quant #6472 added per-group Gemma. The MXFP4 branch the e2e run exercised is the same code, so I have not re-run the decode-step and GSM8K numbers.

  4. bf16 weight_ + 1.0 in the strided/padded fallback. That line is from ace71b5fa (June), not [HIP] [Dist] Support gemma_norm in fused all-reduce + RMSNorm + per-group FP8 quant #6472, and this PR does not touch it. The MXFP4 fallback calls fused_allreduce_rmsnorm(gemma_norm=True) and then dynamic_mxfp4_quant, the same path a Gemma caller ran before this PR (the unfused arm in the table), so its numerics are unchanged. Widening the offset to fp32 would also change the per-token and per-group Gemma fallbacks, so, if needed, I'd rather do it in a separate PR.

@TennyWang1223 TennyWang1223 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vgokhale
vgokhale merged commit 4a7d566 into ROCm:main Oct 19, 2026
mjkvaak-amd added a commit to mjkvaak-amd/vllm-project that referenced this pull request Nov 18, 2026
ROCm/aiter#6000 added gemma_norm to fused_ar_rms_mxfp4_quant in v0.1.27
and vLLM pins v0.1.29, so register the patterns on the ASM FP4 GEMM check
alone. Pick the fused or unfused path with one condition.

Co-authored-by: Cursor <[email protected]>
Signed-off-by: Mikko Tukiainen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:multi-gpu Trigger multi-GPU op tests on PR HIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants