Repository navigation
[Triton/Gluon] Take the MOE scale layout from shuffle_scale_moe - #5094
Conversation
Per the shuffling rules, callers should not hardcode SWIZZLE_MX_SCALE labels next to a shuffle_scale_moe call -- `return_layout=True` returns the label the helper actually applied, so the caller stays arch-agnostic. Four MOE tests picked the label themselves from an arch branch. test_moe_gemm_a16w4.py loses the branch entirely: both arms called shuffle_scale_moe with the same parameters, and the path is already gated by arch_info.is_mx_scale_preshuffling_avail(), so the helper's own get_arch() resolves to what the branch was selecting. The other three keep their explicit arch="gfx950" so behaviour is preserved unconditionally, not just under the skip guards. Left alone on purpose: the gfx1250 arms of a8w4 and a4w4 do not call shuffle_scale_moe at all -- they use preshuffle_moe_wscale, which dispatches to the kwidth-4 n32k4 layout. Routing that through utils/shuffle.py is a separate decision.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
There was a problem hiding this comment.
Pull request overview
This PR updates MoE GEMM Triton/Gluon test cases to stop hardcoding SWIZZLE_MX_SCALE strings and instead retrieve the layout label directly from shuffle_scale_moe(..., return_layout=True), aligning scale-layout selection with the centralized shuffle utility.
Changes:
- Update multiple MoE GEMM tests to unpack
(shuffled_scale, swizzle_layout)fromshuffle_scale_moe(..., return_layout=True). - Simplify
a16w4test swizzle handling by removing explicit arch branching in favor ofshuffle_scale_moe’s arch-aware behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| op_tests/triton_tests/moe/test_moe_gemm_a8w8.py | Uses shuffle_scale_moe(..., return_layout=True) to derive swizzle_mx_scale in the swizzled MX path. |
| op_tests/triton_tests/moe/test_moe_gemm_a8w4.py | Switches gfx950 path to derive layout from shuffle_scale_moe; gfx1250 branch still hardcodes label. |
| op_tests/triton_tests/moe/test_moe_gemm_a4w4.py | Switches gfx950 path to derive layout from shuffle_scale_moe; gfx1250 branch still hardcodes label. |
| op_tests/triton_tests/moe/test_moe_gemm_a16w4.py | Replaces arch-specific label selection with shuffle_scale_moe(..., return_layout=True). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
brunomazzottiamd
left a comment
There was a problem hiding this comment.
I'm assuming that CI will caught any errors on this PR - if CI is green then we can merge.
No description provided.