Skip to content

[Config] Kimi-K3 gfx1250 grouped MoE: EP8 rows for the non-fused EP path (TP8EP8) - #8259

Open
qichu-yun wants to merge 1 commit into
mainfrom
k3-ep8-grouped-moe-tune
Open

qichu-yun wants to merge 1 commit into
mainfrom
k3-ep8-grouped-moe-tune

Conversation

@qichu-yun

@qichu-yun qichu-yun commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Split (11-24). This PR now carries only the CSV rows, commit 9a2194a. The stage-1-fusion commit 12bb1b3 was dropped:

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) calls fused_moe with 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_a8w4 looks that call up as expert=112, topk=-1, ep_fused=0 at _get_padded_m(tokens). In kimik3_gfx1250_tuned_grouped_fmoe.csv this shape shares its rows with the MegaMoE stage-2 scatter (ep_fused=1, blank ep_fused serves 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=0 for token buckets 1 to 8192. A row that names ep_fused wins the lookup for that path only.

  • MegaMoE with the fused-scatter combine (ep_fused=1) keeps the existing rows. This was checked through the runtime merge: every ep_fused=1 bucket returns the same row as before.
  • MegaMoE with the MORI combine (stage2_fused=False, ATOM ATOM_MEGA_STAGE2_FUSED=0) also picks these rows for buckets 1 to 8192. That path calls fused_moe with the expert mask and no stage2_scatter (stages/combine_mori.py:155, mega_moe.py:553), so its lookup has ep_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_file on a copy of aiter/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 only tile_m, and _balanced_topk needs a positive topk (EP rows key on -1) with no expert mask. The sweep:

  • prepares weights and scales the way ATOM does on gfx1250 (moe_shuffle_weight / moe_shuffle_scale, GUGU, n32k4) for 112 experts;
  • calls fused_moe with expert_mask (896 entries, 112 local), global top-16 ids from random routing, SiTUv2, GateMode.INTERLEAVE, per_1x32, num_local_tokens;
  • runs each candidate as a single config row, clears _GROUPED_CONFIG_CACHE and _find_grouped_config's lru_cache, checks that the lookup returned that row and that the launched kernel names carry its tiles;
  • requires each candidate's output to be bit-identical to the existing row's (at tokens 1 to 4096 the existing row's output is 3.7e-6 to 5.4e-6 logits_diff from the torch reference of op_tests/flydsl_tests/test_flydsl_grouped_gemm.py, non-local routes weighted 0);
  • sweeps GEMM1 tiles first (tile_m 16-256, tile_n/n_warp, tile_k, m_warp, buffers), then GEMM2 tiles on the best GEMM1, then single knobs (persistent workers, tdm_b_th, next_stage_prefetch, rolled_drain, lds_soa_load_interleave, tdm_as_in_prologue, waves_per_tensor_tdm, split_k, clusters);
  • times with the torch profiler: the sum of one fused_moe call'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)

token existing us new us speedup existing tile (GEMM1 / GEMM2) new tile (GEMM1 / GEMM2)
1 29.1 24.5 1.19x no row (default) 16x256x512 w1x4 b2 / 16x256x512 w1x2 b2, split_k2 2, persistent 256
2 28.2 23.1 1.22x no row (default) 16x256x512 w1x4 b2 / 16x256x512 w1x4 b3, tdm_as_in_prologue
4 35.0 24.2 1.45x no row (default) 16x256x512 w1x4 b3 / 16x256x512 w1x4 b3, tdm_b_th, persistent 256
8 36.1 30.3 1.19x 16x256x256 w1x4 b4 / 16x256x512 w1x4 b4 16x128x256 w1x2 b2 / 16x256x256 w1x4 b3, tdm_b_th
16 55.4 47.0 1.18x 32x256x256 w1x4 b2 / 32x256x256 w1x4 b3 16x128x128 w1x2 b2 / 16x256x256 w1x4 b2, tdm_b_th
32 74.6 65.1 1.15x 16x256x256 w1x4 b3 / 16x256x256 w1x4 b2 16x256x128 w1x2 b2 / 16x256x256 w1x2 b2, tdm_b_th
64 98.4 90.1 1.09x 16x128x256 w1x2 b2 / 16x256x256 w1x4 b2 16x128x128 w1x2 b3 / 16x512x256 w1x4 b2, tdm_b_th
128 132.4 122.3 1.08x 16x256x256 w1x4 b2 / 16x256x128 w1x4 b4 16x128x128 w1x2 b2 / 16x512x256 w1x4 b4, tdm_b_th
256 142.1 131.0 1.08x 16x128x256 w1x2 b2 / 16x512x128 w1x4 b2 16x128x128 w1x2 b4 / 16x256x128 w1x4 b4, tdm_b_th
512 146.4 140.7 1.04x 16x256x256 w1x4 b2 / 16x256x256 w1x4 b2 16x128x128 w1x2 b4 / 16x512x256 w1x4 b2, tdm_b_th
1024 157.3 147.3 1.07x 32x128x256 w1x2 b2 / 32x512x128 w1x4 b2 32x256x128 w1x4 b4 / 32x256x128 w1x4 b4, tdm_b_th
2048 175.3 170.0 1.03x 64x256x256 w1x4 b2 / 64x512x256 w1x8 b2 64x256x128 w1x4 b3 / 64x256x128 w1x2 b3, tdm_b_th
4096 242.0 235.7 1.03x 128x256x256 w2x4 b3 / 128x512x256 w1x8 b2 128x256x256 w1x4 b3 / 128x256x256 w1x4 b3, next_stage_prefetch
8192 387.8 353.0 1.10x 64x256x256 w1x4 b2 / 64x512x256 w1x8 b2 128x256x256 w1x4 b3 / 128x256x256 w1x4 b3
16384 564.2 unchanged - 128x256x256 w1x4 b3 / 128x512x256 w1x8 b3 kept
32768 1052.9 unchanged - 128x256x256 w1x4 b3 / 128x512x256 w1x4 b3 kept

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_fused the 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.csv with ep_fused=0 for 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 (blank ep_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

  • Hardware and software: MI455X (gfx1250, 256 CU), aiter 69d86f590.
  • Per-bucket timing: sweep of the production fused_moe call, 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.
  • Merge check: AITER_CONFIGS.get_config_file on main's configs plus these rows passed with no duplicate-shape error. With ep_fused=0 the lookup returns the new rows. With ep_fused=1 it returns, for every bucket, the same row as before.
  • GSM8K (5-shot, 1319 questions): Kimi-K3 TP8 + EP8 + DCP8 on two MI455X trays (8 GPUs), ATOM accuracy mode. The two runs differ only in this CSV.
    • Existing CSV: strict 0.9659 ± 0.0050.
    • This CSV: strict 0.9697 ± 0.0047.
    • The server log of the second run shows the new rows selected for buckets 1 to 8192, and the existing row for 16384.
  • Unverified:
    • The rows were timed on aiter 69d86f590, not re-timed on main's head. I read main's lookup code and it keys ep_fused the same way.
    • The DP8EP8 MegaMoE path with the fused-scatter combine (ep_fused=1) was checked through the lookup only: for every bucket it selects the same row as before.
    • MegaMoE with the MORI combine takes these rows (see above) and was not timed.
    • Timing used uniform random routing. In the prefill trace at 16384 tokens, the harness came within 4 % of the trace's GEMM times.

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_moe calls 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:

  • The PR only adds rows, so every other key in this and the other grouped tables is untouched.
  • The runtime merge finds no duplicate key.
  • For every bucket, an ep_fused=1 lookup returns the same row as before the change.
  • In the GSM8K run with the existing CSV, the server log shows the old 112-expert rows selected and buckets 1, 2 and 4 falling back to the default tile.

Changed op tests

None: this PR changes only a tuned config CSV and touches no op_tests/ file.

…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).
@qichu-yun
qichu-yun requested a review from a team November 19, 2026 05:04
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8259 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@aiter-bot

aiter-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 9a2194a16909 · mode shadow

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

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (2)

  1. 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/69d86f590 returns 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 of mxfp4_preshuffle_gfx1250_tdm.py), #5899, #7960 and #7655. These rows become the default tiles for Kimi-K3 TP8EP8 (non-MegaMoE fused_moe with 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.py is 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.
  2. 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 / ATOM ATOM_MEGA_STAGE2_FUSED=0) calls fused_moe with expert_mask and stage2_scatter=None; see mega_moe.py:532-555 and stages/combine_mori.py:155. That makes ep_fused=False at grouped_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_fmoe family (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_tile stays 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.py EP CSV sweep ignores ep_fused, so the blank 112-expert rows for 8–8192 no longer get a single-GPU run.
    • Bucket 65536 has no 112-expert row.

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).

