Repository navigation
[FlyDSL] [fused_moe] Keep CK-capable clamped SiLU off the gfx942 FlyDSL default - #8353
jatseng-ai wants to merge 1 commit into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
|
The dispatch crash is fixed here. MI300X shard 5 then fails one step later, and that failure is not this routing change.
At 304 CUs, limit 7 uses the tuned gfx942 rows from #7361. #8397 emits both arch lists into that module and leaves the heuristic on |
ca91b9f to
f0e28ec
Compare
|
This branch is rebased onto current main and now has both commits:
Routing alone still dies on |
|
The MI300X run of this PR fails in The routing change itself works there: the case just before it (limit 1.0, default CK config) passes. I found this while testing #6277, which carries a cherry-pick of this PR. Cause. The CI wheel is built with Five rows in Check. Codegen only, no GPU:
This matches @zufayu's note in #8334: the instance exists in a locally JIT-built module but not in the prebuilt wheel. Possible fixes:
Without the exact-match requirement, the same gap falls back to the heuristic kernel silently. Other gfx942 tuned rows with 16-row tiles may therefore lose their tuned kernel in the multi-arch wheel too. I have not checked that. |
|
The MI300X job linked above built On an MI300X (gfx942, 304 CU) with This does not change the blockscale Retuning those gfx942 rows onto a shared tile, or dropping the exact-match check, would give up the tuned kernel. This branch keeps the row and ships the instance. |
|
Recording the decisions on this thread:
jhinpan’s shard-5 log is the routing-only SHA. Head |
|
gfx942 numerical sweep on this head, after the rebase.
Per-token L=7 at tokens 1 and 64 selected the tuned quant 2 = per_Token, 1 = per_Tensor: Unclamped per_Token at 64+ is the known ASM 1-stage (~27% outside 0.05); row error stayed under 0.05. gfx950 sweep is still open. |
|
gfx950 (MI355X, 256 CU) on this head Dual-arch compile (
Both orders on head compiled (~118s, Stock unclamped ( Lookup on this GPU: live Host-side Still open on this PR: |
|
Correction on scope: the remaining gfx950 30-case box is optional coverage for this module, not a gate for landing this PR or for a tag that includes #7361. The serving path this unblocks is MI300X (gfx942), already swept on this head. gfx950 is in this PR because CI wheels are |
|
Both sweep boxes in the test plan are now ticked. The gfx950 one was the last open item. gfx950 (MI355X, 256 CU), head
Kernel selection is what this run had to show. At every limit the lookup logged
Clamping holds at every limit. At L=1, quant 2 = per_Token, 1 = per_Tensor:
Per_Token no-limit at 64+ is the known ASM 1-stage, same character as the gfx942 run; row error stays under 0.037. The dual-arch Together with the gfx942 sweep above, both numerical boxes in the test plan are complete on this head. |
f0e28ec to
a298b9a
Compare
a298b9a to
43bb9ba
Compare
There was a problem hiding this comment.
this folder is for op test instead of unit test
There was a problem hiding this comment.
This file is the dispatch test for the gfx942 FlyDSL MoE backend added in #7820 — aiter/ops/flydsl/fused_moe_gfx942.py, kernels in aiter/ops/flydsl/kernels/moe_gemm_2stage/gfx9_fp8/, with AOT coverage for gfx942.
The PR touched it because its assertion encoded the bug. test_num_local_tokens_dispatch required the Qwen bypass (inter_dim 512) to take the FlyDSL whole-graph default — that is the route whose metadata has stage1=None, and dereferencing it is what crashed test_plain_fp8_swiglu_limit_dispatch on main. The change narrows the assertion: inter_dim 512 now stays on CK, while V4.1-Flash at 576, which CK cannot clamp, still takes FlyDSL. Checked both ways on a gfx942 box — it passes with the fix and fails against main's aiter/fused_moe.py.
On your other comment: you were right, and op_tests/test_moe_ck_codegen_arches.py was deleted. The codegen half shipped with no test of its own.
This landed in #8531 (this PR was closed as superseded). Main's MI300X shard 5 and MI35X shard 6 are green again as of run 45474327228.
If you meant something else — whether this file belongs in op_tests/ at all, or whether gfx942 should have a FlyDSL MoE path — say which and I'll follow up.
|
@jatseng-ai This PR is the only open fix for the
Evidence. Your two commits and #8485 passed all 8 MI300X shards in #8476 (run). I closed #8476 because it is a duplicate of this PR. |
87061c2 to
2483e46
Compare
On gfx942 a clamped per-token FP8 SiLU that CK can clamp (FP8, inter_dim a multiple of 128) is routed to the FlyDSL whole-graph default from ROCm#7820 / ROCm#8178. That backend's metadata has stage1=None, so test_plain_fp8_swiglu_limit_dispatch, which reads md.stage1.keywords, crashes with AttributeError: 'NoneType' object has no attribute 'keywords' -- MI300X shard 5 on main, most recently run 45246107786. The route is also the wrong one for these calls: the whole-graph backend clamps the BF16 activations it reads, a different quantization point from the per-token path the call and the tuned rows from ROCm#7361 ask for. (The accuracy claim in ROCm#8334 about that backend is retracted; it is accurate against its own reference, see ROCm#8350.) Keep the whole-graph default only where CK rejects the shape (inter_dim not a multiple of 128, including V4.1-Flash at 576). The new predicate is the same one the NotImplementedError gate below uses, which is what defines what CK's runtime-limit stage-1 accepts. A tuned impl__flydsl_gfx942__ row still wins. This does not revert ROCm#7361. Fixes ROCm#8334 Co-authored-by: Cursor <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2483e46 to
a90643b
Compare
|
Superseded by #8531, which now carries both commits. Splitting this into a routing PR and a codegen PR made each one unmergeable: neither half turns MI300X shard 5 green on its own. Measured on CI, one half at a time:
Every other MI300X and MI35X shard passed on both. #8531 now has both commits, so shard 5 is expected to go green there. @valarLip — your comment on |
…ship its gfx942 instances, and de-flake split-K graph replay (#8531) Three independent failures a CI run hits: - MI300X shard 5 crashed with AttributeError: 'NoneType' object has no attribute 'keywords'. A clamped per-token FP8 SiLU on gfx942 took the FlyDSL whole-graph default, whose metadata has stage1=None. Keep that default only where CK rejects the shape (inter_dim not a multiple of 128). - With routing fixed, a 304-CU limit-7 call selects the tuned gfx942 256x16...MulABScale row from #7361, which a GPU_ARCHS=gfx942;gfx950 wheel never built: Unknown or incompatible CK MoE kernel. Emit every built arch's CK MoE instance list into the lookup; heuristic dispatch still follows get_gfx(). - MI35X shard 6 flaked on test_flydsl_hgemm's bit-exact split-K graph replay. BF16 output with split_k > 1 accumulates via BufferAtomicPkAdd, so the result is atomic-order dependent (#8374). Accept one BF16 ULP there only, with a finiteness check and a guard that the replay did not reuse the captured input. Supersedes #8353 and #8351. Fixes #8334
Summary
On gfx942 a clamped per-token FP8 SiLU that CK can clamp is routed to the FlyDSL whole-graph default, whose metadata has
stage1=None. The dispatch test added by #7361 dereferences it and crashes. Route those calls back to CK.Motivation
test_plain_fp8_swiglu_limit_dispatchreadsmd.stage1.keywords. On main, a clamped per-token FP8 SiLU on gfx942 takes the FlyDSL whole-graph default from #7820 / #8178, whose metadata hasstage1=None, so the test fails withAttributeError: 'NoneType' object has no attribute 'keywords'. MI300X shard 5 is red on main for this reason — most recently run 45246107786 (2026-11-23), where the other seven shards passed.The route is also the wrong one for these calls. The whole-graph backend clamps the BF16 activations it reads; the call and the tuned rows from #7361 ask for the per-token path, where the clamp lands after quantization. That is a difference in quantization point, not an accuracy defect — the accuracy claim in #8334 is retracted, and #8350 fixes the test reference so cross-backend cases are compared on the backend's own terms.
Changes
inter_dimnot a multiple of 128, including V4.1-Flash at 576). CK's runtime-limit stage-1 takes the rest.NotImplementedErrorgate below already uses, which is what defines what that stage-1 accepts, so the two cannot drift.impl__flydsl_gfx942__row still wins. This does not revert [CK] [JIT] [aiter] Clamp FP8 per_Token / per_Tensor SiLU on #7019's runtime swiglu_limit #7361.Performance (if applicable)
Not applicable: dispatch only. The affected calls move to the CK runtime-limit stage-1 that #7361 tuned and measured.
Testing
See below for what was verified and on what hardware.
Documentation
Dispatch fix; the
swiglu_limitcontract is unchanged.Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
a90643b
Behavior and intent
A clamped per-token FP8 SiLU that CK can clamp stays on the CK runtime-limit stage-1 instead of the gfx942 FlyDSL whole-graph default. Calls CK cannot clamp (
inter_dimnot a multiple of 128) still take that default, and a tuned FlyDSL row still wins.Validation and unverified scope
Reproduced and fixed on an MI308X (gfx942, 80 CU), driving
get_2stage_cfgsdirectly at the dispatch test's shape(2048, 768, 128, 8):0d92e85)stage1=Nonewithfull_implset — the route the test dereferencesWith the fix, per_Token token=64 L=7 resolves to
stage1.func is ck_moe_stage1,run_1stagefalse,ksplit0.inter_dim=192still takes FlyDSL for per_Token (full_implset,stage1=None) and still raisesNotImplementedErrornamingswiglu_limitfor per_Tensor.swiglu_limitNone / 0.0 / inf leaverun_1stageunchanged.op_tests/test_flydsl_moe_gfx942.py::test_num_local_tokens_dispatchpasses on this branch and fails against main'saiter/fused_moe.py.validate-kernel-prwas run on this exact head (a90643b5684f, base0d92e854495d, targetop_tests/test_flydsl_moe_gfx942.py::test_num_local_tokens_dispatch, head and base on the same worktree and GPU with the patch reversed for the baseline). It reports no correctness finding. The verdict isINCONCLUSIVErather than a pass for three reasons, none of which is the diff: GPU activity counters are unavailable in this container so idleness was inferred from resident VRAM, no shape-grid hook is configured, and the test-policy analyzer itself raisedValueError: could not convert string to float: 'E'.Unverified here: the numerical sweep
test_plain_fp8_swiglu_limitand the rest oftest_moe_2stage— the gfx942 machine available to me has3rdparty/composable_kerneluninitialized, so the CK MoE modules do not build on it, and at 80 CU no row ina8w8_plain_tuned_swiglu_limit_fmoe_gfx942.csv(all keyedcu_num=304) is selected. The dispatch half above is CU-independent and is what the red shard crashes on.Depends on #8531: landing this first turns MI300X shard 5 from the
AttributeErrorintoUnknown or incompatible CK MoE kernel, because a 304-CU limit-7 call then selects a tuned gfx942 row that thegfx942;gfx950wheel never built.PR-specific question
What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?
op_tests/test_flydsl_moe_gfx942.py::test_num_local_tokens_dispatchfails on base: it asserted the Qwen bypass (inter_dim512) takes the FlyDSL whole-graph default, which is the routing this PR corrects. Verified both ways on an MI308X (gfx942): the test passes on this branch and fails against main'saiter/fused_moe.py.op_tests/test_moe_2stage.py::test_plain_fp8_swiglu_limit_dispatchfails on base by crashing: it dereferencesmd.stage1.keywordsfor a route whose metadata hasstage1=None. That is the red shard on main (run 45246107786).No canonical test covers this.
test_plain_fp8_swiglu_limitis the numerical check for the same shapes and asserts output values, not which backend ran, so it stays green whichever backend takes the call — which is exactly how the misroute survived from #7820 until the dispatch test was added by #7361.Changed op tests
op_tests/test_moe_2stage.pycovers the gfx942 per-tokeninter_dim192 case taking FlyDSL while per-tensor still raises. That split is what this change does, and no existing test asserted it.op_tests/test_flydsl_moe_gfx942.pycovers the bypass split: Qweninter_dim512 stays on CK, V4.1-Flashinter_dim576 stays on FlyDSL. The previous assertion required FlyDSL for the Qwen bypass, which is the bug.Both are edits to existing dispatch tests, not new files.