Skip to content

[FlyDSL] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode - #6557

Merged
zufayu merged 8 commits into
ROCm:mainfrom
karverma-amd:dsr1-fp4-high-batch-moe-tiles
Oct 30, 2026
Merged

zufayu merged 8 commits into
ROCm:mainfrom
karverma-amd:dsr1-fp4-high-batch-moe-tiles

Conversation

@karverma-amd

Copy link
Copy Markdown
Contributor

Summary

  • Record the scatter-safe 128x256x256, 1x4, 2-buffer tile for both DeepSeek-R1 FP4 MoE GEMMs (K7168 and K2048).
  • Applies to the fused EP shape gfx1250, hidden 7168, intermediate 2048, 65 experts, topk -1, at token buckets 1024, 2048, 4096, and 32768.
  • Token 512 is unchanged. The wider tile was slower there in the isolated GEMM sweep.

Serving on the 1014 image looks the grouped config up at token 32768 for steady-state decode, because the MoE arena is 32768. That is the row that selects this tile without AITER_TDM_TILE_*. A 512 seq/GPU server also uses that arena key, so its decode tile changes with the 32768 row even though the M=512 GEMM itself is not retuned.

Benchmark

Four-rank EP microbench (bench_mega_moe.py, a4w4 MXFP4, E=256, topk=8, fused EP scatter), combined K7168+K2048:

  • 764 tok/rank: 187.88 µs → 143.96 µs (−23.4%)
  • 1024 tok/rank: 219.07 µs → 189.88 µs (−13.3%)
  • 512 tok/rank: 127.18 µs → 131.29 µs, so that bucket stays on the default tile

Unprofiled serving, ISL 1024 / OSL 4096, concurrency 3056 (764 seq/GPU), same tile via AITER_TDM_TILE_*:

  • Output throughput: 68,134.81 → 77,436.44 tok/s (+13.7%)
  • Mean TPOT: 40.15 → 35.96 ms
  • P99 TPOT: 43.40 → 38.73 ms

Test plan

  • Grouped config lookup for token 32768 / 1024, expert 65, topk -1, ep_fused=1 returns tile 128x256x256 and 2 buffers
  • Token 512 still misses and keeps the default 64x256x256 kernel
  • Repeat the unprofiled 1k/4k concurrency-3056 run with the CSV and without AITER_TDM_TILE_*

@karverma-amd
karverma-amd requested a review from a team October 15, 2026 02:27
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 6557 --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.