@github-actions github-actions Bot changed the title [Config] Kimi-K3 gfx1250 grouped MoE: EP8 rows for the non-fused EP path (TP8EP8) [FlyDSL] Kimi-K3 gfx1250 grouped MoE: EP8 rows for the non-fused EP path (TP8EP8) Nov 19, 2026
@github-actions github-actions Bot added FlyDSL and removed Config labels Nov 19, 2026

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (8)

  1. Apply the SHARED_FIRST rotation in the per-XCC queue, or keep XQ off where it applies. s1f_stage1.py:1695-1700 (XQ q_code) and the static first item at :1932 never add m_sh; only the global branch does (:1709-1712). XQ is on by default for every tile_m <= 64 (s1f_ctl.py:74-81), and S1F_SHARED_FIRST=1 is the default (compact_plan.py:55), so the shared expert's m-tiles are no longer run first; compact_plan.py:50-54 documents 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_tiles under const_expr(SHARED_FIRST) (CPU-checked: every (m, n) runs once, each m-tile stays on one XCC).

  2. 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 <= 64 buckets) and the CSV tdm_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=0 vs auto), or scope auto XQ and the embedded tdm_b_th to the shape you tuned ((8, 16)).

  3. 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_config lookup via _compact_g1_tdm_b_th (dispatch_compact.py:103-108,720), and _launcher re-reads and validates AITER_MEGA_S1F_XCC_QUEUE on 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: return tdm_b_th from the single row lookup in _compact_gemm_tiles, and read the XQ mode once in arm()/__init__.

  4. 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.

  5. 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).

  6. 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 whose ep_fused=1 row has tile_m 128 (bucket 4096 blank row, ~257-512 tokens/rank; bucket 131072) is refused by tile_reasons (tile_m > 64 with npes > 4) but step_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 :850 raises under graph capture. Base kept these steps on step_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/kernel step_off steps already use; matches :947 and s1f_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.

@gbyu-amd
gbyu-amd force-pushed the k3-ep8-grouped-moe-tune branch from 12bb1b3 to 9a2194a Compare November 24, 2026 07:17
@github-actions github-actions Bot changed the title [FlyDSL] Kimi-K3 gfx1250 grouped MoE: EP8 rows for the non-fused EP path (TP8EP8) [Config] Kimi-K3 gfx1250 grouped MoE: EP8 rows for the non-fused EP path (TP8EP8) Nov 24, 2026
@github-actions github-actions Bot added Config and removed FlyDSL labels Nov 24, 2026
@gbyu-amd

gbyu-amd commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

I split this PR: it is now CSV-only, with one commit (9a2194a) adding the 14 ep_fused=0 rows.

  • Dropped: 12bb1b3 (stage-1 fusion for EP8). SiTUv2 in the S1F stage-1 kernel is covered by [FlyDSL] MegaMoE gfx1250 S1F: fix the stage-1 plan's LDS overflow on large arenas (hipErrorInvalidValue) and run SiTUv2 in the stage-1 kernel #8483. The rest of that commit is kept on gyu/pr8259-s1f-12bb1b32 for a separate S1F PR, so round 2's items 1-3 and 6-8 no longer apply here. That rest is:
    • the K3 ep_fused=1 rows;
    • the per-XCC GEMM1 queues;
    • the 8-wide flag load;
    • the (8, 16) receive cap.
  • Round 1, item 2 (scope): the description is corrected. MegaMoE with the MORI combine has no stage2_scatter (combine_mori.py:155), so it looks up ep_fused=0 (grouped_moe_gfx1250.py:1924) and takes these rows for buckets 1-8192. That path was not timed. With 12bb1b3 gone, every ep_fused=1 bucket again returns the same row as on main.
  • Round 1, item 1 (tree / noise): still open. Next, I will re-time buckets 64-8192 on current main with per-round min/max, and drop the rows that do not clear noise.

gbyu-amd pushed a commit that referenced this pull request Nov 26, 2026
…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).
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
…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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants