Repository navigation
Conversation
…ath (TP8EP8)
Kimi-K3 served as TP8 attention with the MoE expert-parallel over the same 8
GPUs (ATOM --enable-expert-parallel, DP 1) calls fused_moe with an expert
mask: 112 local experts of 896, inter_dim 3072, SiTUv2, A4W4 MXFP4 per_1x32,
GUGU weights. The grouped lookup keys that call as expert=112, topk=-1,
ep_fused=0, so it shares the kimik3 rows with the MegaMoE stage-2 scatter
(ep_fused=1); token buckets 1, 2 and 4 had no row at all.
Add 14 rows with ep_fused=0 for token buckets 1..8192. Rows that name
ep_fused win the lookup for that path only, so the MegaMoE path keeps the
existing rows. Buckets 16384 and 32768 keep the existing rows: no swept tile
beat them beyond run-to-run noise.
Swept with the production call (fused_moe with expert_mask, SiTUv2 beta 4 /
linear 25, GateMode.INTERLEAVE, moe_shuffle_weight / moe_shuffle_scale,
random top-16 routing over 896 experts); every candidate's output is
bit-identical to the existing row's. MoE kernel time per call (sum of the
device kernels of one fused_moe, median of 7 interleaved rounds, one GPU):
token existing us -> new us
1 29.1 -> 24.5 (1.19x, existing: no row)
2 28.2 -> 23.1 (1.22x, existing: no row)
4 35.0 -> 24.2 (1.45x, existing: no row)
8 36.1 -> 30.3 (1.19x)
16 55.4 -> 47.0 (1.18x)
32 74.6 -> 65.1 (1.15x)
64 98.4 -> 90.1 (1.09x)
128 132.4 -> 122.3 (1.08x)
256 142.1 -> 131.0 (1.08x)
512 146.4 -> 140.7 (1.04x)
1024 157.3 -> 147.3 (1.07x)
2048 175.3 -> 170.0 (1.03x)
4096 242.0 -> 235.7 (1.03x)
8192 387.8 -> 353.0 (1.10x)
Measured on MI455X (gfx1250, 256 CU) in rocm/fw-bringup:gfx1250-atom-k3-20261116
(aiter 69d86f590, FlyDSL 0.5.0).
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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 |
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (2)
- Identify the tree the rows were timed on, or re-time the low-margin buckets on this PR's base. The PR body says the rows were measured on "aiter 69d86f590". That commit is not in ROCm/aiter (
gh api repos/ROCm/aiter/commits/69d86f590returns 422), and no fork carries it. Between the FlyDSL 0.5.0 pin (11-10) and this base (d83d011), the grouped TDM kernel, dispatcher and lookup changed several times: #7726 (771 lines ofmxfp4_preshuffle_gfx1250_tdm.py), #5899, #7960 and #7655. These rows become the default tiles for Kimi-K3 TP8EP8 (non-MegaMoEfused_moewith an expert mask). Several gains are inside the run-to-run noise that the body itself uses to keep 16384/32768: 512 is 1.04x, 2048 and 4096 are 1.03x, and 64–1024 are 1.07–1.09x. Please do one of the following:- Name a public SHA, and show that
git diff <it> d83d011 -- aiter/ops/flydsl/{grouped_moe_gfx1250,grouped_gemm_mxfp4,moe_kernels}.py aiter/ops/flydsl/kernels/mxfp4_preshuffle_gfx1250_tdm.py aiter/fused_moe.pyis empty. - Re-time buckets 64–8192 on d83d011 or later, reporting per-round min/max.
- Drop the rows that do not clear noise (for example 512, 2048 and 4096); those buckets then fall back to today's rows.
- Name a public SHA, and show that
- Correct the scope statement in the description. The body says the keys are consumed only "outside MegaMoE" and that "the MegaMoE path keeps the existing rows". That holds only for the fused-scatter combine. MegaMoE with the mori combine (
stage2_fused=False/ ATOMATOM_MEGA_STAGE2_FUSED=0) callsfused_moewithexpert_maskandstage2_scatter=None; seemega_moe.py:532-555andstages/combine_mori.py:155. That makesep_fused=Falseatgrouped_moe_gfx1250.py:1891, so those calls also pick the new rows for buckets 1–8192, and that path was not timed. Say so, or time it.
Checked and clean:
- No duplicate shapes. No duplicate merge key across the
tuned_grouped_fmoefamily (589 rows before, 603 after), including every open PR that touches it (8262, 8256, 8203, 8189, 8161, 8092, 8072, 8054, 8002, 7921, 7744). - Lookups.
ep_fused=1(fused-scatter MegaMoE) selects the same row as before in every bucket.- TP8 (topk 16) and the 56-expert rows are unchanged.
_widest_grouped_tilestays at 128.
- Launcher rules. All 14 rows pass the launcher's rules for GEMM1 (N 6144, K 3584) and GEMM2 (N 3584, K 3072), including token 1 (
split_k2=2+persistent_workers=256) and token 2 (tdm_as_in_prologue=1). - Description table. It matches the CSV cell for cell.
- Pre-existing, not required here:
- The
op_tests/test_moe_ep.pyEP CSV sweep ignoresep_fused, so the blank 112-expert rows for 8–8192 no longer get a single-GPU run. - Bucket 65536 has no 112-expert row.
- The
Reviewed at 9a2194a (deep tier, CSV-only; 1 hunter + review-pr agents, 2 verifiers, plus an independent pass B with its own hunter and 2 verifiers). Already fixed: n/a (first review).
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (8)
-
Apply the
SHARED_FIRSTrotation in the per-XCC queue, or keep XQ off where it applies.s1f_stage1.py:1695-1700(XQq_code) and the static first item at:1932never addm_sh; only the global branch does (:1709-1712). XQ is on by default for everytile_m <= 64(s1f_ctl.py:74-81), andS1F_SHARED_FIRST=1is the default (compact_plan.py:55), so the shared expert's m-tiles are no longer run first;compact_plan.py:50-54documents that ordering as worth 121.4 -> 116.3 us on DSV4.1 EP4. The kernel name still says_sf1(:839). Fix:m = xq + j*8 + m_sh; if m >= m_tiles: m -= m_tilesunderconst_expr(SHARED_FIRST)(CPU-checked: every (m, n) runs once, each m-tile stays on one XCC). -
Do not change the default S1F kernel of shapes that already fuse on main without timing them. At head, every compact fp4 S1F step with npes <= 4 gets XQ (all
align_m <= 64buckets) and the CSVtdm_b_th(was always 0): DSV4.1 Flash EP2/EP4 buckets 1-2048 (e96 th=1 from 32, e97 th=1 from 256, e192 XQ only), plus dsr1 e64/e65, the 7168/3072 e96 and gpt-oss e128 rows. The description says DSV4.1 was not re-timed and your own K3 table shows XQ costing 2-4% at tpr 1-2. Either post DSV4.1 EP2/EP4 before/after numbers (AITER_MEGA_S1F_XCC_QUEUE=0vsauto), or scopeautoXQ and the embeddedtdm_b_thto the shape you tuned ((8, 16)). -
Remove the per-forward host cost the PR adds.
_step_for(every eager compact step per layer,mega_moe.py:374, also with S1F off and on the bf16 wire) now does a second_find_grouped_configlookup via_compact_g1_tdm_b_th(dispatch_compact.py:103-108,720), and_launcherre-reads and validatesAITER_MEGA_S1F_XCC_QUEUEon every hook call (s1f_ctl.py:74-81,496). In-process A/B vs d83d011 (concurrent on one pinned core, 6-12 pairs, base/base and head/head controls):_step_for+3.2 us, launcher cache hit +2.3 us, gemm1 hook +3.0 us, all outside the control spread. Fix: returntdm_b_thfrom the single row lookup in_compact_gemm_tiles, and read the XQ mode once inarm()/__init__. -
Identify the trees the rows were tuned on (still open from the last review). The body and commit 1 still cite "aiter 69d86f590", and commit 2 cites "af50d0dd"; both return 422 on ROCm/aiter. Name public SHAs with an empty diff to d83d011 on the grouped/S1F files, or re-time on d83d011 or later.
-
Correct the description and commit messages. Still false at head: "the MegaMoE path keeps the existing rows" / "outside MegaMoE" (MegaMoE + MORI combine passes
stage2_scatter=None->ep_fused=False,combine_mori.py:155,mega_moe.py:553,grouped_moe_gfx1250.py:1891); "every bucket with ep_fused=1 returns the same row as before" (3 places; 11 ep_fused=1 buckets changed); "No code or kernel changes" and "Changed op tests: None ... only a tuned config CSV"; "only DSV4.1 Flash at EP2/EP4 runs stage-1 fused on main" (any npes <= 4 compact fp4 Silu/Swiglu config does, see 2). -
Keep EP8 top-16 steps that S1F refuses on the precompiled S1F=0 plan. With
(8, 16): 1 << 30(s1f_ctl.py:102), a K3 EP8 step whoseep_fused=1row has tile_m 128 (bucket 4096 blank row, ~257-512 tokens/rank; bucket 131072) is refused bytile_reasons(tile_m > 64 with npes > 4) butstep_off()is now False, so_plan_for/_plan_waves_for(dispatch_compact.py:786,828-842) build the per-width 16-wave fused-path plan that_precompile_s1f_plans(:761) never compiles: JIT per new prefill width while serving, and:850raises under graph capture. Base kept these steps onstep_off(and EP8 S1F could not build at all). Fix:fused = enabled and not step_off() and plan_mode(align_m)in_plan_for, same in_plan_waves_for(same key/kernelstep_offsteps already use; matches:947ands1f_ctl.py:420-421). Capping (8, 16) alone does not cover bucket 4096. This also makes "stage-1 fused at every receive width" in the description untrue.
Nits (asked in this PR):
7. Update the comments the PR made stale: s1f_stage1.py:64,119 ("(reserved)" per-XCC heads), :29-30/:570 (GEMM1 order), :35-37 ("one b128 per flag tile"), steal() docstring :1763-1769; s1f_ctl.py:226 (launch keys are 3-tuples now), :67-70 (XQ justified by "decode buckets", but auto covers up to 2048-token buckets); dispatch_compact.py:120-121.
8. Add a gfx1250-gated S1F-vs-unfused correctness test for npes 8 + Situv2 with beta != 1, XQ 0 and 1 (op_tests/multigpu_tests/test_mega_moe_gfx1250.py is the natural home). Nothing covers the new 8-wide flag_load, Situv2 betas, XQ, tdm_b_th or the (8,16) cap, and no CI lane runs this code. While there, pass the S1F tdm_b_th through _select_tdm_b_th on both the hook and _compact_g1_tdm_b_th sides so AITER_TDM_B_TH applies to fused and unfused GEMM1 alike, and apply the unfused path's situ_beta/situ_linear_beta > 0 check (grouped_gemm_mxfp4.py:184-188) to the S1F hook through one shared helper.
Checked and clean: no duplicate CSV keys (614 rows, incl. open PRs touching the family); the 8-wide flag load stays inside the 256 B slot and all consumers handle 8 sources; XQ claims cover every item exactly once (m_tiles 0..200); Situv2 beta args are in the same order on every launcher path and match the unfused epilogue; g1_name carries _bth, so variants don't collide; _widest_grouped_tile and arena sizing are unchanged.
Reviewed at 12bb1b3 (deep tier; 4 hunters incl. review-pr forensics, 2 independent verifiers with CPU probes and host A/B, 1 miss pass + re-verification). Already fixed: none of the r47 asks.
12bb1b3 to
9a2194a
Compare
|
I split this PR: it is now CSV-only, with one commit (9a2194a) adding the 14
|
…ath (TP8EP8) (#8259 @ 9a2194a, head 2026-11-19T05:04:37Z) Kimi-K3 served as TP8 attention with the MoE expert-parallel over the same 8 GPUs (ATOM --enable-expert-parallel, DP 1) calls fused_moe with an expert mask: 112 local experts of 896, inter_dim 3072, SiTUv2, A4W4 MXFP4 per_1x32, GUGU weights. The grouped lookup keys that call as expert=112, topk=-1, ep_fused=0, so it shares the kimik3 rows with the MegaMoE stage-2 scatter (ep_fused=1); token buckets 1, 2 and 4 had no row at all. Add 14 rows with ep_fused=0 for token buckets 1..8192. Rows that name ep_fused win the lookup for that path only, so the MegaMoE path keeps the existing rows. Buckets 16384 and 32768 keep the existing rows: no swept tile beat them beyond run-to-run noise. Swept with the production call (fused_moe with expert_mask, SiTUv2 beta 4 / linear 25, GateMode.INTERLEAVE, moe_shuffle_weight / moe_shuffle_scale, random top-16 routing over 896 experts); every candidate's output is bit-identical to the existing row's. MoE kernel time per call (sum of the device kernels of one fused_moe, median of 7 interleaved rounds, one GPU): token existing us -> new us 1 29.1 -> 24.5 (1.19x, existing: no row) 2 28.2 -> 23.1 (1.22x, existing: no row) 4 35.0 -> 24.2 (1.45x, existing: no row) 8 36.1 -> 30.3 (1.19x) 16 55.4 -> 47.0 (1.18x) 32 74.6 -> 65.1 (1.15x) 64 98.4 -> 90.1 (1.09x) 128 132.4 -> 122.3 (1.08x) 256 142.1 -> 131.0 (1.08x) 512 146.4 -> 140.7 (1.04x) 1024 157.3 -> 147.3 (1.07x) 2048 175.3 -> 170.0 (1.03x) 4096 242.0 -> 235.7 (1.03x) 8192 387.8 -> 353.0 (1.10x) Measured on MI455X (gfx1250, 256 CU) in rocm/fw-bringup:gfx1250-atom-k3-20261116 (aiter 69d86f590, FlyDSL 0.5.0). Conflict: kept both new rows of the Kimi-K3 CSV (#8189's 3072 row, this 2048 ep_fused=0 row).
…ath (TP8EP8) (#8259 @ 9a2194a, head 2026-11-19T05:04:37Z) Kimi-K3 served as TP8 attention with the MoE expert-parallel over the same 8 GPUs (ATOM --enable-expert-parallel, DP 1) calls fused_moe with an expert mask: 112 local experts of 896, inter_dim 3072, SiTUv2, A4W4 MXFP4 per_1x32, GUGU weights. The grouped lookup keys that call as expert=112, topk=-1, ep_fused=0, so it shares the kimik3 rows with the MegaMoE stage-2 scatter (ep_fused=1); token buckets 1, 2 and 4 had no row at all. Add 14 rows with ep_fused=0 for token buckets 1..8192. Rows that name ep_fused win the lookup for that path only, so the MegaMoE path keeps the existing rows. Buckets 16384 and 32768 keep the existing rows: no swept tile beat them beyond run-to-run noise. Swept with the production call (fused_moe with expert_mask, SiTUv2 beta 4 / linear 25, GateMode.INTERLEAVE, moe_shuffle_weight / moe_shuffle_scale, random top-16 routing over 896 experts); every candidate's output is bit-identical to the existing row's. MoE kernel time per call (sum of the device kernels of one fused_moe, median of 7 interleaved rounds, one GPU): token existing us -> new us 1 29.1 -> 24.5 (1.19x, existing: no row) 2 28.2 -> 23.1 (1.22x, existing: no row) 4 35.0 -> 24.2 (1.45x, existing: no row) 8 36.1 -> 30.3 (1.19x) 16 55.4 -> 47.0 (1.18x) 32 74.6 -> 65.1 (1.15x) 64 98.4 -> 90.1 (1.09x) 128 132.4 -> 122.3 (1.08x) 256 142.1 -> 131.0 (1.08x) 512 146.4 -> 140.7 (1.04x) 1024 157.3 -> 147.3 (1.07x) 2048 175.3 -> 170.0 (1.03x) 4096 242.0 -> 235.7 (1.03x) 8192 387.8 -> 353.0 (1.10x) Measured on MI455X (gfx1250, 256 CU) in rocm/fw-bringup:gfx1250-atom-k3-20261116 (aiter 69d86f590, FlyDSL 0.5.0). Conflict: kept both new rows of the Kimi-K3 CSV (#8189's 3072 row, this 2048 ep_fused=0 row). (cherry picked from commit 8dc3601) Rebase onto main 12-03: kimik3_gfx1250_tuned_grouped_fmoe.csv conflicted with main's #8189 final (its expert-112 rows with a blank ep_fused). Replayed by row key: this commit's 14 ep_fused=0 rows (non-fused EP path) are inserted; main's blank-ep_fused rows stay as main has them.
Kimi-K3 served as TP8 attention with its MoE expert-parallel over the same 8 GPUs (ATOM
--enable-expert-parallel, DP 1, the PD prefill node's TP8EP8+DCP8) callsfused_moewith an expert mask: 112 local experts of 896, inter_dim 3072, top-16, SiTUv2 (beta 4, linear_beta 25), A4W4 MXFP4 per_1x32, GUGU weights.grouped_gemm_gfx1250_a8w4looks that call up asexpert=112, topk=-1, ep_fused=0at_get_padded_m(tokens). Inkimik3_gfx1250_tuned_grouped_fmoe.csvthis shape shares its rows with the MegaMoE stage-2 scatter (ep_fused=1, blankep_fusedserves both), and token buckets 1, 2 and 4 have no row, so they run the TDM default tile.This adds 14 rows with
ep_fused=0for token buckets 1 to 8192. A row that namesep_fusedwins the lookup for that path only.ep_fused=1) keeps the existing rows. This was checked through the runtime merge: everyep_fused=1bucket returns the same row as before.stage2_fused=False, ATOMATOM_MEGA_STAGE2_FUSED=0) also picks these rows for buckets 1 to 8192. That path callsfused_moewith the expert mask and nostage2_scatter(stages/combine_mori.py:155,mega_moe.py:553), so its lookup hasep_fused=0(grouped_moe_gfx1250.py:1924). That path was not timed here. Buckets 16384 and 32768 keep the existing rows: no swept tile beat them beyond run-to-run noise (+-2-3% at these sizes).No key repeats a row of another grouped table: the runtime merge (
AITER_CONFIGS.get_config_fileon a copy ofaiter/configs) runs without a duplicate-shape error.How the rows were found
Measured with a sweep of the production call, not with
gemm_moe_tune.py --grouped-gemm, which cannot time this shape: it times every non-Swiglu row as Silu, varies onlytile_m, and_balanced_topkneeds a positive topk (EP rows key on -1) with no expert mask. The sweep:moe_shuffle_weight/moe_shuffle_scale, GUGU, n32k4) for 112 experts;fused_moewithexpert_mask(896 entries, 112 local), global top-16 ids from random routing, SiTUv2,GateMode.INTERLEAVE, per_1x32,num_local_tokens;_GROUPED_CONFIG_CACHEand_find_grouped_config's lru_cache, checks that the lookup returned that row and that the launched kernel names carry its tiles;op_tests/flydsl_tests/test_flydsl_grouped_gemm.py, non-local routes weighted 0);fused_moecall's device kernels (route, quant, GEMM1, GEMM2, gather-reduce), 50 calls, so host launch gaps do not count. The top candidates were re-timed against the existing row in interleaved rounds, and the final table below is 7 interleaved rounds on one GPU with the other three idle.MoE kernel time per call, existing row -> new row (median of 7 rounds)
Tile notation: tile_m x tile_n x tile_k, w = m_warp x n_warp, b = buffers.
Measured on MI455X (gfx1250, 256 CU) with aiter 69d86f590 and FlyDSL 0.5.0. The rows go to main unchanged: main's lookup reads
ep_fusedthe same way.PR Self-Review
Reviewed revision
9a2194a (the PR's only commit after the split)
Behavior and intent
Adds 14 rows to
kimik3_gfx1250_tuned_grouped_fmoe.csvwithep_fused=0for model_dim 3584, inter_dim 3072, expert 112, topk -1, SiTUv2, A4W4 MXFP4 per_1x32, token buckets 1 to 8192. No code or kernel changes. For Kimi-K3 with TP8 attention and EP8 MoE (ATOM--enable-expert-parallel, DP 1), the grouped lookup now picks a tile tuned for this non-fused EP call. Before, it took the existing 112-expert rows (blankep_fused, shared with the MegaMoE stage-2 scatter) or, for buckets 1, 2 and 4 that have no row, the TDM default tile. Buckets 16384 and 32768 keep the existing rows, because no swept tile beat them beyond run-to-run noise.Validation and unverified scope
fused_moecall, as described above. For each bucket, the selected row's output is bit-identical to the existing row's output. Before / after times are in the table above.AITER_CONFIGS.get_config_fileon main's configs plus these rows passed with no duplicate-shape error. Withep_fused=0the lookup returns the new rows. Withep_fused=1it returns, for every bucket, the same row as before.ep_fusedthe same way.ep_fused=1) was checked through the lookup only: for every bucket it selects the same row as before.PR-specific question
Keys consumed: only
(gfx1250, cu_num 256, token 1..8192, model_dim 3584, inter_dim 3072, expert 112, topk -1, Situv2, bf16 / fp4x2 / fp4x2, per_1x32, ep_fused 0). That is,fused_moecalls that pass an expert mask over 112 local experts without a stage-2 scatter. These come from TP8EP8 (--enable-expert-parallel, DP 1) and from MegaMoE with the MORI combine.Why other shapes keep their selection:
ep_fused=1lookup returns the same row as before the change.Changed op tests
None: this PR changes only a tuned config CSV and touches no
op_tests/file.