@github-actions github-actions Bot changed the title [FlyDSL][gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode [Config] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode Oct 15, 2026
@zufayu
zufayu self-requested a review October 16, 2026 01:11
@zufayu zufayu self-assigned this Oct 16, 2026
@karverma-amd
karverma-amd force-pushed the dsr1-fp4-high-batch-moe-tiles branch 2 times, most recently from d7dd09e to f43d043 Compare October 17, 2026 23:09
128x256x256 is the right tile for the fused K7168 and K2048 GEMMs at high
batch on gfx1250. For the 4096 tokens-per-rank EP shape, 3 buffers is
faster than 2 (benched: GEMM1 82.6 vs 83.4 us, GEMM2 67.9 vs 69.6 us,
~0.5-4% per GEMM, accuracy PASS), so record 3 buffers there for both the
65- and 64-expert shapes; the smaller buckets keep 2 buffers.

Co-authored-by: Cursor <[email protected]>
@karverma-amd
karverma-amd force-pushed the dsr1-fp4-high-batch-moe-tiles branch from f43d043 to 1849bc5 Compare October 17, 2026 23:44
@zufayu

zufayu commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

The current results do not yet demonstrate that these new 128-tile configurations are selected by the default production path.

The compact-plan lookup does not pass ep_fused=True, so it still applies the existing 64-alignment selection behavior instead of following the mode assumed by the new entries. The benchmark then forces the 128-tile choice through AITER_TDM_TILE_*, which bypasses the production selection path. As a result, the reported numbers show that the forced configuration can perform well, but not that this PR improves the real default dispatch.

Please update the lookup so that the production path uses the intended ep_fused mode, then rerun correctness and same-machine performance tests without the tile override environment variables. Please also include reproducible results for the added E=65 rows and log the configuration actually selected at runtime; the current benchmark coverage only directly supports the existing E=64/token-4096 case.

karverma-amd and others added 2 commits October 27, 2026 00:28
The compact-plan lookup left ep_fused false, and the merged CSV stores that flag as "1.0", so the 128-tile rows never matched and the plan stayed on the 64 default. Look the scatter path up and normalize those cells, and log the row that was selected.

Co-authored-by: Cursor <[email protected]>
@github-actions github-actions Bot changed the title [Config] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode [FlyDSL] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode Oct 27, 2026
@github-actions github-actions Bot added FlyDSL and removed Config labels Oct 27, 2026
@zufayu

zufayu commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

The compact-plan lookup fix looks correct now: it uses ep_fused=True, covers the added E=65 rows, and logs the selected configuration.

Before approval, please validate the real default path on gfx1250 with all AITER_TDM_TILE_* overrides removed:

  1. confirm that the intended 128x256x256 configuration is selected at runtime;
  2. confirm correctness for the E=65 path; and
  3. have the relevant owner confirm that an internal same-machine A/B comparison shows no regression.

There is no need to publish restricted gfx1250 performance numbers; a clear validation result and owner sign-off are sufficient. If the exact gfx1250 timing or throughput figures currently in the PR description are restricted, please also remove or replace them with relative or qualitative conclusions.

karverma-amd and others added 2 commits October 27, 2026 16:14
Keep the fused-EP 128-tile DeepSeek-R1 rows on the a_preshuffle CSV schema so the compact-plan lookup still selects them.

Co-authored-by: Cursor <[email protected]>
…M launch.

The launcher cache flattens scale tensors with view(-1). Compact dispatch scales are a strided window on the wire pitch, so that view aborts before the kernel runs. Pass a rank-1 span of the same base address and let the row stride describe the pitch.

Co-authored-by: Cursor <[email protected]>
@karverma-amd

Copy link
Copy Markdown
Contributor Author

@zufayu - Validated the default path on gfx1250 with every AITER_TDM_TILE_* override unset. Shape is DeepSeek-R1 MXFP4 (hidden 7168, intermediate 2048, topk 8), 4 ranks, 65 experts/rank, 1024 tokens/rank, 1 layer. Not DeepSeek-V4.1 Flash.

Every rank logged token=4096 experts=65 ep_fused=1 tile=128x256x256 buffers=3/3.
Correctness passed: average logits diff 0.021515 over 4 ranks, under the auto tolerance 0.032735.
Same-machine A/B on the 1022 image, same shape: default path versus tile M forced to 64. Both passed with the same logits diff. The default 128x256x256 path was about 4.8% faster. No regression.
Also merged current main. The fused-EP 128-tile rows are kept on the new a_preshuffle CSV schema, and the lookup test still selects them only when ep_fused is set.

zufayu
zufayu previously approved these changes Oct 28, 2026
…7055)

Rebase onto the merged global-to-local registry migration. Match all 221 kernel records exactly, update A0/mirror build-info kids and test lookups, and add a CPU-only consistency regression for all profile tables. Keep CO bytes and exported symbols unchanged; clarify historical validation IDs.
@github-actions github-actions Bot changed the title [FlyDSL] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode [OPUS] [FlyDSL] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode Oct 28, 2026
@github-actions github-actions Bot added the OPUS label Oct 28, 2026
@github-actions github-actions Bot changed the title [OPUS] [FlyDSL] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode [FlyDSL] [gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode Oct 28, 2026
@github-actions github-actions Bot removed the OPUS label Oct 28, 2026
@aiter-bot

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 86ea3311c1d7 · 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 — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/tuning_tests/test_grouped_ep_fused_lookup.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/tuning_tests/test_grouped_gemm_launch_address.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

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

@zufayu
zufayu merged commit b33beb0 into ROCm:main Oct 30, 2026
74 of 76 checks passed
jhchouuu added a commit to jhchouuu/aiter that referenced this pull request Oct 30, 2026
- Take main's _launch_address (ROCm#6557) for the grouped GEMM's strided scale
  views; drop this branch's tensor_shim.flat_arg and its test.
- Port ROCm#6557's compact-plan change (ep_fused=True lookup, logged
  AITER_TDM_TILE_M override) to stages/dispatch_compact.py.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
…de (#6557)

* [FlyDSL][gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode.

128x256x256 is the right tile for the fused K7168 and K2048 GEMMs at high
batch on gfx1250. For the 4096 tokens-per-rank EP shape, 3 buffers is
faster than 2 (benched: GEMM1 82.6 vs 83.4 us, GEMM2 67.9 vs 69.6 us,
~0.5-4% per GEMM, accuracy PASS), so record 3 buffers there for both the
65- and 64-expert shapes; the smaller buckets keep 2 buffers.

Co-authored-by: Cursor <[email protected]>

* [FlyDSL][gfx1250] Select fused-EP MoE tiles on the compact-plan path.

The compact-plan lookup left ep_fused false, and the merged CSV stores that flag as "1.0", so the 128-tile rows never matched and the plan stayed on the 64 default. Look the scatter path up and normalize those cells, and log the row that was selected.

Co-authored-by: Cursor <[email protected]>

* [FlyDSL][gfx1250] Keep pitched FP4 scale addresses in the grouped GEMM launch.

The launcher cache flattens scale tensors with view(-1). Compact dispatch scales are a strided window on the wire pitch, so that view aborts before the kernel runs. Pass a rank-1 span of the same base address and let the row stride describe the pitch.

Co-authored-by: Cursor <[email protected]>

* [OPUS] Align CO tests and build metadata with local kernel IDs (#7055)

Rebase onto the merged global-to-local registry migration. Match all 221 kernel records exactly, update A0/mirror build-info kids and test lookups, and add a CPU-only consistency regression for all profile tables. Keep CO bytes and exported symbols unchanged; clarify historical validation IDs.

---------

Co-authored-by: Cursor <[email protected]>
Co-authored-by: karverma-amd <[email protected]>
Co-authored-by: demonsan <[email protected]>
Co-authored-by: Satya Nikhil Kodukula <[email protected]>
jhinpan added a commit that referenced this pull request Nov 14, 2026
aiter/aot/flydsl/grouped_moe.py: take main's deletion; #6362 replaced the
AOT CSV parser with a replay of the runtime lookup.
grouped_moe_gfx1250._cell: keep this branch's exact integral-text
normalization, which also covers #6557's "1.0"/"0.0" flag case without
parsing through a binary float.
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
…de (ROCm#6557)

* [FlyDSL][gfx1250] Tune DeepSeek-R1 FP4 MoE tiles for high-batch decode.

128x256x256 is the right tile for the fused K7168 and K2048 GEMMs at high
batch on gfx1250. For the 4096 tokens-per-rank EP shape, 3 buffers is
faster than 2 (benched: GEMM1 82.6 vs 83.4 us, GEMM2 67.9 vs 69.6 us,
~0.5-4% per GEMM, accuracy PASS), so record 3 buffers there for both the
65- and 64-expert shapes; the smaller buckets keep 2 buffers.

Co-authored-by: Cursor <[email protected]>

* [FlyDSL][gfx1250] Select fused-EP MoE tiles on the compact-plan path.

The compact-plan lookup left ep_fused false, and the merged CSV stores that flag as "1.0", so the 128-tile rows never matched and the plan stayed on the 64 default. Look the scatter path up and normalize those cells, and log the row that was selected.

Co-authored-by: Cursor <[email protected]>

* [FlyDSL][gfx1250] Keep pitched FP4 scale addresses in the grouped GEMM launch.

The launcher cache flattens scale tensors with view(-1). Compact dispatch scales are a strided window on the wire pitch, so that view aborts before the kernel runs. Pass a rank-1 span of the same base address and let the row stride describe the pitch.

Co-authored-by: Cursor <[email protected]>

* [OPUS] Align CO tests and build metadata with local kernel IDs (ROCm#7055)

Rebase onto the merged global-to-local registry migration. Match all 221 kernel records exactly, update A0/mirror build-info kids and test lookups, and add a CPU-only consistency regression for all profile tables. Keep CO bytes and exported symbols unchanged; clarify historical validation IDs.

---------

Co-authored-by: Cursor <[email protected]>
Co-authored-by: karverma-amd <[email protected]>
Co-authored-by: demonsan <[email protected]>
Co-authored-by: Satya Nikhil Kodukula <[email protected]>
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.

5 participants