Repository navigation
[fmoe][gfx950]Flydsl mxmoe v2 - #4179
Merged
Merged
Conversation
… gemm2 port Vendored FlyDSL #753 mxmoe-v2 gemm1/gemm2 (mxmoe_gemm_v2.py + dispatcher) and optimized the dsv4 a8w4 (7168/512/E384/topk6) stage1 path: - fp8-A tiny-M: enabled k_wave>1 + BN=64 (removed 3 "not ported" guards); fixed fp8-out BN64 store guard + accm NJ sizing; root-caused the fp8 nt B-load miscompile on BN64 -> force cached (also faster). M1-4 now beat flydsl-main. - BN=128 (kw1): matches flydsl-main tile_n=128 (8 N-blocks); routed M in [512,2047]. - BM=16 stage1 for M<=1024: biggest win, occupancy-driven (168->104 VGPR, 3->4 waves). Closes most of the mid-M gap vs flydsl-main (M1024 now ~parity). - select_pipe_config routes dsv4 a8w4: M<=2 BN64/kw4, M4-8 BN64/kw2, BM16 for M<=1024, BN128 for [512,2047], else BN256/kw1. gemm2: additive use_strip lever as patches (off by default, byte-identical), g2port_{gemm_v2,dispatcher}.patch. v2-reduce competitive-to-faster than flydsl-main. bench_gemm1_v2_vs_baseline.py: per-M v2-vs-flydsl-main (mixed_moe) harness. NOTE: dsv4_fp8fp4_tuned_fmoe.csv reverted to pre-#3856 (flydsl_moe2 stage2, not opus) for flydsl-v2-vs-flydsl-main comparison; revert this file if opus stage2 wanted. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… a8w4 to atomic atomic_bf16_epilog's guard_padding was False on the BM32/SBM==BM/atomic path, falling back to a plain Python `if token_id < i32_M`. Since atomic_bf16_epilog is a helper (not @flyc.jit), that if on a dynamic value is not rewritten to a device scf.if, so it ran unconditionally -> every padding row (~97% of rows at mid-M in the 384-expert block-sparse floor) issued an OOB weighted atomic-fadd. Fix: guard_padding = True (always emit the device scf.if gate; reduce was already gated). rocprof M64: TCC_ATOMIC 7.29M->94.6K (77x), duration 932->107us (8.4x). Post-fix v2 atomic beats reduce-TOTAL (gemm2+topk-reduce) at every M (-6..-37%), so select_pipe_config routes dsv4 a8w4 (7168/512/E384/k6) BM32 buckets (M<=1024) reduce->atomic; BM64 (>=2048) kept reduce (BM64 atomic not re-validated post-fix). reduce path byte-identical; only the atomic-path IR changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
* Reduce v2 GEMM2 LDS usage with a BF16 cshuffle path. * perf(flydsl-moe): unlock straight-line K2 gemm2 via INTER_MAX override to cut a8w4 reduce VGPR 219->184 * perf(flydsl-moe): split gemm2 B by N-half in straight-line K2 path, halving peak B live set (VGPR 184->168)
…without relying on AITER_FMOE_V2.
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Feat/v2 tune merge
Bernard-Liu
force-pushed
the
feat/dsv4-a8w4-mxmoe-v2-gemm
branch
from
July 30, 2026 06:47
67d1433 to
b343ab4
Compare
Zzz9990
previously approved these changes
Jul 31, 2026
| s1_kernels = get_flydsl_stage1_kernels(adtype, "fp4", out_dtype_str) | ||
|
|
||
| for blockM in blockMs: | ||
| if blockM not in (32, 64, 128): |
| "tflops", | ||
| "bw", | ||
| "flat", | ||
| "v2", |
Contributor
There was a problem hiding this comment.
If v2 generally performs better than v1, I suggest the tuner just delete v1's task. It saves some tuning time and also reduces maintenance costs.
coderfeli
previously approved these changes
Aug 4, 2026
zhiding512
force-pushed
the
feat/dsv4-a8w4-mxmoe-v2-gemm
branch
from
August 4, 2026 03:11
a81b8f0 to
8c8ee0a
Compare
Collaborator
|
Merged. Ci passed but error commit and then cleared. |
1 task done
Jacob0226
added a commit
to Jacob0226/aiter
that referenced
this pull request
Aug 25, 2026
The previous commit shipped what `gemm_moe_tune.py --mxfp4-flydsl` picked when re-run today. That output keeps the a4w4 stage-1 but pairs it with a `flydsl_moe2_layout` stage-2, and on the same box that pairing is slower than the stage-2 the overwritten rows already named: 168.50 vs 151.76 us at token=32 (+11.0%, ranges disjoint over 15 repeats) and 232.75 vs 225.04 at token=128 (+3.4%). token=64 and 8192 are within noise. Trusting a fresh tune here would repeat the mistake this PR is about, so the five rows are now restored verbatim from db24351^ -- byte-identical to what rocm/sgl-dev:v0.5.17-rocm720-mi35x-20260820 shipped and what the serving A/B in the PR body ran.
1 task
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
Technical Details
Test Plan
AITER_MOE_EXPERT_BALANCE=true python3 op_tests/test_moe_2stage.py --no-flydsl-csv -d bf16 -dim 6144,512 -q 4 -a silu -s f -e 257 -k 9 -p t --kernel -t 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
AITER_FLYDSL_STAGE2_FP8=0 AITER_MOE_EXPERT_BALANCE=true python3 op_tests/test_moe_2stage.py --no-flydsl-csv -d bf16 -dim 6144,512 -q 4 -a silu -s f -e 257 -k 9 -p t --kernel -t 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
Test Result
Submission Checklist