Repository navigation
[Fix] [AMD] moe: Keep is_shuffled on AITER-shuffled unquantized MoE weights - #48219
Merged
HaiShaw merged 1 commit intoNov 12, 2026
Merged
Conversation
…eights copy_or_rebind_param copies the shuffled weights into the existing Parameter, which drops the is_shuffled marker set by shuffle_weight. aiter.fused_moe uses the marker to select the preshuffled CK MoE kernels and to apply tuned fMoE configs. Restore it after each copy, as done for the compressed-tensors FP8 MoE path in sgl-project#47870.
wmlba
requested review from
Alisehen,
AniZpZ,
FlamingoPg,
HaiShaw,
OrangeRedeng and
b8zhong
as code owners
November 3, 2026 19:37
Contributor
|
Confirming from the CT-FP8 side (#47870) — same bug class, and your perf numbers I measured accuracy identical with and without the tag (cos 0.999 either way) and Your root cause is also a step subtler than ours — Both PRs are two/five lines and have the same nine reviewers; might be worth |
4 of 5 tasks
This was referenced Nov 7, 2026
3 of 5 tasks
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
On ROCm with the AITER MoE runner,
UnquantizedFusedMoEMethod.process_weights_after_loadingshufflesw13_weightandw2_weightwithaiter.ops.shuffle.shuffle_weight(..., (16, 16))and stores the result withcopy_or_rebind_param.shuffle_weightmarks the tensor it returns withis_shuffled = True, butcopy_or_rebind_paramdetaches it and copies the data into the existingParameter, so the parameter that reachesaiter.fused_moehas nois_shuffledattribute.aiter.fused_moereadsis_shuffledto choose between thepreshuffle_onandpreshuffle_offCK 2-stage MoE modules and to accept tuned fMoE configs (it warns that tuned kernels expect preshuffled weights). As a result, unquantized BF16 MoE models always run thepreshuffle_offpath on weights that were shuffled, and tuned configs for these shapes cannot be applied.This is the same issue that #47870 fixes for the compressed-tensors W8A8 FP8 MoE path, here in the unquantized path.
Modifications
Set
is_shuffled = Trueonlayer.w13_weightandlayer.w2_weightright after eachcopy_or_rebind_paramcall. Weight bytes, dtype and layout are unchanged; only the attribute thataiter.fused_moechecks is restored.Accuracy Tests
MI350X (gfx950, 256 CUs), AITER
2bb5491. One EP rank of a BF16 MoE layer: 512 experts (256 local viaexpert_mask), top-10, hidden 2560, expert intermediate 640, SiLU, fused gate/up, called throughaiter.fused_moeexactly asAiterRunnerCoredoes. Output compared with a float32 PyTorch reference:End to end (TP2 + EP2 replica, greedy, this change plus tuned fMoE rows for the shape), answers and token log-probabilities stayed within run-to-run variation (mean absolute log-prob delta vs a fixed reference: 0.0145 / 0.0146 before, 0.0151 / 0.0167 after).
Speed Tests and Profiling
Same layer,
aiter.fused_moeper call (CUDA events, microseconds):With the change the engine loads
module_moe_ck2stages_b16_b16_preshuffle_on_...instead ofmodule_moe_ck2stages_b16_b16_preshuffle_off_..., and tuned fMoE rows for the shape are picked up instead of the 2-stage default. End-to-end measurements were taken on SGLang34c4ba1with this change applied; the code path is unchanged onmain.Checklist
CI States
Latest PR Test (Base): ❌ Run #41703663575
Latest PR Test (Extra): ❌ Run #41703662756
Latest PR Test (AMD ROCm 10): ❌ Run #41703662869
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: