Skip to content

[gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 - #8002

Open
JiaoliangYu wants to merge 8 commits into
ROCm:mainfrom
JiaoliangYu:jiaolyu/dsr1-megamoe-ep-fused-rows
Open

JiaoliangYu wants to merge 8 commits into
ROCm:mainfrom
JiaoliangYu:jiaolyu/dsr1-megamoe-ep-fused-rows

Conversation

@JiaoliangYu

@JiaoliangYu JiaoliangYu commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Change

model_configs/dsr1_tuned_grouped_fmoe.csv, DeepSeek-R1 EP4 MegaMoE shape (model_dim 7168, inter_dim 2048, 65 experts/rank, topk -1), looked up with ep_fused=1:

  • Appends 8 rows for buckets main missed (they kept the caller's default tile): tokens 8–512 and 16384 copy the ep_fused=0 rows; 8192 uses the ep_fused=0 tiles with persistent_workers2=512 (233.57 us).
  • Replaces in place the ep_fused=1 token-32768 row from [FlyDSL] [gfx1250] Optimize grouped MoE prefill and DSR1 EP tuning #7726 (128x256x256 w1x4, 2/2 buffers, no measurement) with a measured one: 256x256x256 w2x2, 4/4 buffers, cluster_n 4, waves 2/1, prefetch, LDS SoA interleave, A preshuffle (1359.51 us). @yadaish FYI, since it is your row.

Results

MI455X (gfx1250) ×4, on our aiter branch rebased on main of 11-13 (a7a7c99e2), outputs bit-identical:

  • 32768 (prefill, 12288 tokens/rank): 4-GPU EP4 MegaMoE layer 2361 → 1994.5 us (−15.5%); DeepSeek-R1 MLPerf offline trace, prefill step 229.5 → 207.4 ms (−9.6%).
  • ep_fused=1 rows (8192 then a plain copy of the ep_fused=0 row): MLPerf trace decode step −6.54%.
  • 8192 with persistent_workers2=512 (decode, 1536 tokens/rank): layer 416.2 → 407.3 us (−2.2%, single measurement).

Tests

  • CPU, aiter's own code with the chip queries stubbed (gfx1250, 256 CUs): the merge of all *tuned_grouped_fmoe*.csv reports no duplicate shape; _find_grouped_config with ep_fused=1 selects the new rows for 8–512 / 8192 / 16384 / 32768; ep_fused=0 lookups are unchanged.
  • Head commit: 72 rows × 48 fields, no duplicate key.

PR Self-Review

Reviewed revision

3528e50510dd859e09f1a179ea2f61bc2fece4a3

Behavior and intent

DeepSeek-R1 MegaMoE EP4 with a fused shared expert looks up grouped GEMM with
gfx1250, 256 CUs, hidden 7168, intermediate 2048, 65 experts/rank, topk -1,
Silu, bf16 output, MXFP4 A/W, per-1x32 quantization and ep_fused=1. An explicit
ep_fused=0 row does not serve that scatter path. This PR adds the missing
8/32/64/128/256/512/8192/16384 buckets and replaces the existing 32768 fused
row. The added/replaced keys have one row each; unrelated configurations retain
their previous selection. The 512 choice remains subject to the common-workload
comparison with #8092; this update does not change either candidate's parameters.

The branch includes main 9eb34ee0bcfc8219ec74f5559a8f40a3954e5f31. No config
migration is needed: main still contains
aiter/configs/model_configs/dsr1_tuned_grouped_fmoe.csv with the same 48-column
schema. Test updates follow the current compact-dispatch API and the intended
new rows. The earlier one-line _is_gfx1250 fix in the allreduce rank-agreement
fixture is dropped at this head: main fixed that test in #8117, and the file now
matches main.

Validation and unverified scope

This head merges main into c44bd88e72e9ebeb6eba3c6759bc6781222a70f4 and drops the fixture line; the grouped-config CSV and its lookup test are unchanged since c44bd88, where the checks below were run.

On the current revision, Windows/Python 3.12, executed the checkout's actual
lookup/padding/compact helper bodies and existing unittest classes through AST,
with import dependencies and chip queries stubbed to gfx1250/256 CUs:
12 tests passed, 0 skipped. The compact helper executes from its new
stages/dispatch_compact.py location. The merged grouped-config family has 597
rows and zero duplicate keys; this CSV has 72 rows × 48 fields. Non-EP lookups
are identical to main at padded boundaries, including experts 64/65.

Black and Ruff passed on the edited test file, and git diff --check passed.

Normal commands for the ROCm environment are:

GPU_ARCHS=gfx1250 CU_NUM=256 python3 -m unittest op_tests.tuning_tests.test_grouped_ep_fused_lookup -v

The new head's CI is being followed separately. Local Windows lacks torch,
FlyDSL Linux wheels and GPUs, so the normal-import/Gloo commands and GPU kernels
have not been reported as local passes.

The earlier November-13 MI455X measurements in Results are historical author
evidence, not a rerun of this SHA. Current-head gfx1250 EP4 reference accuracy,
four-rank output hashes, 8192/32768 performance, 512 A/B and joint S1F validation
remain PENDING. A pinned executable package with exact commands, candidate
diffs, observed GEMM lookups, output dumps and decision rules is at the author's
Z:\jiaolyu\dsr1_pr_validation\20261118\aiter-8002\ (local backup retained).
It compares this head with main 9eb34ee, and joint candidates from #8092
4cd3f6c6037538654814951ce7d9595762cc406d, using FlyDSL 0.5.0. No machine result
is inferred from that package's preparation or dry run. Non-uniform routing,
other EP sizes and current production MLPerf traces also remain unverified.

PR-specific question

Consumers use expert=65, topk=-1, ep_fused=1 with the shape/dtype/quant fields
above; only tokens 8/32/64/128/256/512/8192/16384/32768 change. CPU duplicate and
boundary lookup checks compare the whole grouped family with main, and confirm
that ep_fused=0 selection is unchanged. Compact dispatch and grouped GEMM use
the same fused row and max(tile_m, tile_m2) alignment: 16 at token 512, 256 at
32768. Token 512 is the sole overlapping key in #8092's current diff; the key
does not encode S1F mode. Its timing claim cannot resolve the choice without
the same-S1F correctness/hash and performance A/B. The machine package records
actual GEMM lookups so a historical tpr value is not assumed to hit token 32768.

Changed op tests

  • op_tests/tuning_tests/test_grouped_ep_fused_lookup.py: extends existing CSV
    selection coverage to the intended fused rows, updates 32768 tile/buffer
    expectations, removes the obsolete/redundant "512 stays default" assertion,
    and executes the relocated compact helper with its current config interface.
    It restores temporary environment overrides and keeps existing model/top-k,
    CU preference and token-overflow tests. This is configuration/API consistency
    coverage, not another GPU performance suite.

…p_fused=1 buckets and tuned 8192

MegaMoE looks the grouped GEMM up with ep_fused=1 (GEMM2 does the EP
scatter). For DeepSeek-R1 EP4 (model_dim 7168, inter_dim 2048, 65 experts
per rank, topk -1) the table had ep_fused=1 rows only for tokens 1024, 2048,
4096 and 32768, and the ep_fused=0 rows do not serve the fused path, so the
other buckets missed and kept the caller's default tile.

- tokens 8..512 and 16384: the existing ep_fused=0 rows, with ep_fused=1.
- token 8192: the ep_fused=0 row's tiles with persistent_workers2=512
  (233.57 us).
@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 8002 --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.

…d=1 row

Replace the ep_fused=1 token=32768 row from ROCm#7726 (hand-set 128x256x256,
w1x4, no measurement) with a measured one: 256x256x256 w2x2, 4/4 buffers,
cluster_n 4, waves 2/1, prefetch, LDS SoA interleave, A preshuffle.
4-GPU EP4 MegaMoE layer (12288 tokens/rank): 2361 -> 1994.5 us, bit-identical.
@JiaoliangYu JiaoliangYu changed the title [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets and tuned 8192 [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 Nov 16, 2026
@JiaoliangYu
JiaoliangYu marked this pull request as ready for review November 16, 2026 07:01
@JiaoliangYu
JiaoliangYu requested a review from a team November 16, 2026 07:01
@github-actions github-actions Bot changed the title [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 [Config] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 Nov 16, 2026
@aiter-bot

aiter-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 3528e50510dd · 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.

Boss2002n pushed a commit that referenced this pull request Nov 16, 2026
… for top-9

The DSR1 rows that carry the 256-tile configs were marked ep_fused=0, so the
MegaMoE (ep_fused=1) lookup missed them past token 4096 and fell back to the
64-tile default. Take the ep_fused=1 rows for experts=65 from #8002.

With those tiles the S1F receive cap of 4096 sends DSR1 top-9 (shared expert
fused) back to dispatch + GEMM1 at 1536 tokens/rank and up. Lift it like the
DSV4.1 Flash shapes: 798 vs 899 us/layer at 4096, 384 vs 422 at 1536.
@zufayu
zufayu self-requested a review November 17, 2026 01:08
@zufayu zufayu self-assigned this Nov 17, 2026

@zufayu zufayu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AITER SOP code review on current head 5f5c31d:

I did not find an additional row-level logic blocker, but this PR edits dsr1_tuned_grouped_fmoe.csv, which no longer exists on current main, so the change cannot be validated against the current config schema.

Primary reviewer: @yzhou103 (tuning/config owner).

Author action: rebase onto current main, migrate these rows into the current table/schema, then rerun duplicate/lookup checks plus gfx1250 EP4 accuracy/hash and the 8192/32768 performance cases. The current Aiter Gate failure appears unrelated, but the old-tree result is not sufficient after the required migration. CI/conflict status is a merge blocker, not a reason to defer code review.

@XingerZhu

Copy link
Copy Markdown
Contributor

LGTM

@github-actions github-actions Bot changed the title [Config] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 Nov 18, 2026
@github-actions github-actions Bot added FlyDSL and removed Config labels Nov 18, 2026
@JiaoliangYu

Copy link
Copy Markdown
Contributor Author

Updated in c44bd88e72e9ebeb6eba3c6759bc6781222a70f4, including main
9eb34ee0bcfc8219ec74f5559a8f40a3954e5f31 and current-revision self-review.

The schema/migration premise in the earlier review is now moot: main still
contains the CSV

at the same path and with the same 48-column schema. No migration or replacement
table is needed. The current CSV is 72 rows; duplicate checks over all 597
grouped rows found no duplicate key. CPU boundary lookups preserve ep_fused=0
selection against that main baseline.

I also updated the stale 32768/512 lookup assertions and the compact helper's
new import/config interface. All 12 existing lookup/fallback/alignment tests
execute in the isolated actual-helper harness with no skips. The historical
allreduce CI failure is reproduced in main's CPU fixture: it bypasses the real
constructor and omits _is_gfx1250. The one-line fixture initialization fixes
that error without altering production logic or CI acceptance rules. These
local checks use import/hardware stand-ins; the full Gloo test and current-head
CI are being followed independently.

The gfx1250 EP4 accuracy/hash and 8192/32768 performance revalidation requests
remain open. The author-side executable machine package is pinned to this SHA,
main 9eb34ee, and #8092 4cd3f6c, and includes four-rank tensor hashes,
independent reference checks, observed GEMM keys, three timing rounds, the two
512 configurations and joint S1F code/CSV candidates. No machine result has
been marked PASS. The older November-13 measurements remain historical only;
current-head hardware evidence will be added after execution.

#8092 still has one competing token-512 key. I have retained our current row
pending the common-workload correctness/hash and timing comparison; its wider
S1F policy is included in the joint validation rather than assumed compatible.

zufayu
zufayu previously approved these changes Nov 23, 2026
@github-actions github-actions Bot changed the title [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets, tuned 8192 and 32768 Nov 23, 2026
@github-actions github-actions Bot removed the FlyDSL label Nov 23, 2026

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants