Skip to content

[Fix] [AMD] fp8-moe: Mark the AITER-shuffled per-tensor FP8 MoE weights is_shuffled - #51463

Merged
kevin-mii merged 1 commit into
mainfrom
bingxche/grok2-fp8-moe-is-shuffled
Nov 20, 2026
Merged

kevin-mii merged 1 commit into
mainfrom
bingxche/grok2-fp8-moe-is-shuffled

Conversation

@bingxche

@bingxche bingxche commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Since the AITER bump to 581579ab5 (#50759), Grok-2 fails to start on MI35x (gfx950) in the nightly nightly-8-gpu-mi35x-grok2 job, on both rocm10 and rocm724:

aiter/fused_moe.py:3948, in _require_shuffled_gfx950_fp8
RuntimeError: gfx950 fp8 CK MoE reads the shuffle_weight() layout on both w1 and w2; unshuffled per_Tensor and per_Token weights are unsupported

Examples: https://github.com/sgl-project/sglang/actions/runs/44397633600/job/135131701486 (rocm724), https://github.com/sgl-project/sglang/actions/runs/44343550026/job/134939730884 (rocm10). The same job passed on the previous pin (285579b62), e.g. https://github.com/sgl-project/sglang/actions/runs/43956322127/job/133611713684 (rocm724, 11-16).

ROCm/aiter#6736 added a gfx950 check that rejects per-tensor/per-token FP8 MoE weights unless both w1 and w2 carry is_shuffled=True. Fp8MoEMethod.process_weights_hip_scale_padding already shuffles both weights with shuffle_weight(..., (16, 16)), and shuffle_weight tags its output, but the result is rewrapped in a new torch.nn.Parameter, which drops the tag. So the layout is right but aiter sees untagged weights. #47870 and #48219 fixed the same gap on the CT FP8 and unquantized MoE paths.

Modifications

In the _use_aiter branch of process_weights_hip_scale_padding, set is_shuffled = True on w13_weight and w2_weight after the shuffle, the same way quark_w8a8_fp8_moe.py does for its per-tensor FP8 MoE weights. Both callers (FP8 checkpoint and online BF16->FP8 quant) go through this branch.

Side effect worth knowing: with the tag set, aiter no longer discards tuned Opus / post-reduce configs for these shapes (fused_moe.py:4339, :4401), so the kernel choice can change on MI300 too. Those configs expect the shuffled layout these weights already have.

Accuracy Tests

Not run yet. Plan: /rerun-test the Grok-2 accuracy tests on MI35x (test_grok2_eval_mi35x.py) and MI300 (nightly-8-gpu-grok2).

Checklist

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ⊘ Skipped -- add the run-ci label to run CI tests.
Latest PR Test (Extra): ⊘ Skipped -- add the run-ci label to run CI tests.
Latest PR Test (AMD ROCm 10): ⊘ Skipped -- add the run-ci label to run CI tests.

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@bingxche

Copy link
Copy Markdown
Collaborator Author

Grok-2 accuracy/perf jobs dispatched on this branch (/rerun-test rejects AMD nightly suites, so these are workflow_dispatch runs of nightly-test-amd.yml with continue_on_error=false):

Job ROCm Run
nightly-8-gpu-mi35x-grok2 (MI35x, gfx950, the failing job) rocm10 https://github.com/sgl-project/sglang/actions/runs/44474277319
nightly-8-gpu-mi35x-grok2 (MI35x, gfx950, the failing job) rocm724 https://github.com/sgl-project/sglang/actions/runs/44474284753
nightly-8-gpu-grok2 (MI300, gfx942: checks that the tag doesn't change accuracy where it already passed) rocm10 https://github.com/sgl-project/sglang/actions/runs/44474290814

I'll post the results when they finish.

@bingxche

Copy link
Copy Markdown
Collaborator Author

Grok-2 results on this branch (head 2d904900e1, image AITER 581579ab5), dispatched via nightly-test-amd.yml:

Job GPU ROCm GSM8K accuracy Threshold Result
nightly-8-gpu-grok2 MI300 (gfx942) rocm10 0.935 0.915 ✅ accuracy + perf pass
nightly-8-gpu-mi35x-grok2 MI35x (gfx950) rocm724 0.935 0.90 ✅ accuracy + perf pass
nightly-8-gpu-mi35x-grok2 MI35x (gfx950) rocm10 0.905 0.90 ✅ accuracy + perf pass

On main with this AITER pin, both MI35x jobs fail at server start with gfx950 fp8 CK MoE reads the shuffle_weight() layout .... That error is gone in all runs above.

For reference, pre-bump scores (AITER 285579b62, 200 questions) were 0.920-0.940 on MI300 and 0.920-0.935 on MI35x. The MI35x rocm10 run (0.905) is at the low end of that range; with 200 questions one standard error is about 0.02, so this looks like run-to-run noise rather than a regression. With the tag set, AITER now uses tuned Opus/post-reduce configs it previously discarded, so the kernel choice may differ from main.

@kangwangamd

Copy link
Copy Markdown
Contributor

thx you so much BingXu this is the right fix

@kevin-mii
kevin-mii merged commit f694123 into main Nov 20, 2026
266 of 267 checks passed
@kevin-mii
kevin-mii deleted the bingxche/grok2-fp8-moe-is-shuffled branch November 20, 2026 08:08
kevin-mii pushed a commit that referenced this pull request Nov 20, 2026
…fled per-tensor FP8 MoE weights is_shuffled to release/v1.0.0 (#51463) (#51767)

Co-authored-by: Bingxu Chen <[email protected]>
Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants