Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🟡 Changes recommended
The new tuning rows can select incompatible FlyDSL kernels that misinterpret interleaved weights or silently drop supplied biases, producing incorrect results instead of preserving the CK fallback.
2 open issues
What changed in this PR
Adds model-specific tuning data for MiniMax-M3 TP2 A16W4 decode on gfx950 GPUs with 256 compute units, selecting existing FlyDSL kernels through AITER’s configuration lookup.
Changes:
- Adds eight tuned stage-1/stage-2 kernel pairs for token buckets 1, 2, 4, 8, 16, 64, 128, and 256.
- Preserves the 38 existing tuned rows.
- Adds a matching 46-shape input list for tuning.
| File | Description |
|---|---|
aiter/configs/model_configs/minimax_m3_a16w4_untuned_fmoe.csv |
Adds the shape list matching the tuned table’s row order. |
aiter/configs/model_configs/minimax_m3_a16w4_tuned_fmoe.csv |
Adds eight gfx950 TP2 decode configurations using FlyDSL kernel pairs. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The new gfx950 kernel selections lack GPU correctness and latency evidence matching the repository’s pinned CK revision, while biased/interleaved fallbacks have only dispatch-level coverage.
2 open issues
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The gfx950 dispatch changes need human accuracy and latency validation because reported measurements use a different CK revision and exact-head GPU coverage, including biased/interleaved fallbacks, is unavailable.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The new gfx950 kernels and bias/interleave fallbacks lack head-matched GPU validation against the pinned CK revision, and acceptance of the reported numerical mismatches requires maintainer review.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human review is needed because the gfx950 kernel selections lack head-matched GPU validation, reported benchmarks use a different CK revision, and biased/interleaved fallbacks remain untested on GPU.
No open issues 🎉
Review effort: Balanced
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
There was a problem hiding this comment.
🔵 Needs a closer look
The gfx950 dispatch changes lack head-matched GPU validation on repository-pinned dependencies, while reported runs used different FlyDSL/CK revisions, showed strict-reference mismatches, and left performance and end-to-end model accuracy unconfirmed.
No open issues 🎉
Review effort: Balanced
|
@valar-cop review |
…prep A SiLU call with bf16 activations can match a Swiglu-keyed flydsl_moe1_abf16_wfp4_ row through the activation-disabled fallback, but the a16w4 operand preparation keeps A in bf16 only for SiTUv2 and the Swiglu shapes re-routed off CK-Tile (_is_a16w4_situv2 / _is_a16w4_swiglu_rerouted). Such a call takes the generic per_1x32 prep, which quantizes A to packed fp4x2 + e8m0 scales and hands them to the bf16 stage-1 wrapper -- a launch-boundary dtype/shape mismatch ([T, model_dim/2] fp4x2 against the expected [T, model_dim] bf16). get_2stage_cfgs gains a third a16w4 guard, next to the bias/interleave and block_size_M guards: a flydsl_moe1_abf16_wfp4_ row is discarded for any activation other than Swiglu and SiTUv2, and the call keeps the route it had without a row. Tests: the cross-activation layout cases now use SiTUv2 (prep-supported); the former plain-kept SiLU case asserted the broken selection and is replaced by silu-plain-discarded, which asserts the discard and the new warning. Full dispatch suite (inter_dim dispatch, moev2 dispatch, MoE snapshot) passes at this tree on gfx950: 101 passed. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Bishwo Adhikari <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The production gfx950 MoE dispatch changes need GPU-capable maintainer review because no exact-head accuracy and latency validation report was supplied, and this environment cannot independently run those checks.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The gfx950 kernel defaults need human GPU correctness and performance validation on the current head’s pinned CK/FlyDSL stack, because reported measurements used different dependencies and showed numerical mismatches.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The gfx950/MI355X kernel schedules and shared dispatch changes need human confirmation because exact-head GPU correctness, numerical-tolerance, and paired performance validation on the repository-pinned CK/FlyDSL stack is missing.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The gfx950 changes lack independent, exact-head GPU correctness and performance validation in the repository-pinned environment, and reported numerical mismatches require maintainer acceptance.
No open issues 🎉
Review effort: Balanced

Summary
Adds 8 tuned a16w4 FMOE rows for MiniMax-M3 TP2 decode on gfx950 (MI355X, 256 CUs). The rows go into
minimax_m3_a16w4_tuned_fmoe.csv. The new fileminimax_m3_a16w4_untuned_fmoe.csvholds the 46 shapes of that table. The PR also keeps calls with bias, interleaved gate/up weights or a differingblock_size_Moff the a16w4 FlyDSL rows, infused_moe.py.Motivation
The shape is
model_dim=6144, inter_dim=1536, expert=129, topk=5with bf16 activations and fp4 weights (per_1x32). It has no row on main, so it runs main's default 2-stage kernels. Each added row selects FlyDSL stage-1 and stage-2 kernels and was at least 3% faster than main in each of 3 paired repeats.Changes
minimax_m3_a16w4_untuned_fmoe.csvwith the 46 shapes of the tuned table (38 from main, 8 new), in the row order of the tuned file. The other MiniMax-M3 FMOE tables each have such a shape list; this one had none.get_2stage_cfgsinaiter/fused_moe.py. A call with per-expert bias or interleaved gate/up weights now ignores a tunedflydsl_moe1_abf16_row, for every activation, and keeps the route it had without a row. The a16w4 stage 1 launches withw_layout="standard"and no bias argument for every activation, and the row key holds neither property.get_2stage_cfgs. A call whoseblock_size_Mdiffers from the row'sblock_mnow ignores a tunedflydsl_moe1_abf16_wfp4_row and uses CK-Tile, for every activation.moe_sortingruns with the caller'sblock_size_M, and the row key does not hold it. The FlyDSL stage 1 takes its tile from the kernel name, and stage 2 raised a sorting-layout error.get_2stage_cfgsgains a trailing keywordblock_size_M=None._fused_moe_implandfused_moe_2stagespass theirblock_size_Mto the lookup.minimax_m3_a16w4_tuned_fmoe.csv: the 8 new rows and 34 rows of main. Silu and SiTUv2 rows are unchanged. a16w16 rows keep theirValueError.op_tests/test_moe_mxfp4_inter_dim_dispatch.py: 8 for the first check and 10 for theblock_size_Mcheck.Rows not included
minimax_m3_fp4_tuned_fmoe.csvwere tuned before the FlyDSL MoE changes of #7769 and #7773. At tokens 32 and 64 they raise the stage-2 error ratio from 1.2% to 4.8–4.9%Performance (if applicable)
Hardware is one MI355X (gfx950, 256 CUs) GPU, taken through
gpuqon a shared node. Before is main's current lookup for the same key: the default 2-stage kernels. After is this branch's table.Times are device time per call in µs from
gemm_moe_tune.py --run_config -i <shapes>: the mean of 3 paired repeats, 5 warm-up and 101 timed runs each.Tokens above 128 and below 256 are padded to 256 and use the token-256 row (
get_padded_M). The exact token 256 uses fp4 activations, which is a different key, so it is not part of this PR.Geometric mean over these points: 8% faster.
Tokens between the rows
These tokens are padded up to the next row. The slower token of the neighbour sample, token 9: 1.04x, is listed under PR Self-Review.
Testing
The row measurements ran on MI355X only. The dispatch tests run on CPU, without a GPU. The
block_size_Mcheck was also run on MI355X with a driver outside the repo.Documentation
The checks add no flag or public API.
get_2stage_cfgsgains one trailing keyword. The checks only change which route a biased, interleaved or differing-block_size_Mcall takes.Dependencies
Breaking Changes
None for calls without bias, with the separated gate layout and without a
block_size_Mthat differs from the row'sblock_m. Only gfx950 lookups with 256 CUs change, for these keys and for the tokens that pad up to them.A call with per-expert bias or interleaved gate/up weights that matches an a16w4 FlyDSL row now keeps the route it had without a row, regardless of activation. Before, it used the FlyDSL kernel, which ignores the bias and reads W1 in the standard layout.
A Swiglu call with an explicit
block_size_Mthat differs from the row'sblock_m(16 for all 42 rows) now uses CK-Tile. Before, it raised a FlyDSL stage-2 sorting-layout error. An override that CK-Tile has no kernel for, such as 128, now fails in the CK-Tile launcher.PR Self-Review
Reviewed revision
e298b5a3d14e296698ee27b17953891abc06db9bBehavior and intent
For MiniMax-M3 a16w4 decode at tokens 1, 2, 4, 8, 16, 64, 128, 256, the lookup now returns a FlyDSL stage-1 and stage-2 pair. Before, it returned main's default 2-stage kernels. Each row was at least 3% faster than main in each of 3 paired repeats. No row of main changes. For a Swiglu call with bias or interleaved weights, the lookup now ignores a tuned a16w4 FlyDSL row. Without that, the new rows would take such calls from CK-Tile, which supports both. A call whose
block_size_Mdiffers from the row'sblock_malso ignores the row, regardless of activation: cross-activation fallback matches on these rows are legitimate (the stage-1 wrapper compiles the caller's activation), so the layout check must cover every caller. Without that, FlyDSL stage 1 ran on a layout sorted for another tile size, and stage 2 raised an error. Direct calls offused_moe_2stagesfollow the same rule, because its own lookup now receives the size.Validation and unverified scope
gemm_moe_tune.py --run_config -i <shapes>on main and on this branch: 3 paired repeats on MI355X (gfx950, 256 CUs), with the order of the pair alternating. Every kept row used its own kernels (selection line checked) and finished with status OK.failed!in 36 of 36 samples of main's default kernels. It does so in 34 of 36 samples of the added rows. A sample is one of the 12 points in one of 3 repeats. Main's kernels mismatch 21.0–27.5% of the elements, the added rows 4.9–6.6%. The recorded stage-2 error ratio of the rows is 4.9–6.5%. The limit ofgemm_moe_tune.pyis 10%.test_config_shape_collision.py: 33 passed.test_csv_validation.py: 19 passed.test_a16w16_tuned_config_lookup.py: 14 passed, 9 failed; the same 9 gfx1250 cases fail with main's configs.test_opus_a16w16_policy_parity.py: 19 passed.test_arch_resolution.py: 25 passed.op_tests/tuning_testsdirectory with main's configs and with the four PRs merged. Both runs give 38 failed and 370 passed, with 54 skipped. The failing and erroring tests are the same in both.pytest op_tests/test_moe_mxfp4_inter_dim_dispatch.pyon CPU: 48 passed. Main's file has 25 cases. The 5 bias and interleave discard cases fail on the code without that check.block_size_Mcheck each fail at least one case. They remove the branch and use the wrong size source. They also widen the prefix, drop the override from the lookup, readNoneas an override, and drop the size from thefused_moe_2stageslookup. An earlier per-term run on the bias and interleave check did the same.get_2stage_cfgson CPU, with and without the check. The probe covers the 155 gfx950 rows of the MiniMax-M3, Kimi-K3 and Kimi-K2 FMOE tables that use an a16w4 FlyDSL stage-1 kernel. Each row's own key was called plain, with bias1, with bias2 and interleaved. Plain calls pick the same kernel in both.minimax_m3_a16w4_tuned_fmoe.csvmove from FlyDSL to CK-Tile for the three other calls. The 113 Silu and SiTUv2 rows do not change.op_tests/test_moe_2stage.py::test_fmoeon MI355X for the key of the added rows: E=129, topk=5, model_dim 6144, inter_dim 1536, Swiglu, bf16 activations, fp4 weights. Each case comparesfused_moewith the torch reference of the test on three trees: main, this branch, and this branch without the check infused_moe.py. The trees were built atfb0b937e3, the previous merge of main.fused_moe.py,moe_kernels.pyandtest_moe_2stage.pyare identical atce334d015.AITER_BF16_FP8_MOE_BOUND=0for this quantization type. A small driver therefore callstest_fmoedirectly with the variable unset, and records the stage-1 route of each call.logits_diffis 2.0e-5 against 7.8e-4. Token 128 shows the same split.logits_diffis 0.98. With the check it is CK-Tile at 6.9e-6, the same as main.test_swiglu_mxfp4_nonsplit_nobias_dispatchinop_tests/test_moe_2stage.pycalls this key with the interleaved layout at tokens 128 to 512 and expects CK-Tile. Without the check, the added token-128 row is selected and its assertion fails. With the check, and on main, its dispatch assertions pass. This ran on CPU withget_gfxset to gfx950, without the GPU half of the test.block_size_Mthroughtest_fmoeat token 8 for the key of the added rows. A small driver wraps thefused_moecall of the test to add the override. The trees are the parent head88d33e783, without and with the check, on the same base build. All rows are single runs.block_size_M=32raisedFlyDSL stage2 sorting layout mismatch: moe_sorting uses block_m=32, ... expects sort_block_m=16. With the check it runs on CK-Tile withlogits_diff2.1e-5, against 7.1e-6 for the FlyDSL row.Unsupported block_m value for moe_geem1 heuristic dispatch: 128.logits_diffvalues in later runs (7.1e-6, 7.1e-6, 2.1e-5, 2.1e-5 and the launcher error).fused_moe_2stagespasses itsblock_size_Mto its own lookup.fused_moestill replaces that result with the metadata it resolved, and passes the effective size.moe_sortingat the size and passes it asblock_size_M. On716c9e96c, size 32 selected the FlyDSL row and raisedFlyDSL stage2 sorting layout mismatch.logits_diff2.0e-5 and 2.1e-5. Size 16 keeps the FlyDSL row at 7e-6 on both heads.test_moe_shared_expert_m3_tuned_rowsis a direct call at size 16 with the shared expert. It passes before and after the change: 4 of 4.test_a16w16_rejects_mismatched_block_size_mpasses with and without the check.test_moe_a16w16_default_dispatch.pyhas the same 23 failing tests on both, because CK stage-2 modules did not build in the container.aiter/ops/flydsl/moe_kernels.py:2305-2332), and neither does the stage-1 call (:1745-1778), so the check covers both.block_size_Mcheck does not cover the 4 ASM 1-stage rows of the same file (tokens 1, 2, 4 and 8 at inter_dim 768). It leaves the Kimi-K3 SiTUv2 a16w4 rows unchanged. The Kimi a16wi4 rows were not examined. A direct call with shared-expert arguments and a differing size was not run.inter_dimnot a multiple of 256 andgate_up_interleave=Truestill reaches FlyDSL through the heuristic path, as a CPU probe shows. No tuned row is involved.get_trace_perfinaiter/test_common.py). It sums device kernel time and leaves out launch gaps. Rows that launch several kernels may gain less end to end.96afae1d). Main pinsf93c029e.lmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261117(digestsha256:09b8237296024285e6286ffb54d75c3af6d59342bbbb3558dea56bed86798814; torch 2.11.0+rocm10.0.0, hipBLASLt 1.4), FlyDSL 0.5.0. The row measurements used aiter code at593945921and the configs of main atc28a838be. Theblock_size_Mruns used the code of the parent head88d33e783, the squashed head716c9e96cand this head on a prebuilt main. This branch is now one commit on main8eed98cce.fused_moe.py,moe_kernels.pyandtest_moe_2stage.pyare identical between88d33e783and3038edafa, the head before the squash. No tuned row or lookup of this key changed on main.GPU check of the bias and interleave fallbacks
Route of stage 1,
logits_diffand share of outputs outside rtol and atol of 0.01, against the torch reference oftest_fmoe.GPU check of the block_size_M override
test_fmoeat token 8 for the key of the added rows, withblock_size_Madded to thefused_moecall.logits_diffis against the torch reference of the test. Time is device time per call. Rows are single runs.ValueError: FlyDSL stage2 sorting layout mismatchRuntimeError: Unsupported block_m value for moe_geem1 heuristic dispatch: 128The squashed head gave 7.1e-6 (110.9 µs), 7.1e-6 (111.8 µs), 2.1e-5 (126.7 µs), 2.1e-5 (159.1 µs) and the same launcher error.
Direct
fused_moe_2stagesat tokens 16 and 8: the driver sorts withmoe_sortingat the size and passes it asblock_size_M.logits_diffis against the torch reference oftest_fmoe.716c9e96c716c9e96cValueError: FlyDSL stage2 sorting layout mismatch, both tokensPR-specific question
Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
The key is (gfx950, 256 CUs, token, 6144, 1536, 129, 5, Swiglu, bf16, bf16, fp4x2, per_1x32, g1u1=1, doweight_stage1=0).
tokenis the runtime token count rounded up to a power of two. With the default separated gate mode,fused_moeuses bf16 activations for Swiglu belowGPTOSS_SWIGLU_MXFP4_BF16_BOUND(default 256). A row serves every token that rounds up to its token count, so runtime tokens below 256 reach this table. We sampled 20 runtime token counts. 5 of them now run the default, because their row was removed. Of the other 15, 8 were more than 3% faster than main and 6 were within 3%. 1 was more than 3% slower (worst 1.04x main's time). The slower one is token 9: 1.04x. The key holds the model dimensions, the expert count and both dtypes. Other models and the otherminimax_m3_*_fmoetables cannot match these rows. The checks infused_moe.pyact only on Swiglu calls with bias, interleaved weights or ablock_size_Mthat differs from the row'sblock_m. For the 155 gfx950 rows that use an a16w4 FlyDSL stage-1 kernel, plain calls pick the same kernel with and without the bias check. A call without an override keeps its row under theblock_size_Mcheck, as the dispatch tests show.Changed op tests
op_tests/test_moe_mxfp4_inter_dim_dispatch.pygains 18 dispatch test cases, 8 for the first check and 10 for theblock_size_Mcheck. Its existing tests cover the heuristic route, where no tuned row exists. None of them injects a tuned a16w4 FlyDSL row, so none sees a tuned row reach a call with bias or interleaved weights.The tests inject one such row. They expect the row to stay for plain calls and to be dropped for bias1, bias2 and the interleaved layout. They also expect a SiTUv2 row and an a4w4 row to stay. The 5 drop cases fail without the check.
The
block_size_Mcases keep the row for no override and for an override equal to the row'sblock_m. They drop it for an override of 32, with one warning that names the override. They drop it once when bias and an override meet. A SiTUv2 row and an a4w4 row stay for a differing override. A spy test checks that_fused_moe_implhands the override to the lookup. A direct-entry test callsfused_moe_2stagesat sizes 32 and 16 and checks the stages its lookup selects.🤖 Generated with Claude Code
Review updates at this revision
The bias/interleave check is no longer gated on Swiglu either (
aiter/ops/flydsl/moe_kernels.pylaunches the a16w4 stage 1 withw_layout="standard"and no bias argument for every activation).test_fallback_cross_activation_match_validates_layoutreplays the SiLU case through the loaded fallback map at the token-1 key: a plain call keeps the row, an interleaved call discards it. The discard test gains SiTUv2-bias and SiLU-interleave cases pinned to the default route each call had without a row. The dispatch snapshot stays identical to golden on all four arches at this revision.The
block_size_Mdiscard check applies to every activation; the earlierSwiglu-only gate is removed. A fallback purge offlydsl_moe1_rows was tried and reverted:tests/moe_dispatch/snapshot.py --checkshowed it moved 64 tuned gfx950 keys to default heuristics, since tuned rows carry tile parameters only and the stage-1 wrapper compiles the caller's activation. At this revision the snapshot is identical to golden on all four arches (gfx942, gfx942_cu80, gfx950, gfx1201).test_fallback_cross_activation_match_validates_block_sizereplays the reported scenario through the merged-config fallback map: a SiTUv2 call at the tuned Swiglu key (token 16, H 6144, I 1536, E 129, topk 5) keeps the row atblock_size_M=16and discards it at 32. The table loads through a test-localAITER_CONFIGSstub becauseget_config_fileis LRU-cached with the env var read inside the body, which made an env override order-dependent.MoeProblem.from_legacy_keyandlegacy_keymirror theblock_size_Mparameter throughextras, keeping the MoE v2 signature-parity assertion and the legacy-key round trip intact;test_problem_round_trips_through_the_legacy_keygains ablock_size_Mcase.tests/test_moev2_dispatch.py: 49 passed on CPU at this revision, and both CPU files together: 94 passed.