Skip to content

configs(fmoe): add expert=256/topk=8 MXFP4 tuned entries for DeepSeek-V3/R1 (gfx950) - #3911

Merged
valarLip merged 2 commits into
ROCm:mainfrom
Rohan138:fix/rocm-25536-dsv3-fp4-moe-tuned-key
Jul 11, 2026
Merged

valarLip merged 2 commits into
ROCm:mainfrom
Rohan138:fix/rocm-25536-dsv3-fp4-moe-tuned-key

Conversation

@Rohan138

@Rohan138 Rohan138 commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

amd/DeepSeek-R1-0528-MXFP4 (DeepSeek-V3 arch, MXFP4 / per_1x32 fp4x2, SwiGLU) shows a consistent ~8% E2EL regression at low concurrency on gfx950 (MI350X/MI355X), TP=8 — ROCM-25536 (see #3909).

On main, the fused-MoE dispatch forces FlyDSL (AITER_FLYDSL_FORCE=1 default). DeepSeek-R1 invokes the MoE with 256 routed experts / topk=8 (the shared expert is handled separately by the serving framework), but dsv3_fp4_tuned_fmoe.csv only carried entries keyed expert=257 / topk=9 (256 routed + 1 shared). The runtime lookup therefore misses and falls back to the slow FlyDSL heuristic:

[fused_moe] no tuned FlyDSL config for ('gfx950', 256, 1, 7168, 256, 256, 8, Silu, bf16, fp4x2, fp4x2, per_1x32, ...),
            using heuristic FlyDSL fallback (kn1='flydsl_moe1_afp4_wfp4_bf16_t32x128x256_w2', ...)

Isolated ck_moe_2stages microbench (op_tests/test_moe_2stage.py -q 4 -dim 7168,256 -e 256 -k 8 -a silu -p t), gfx950:

token (M) E=256/topk=8 (miss → heuristic) E=257/topk=9 (tuned)
1 43.2 µs 29.6 µs
8 77.x µs 64.4 µs

Fix

Add expert=256 / topk=8 entries for the affected model_dim=7168 shapes (inter_dim 256/512, all token buckets) by re-keying the existing tuned kernels. The expert count does not change the per-expert GEMM shape, so the tuned kernel selection is unchanged — only the lookup key is corrected to match the routed-expert MoE call. (49 rows added; the original 257/9 rows are kept for callers that fuse the shared expert.)

Validation (MI350X / gfx950, vLLM 0.21.0, DeepSeek-R1-0528-MXFP4, TP=8)

  • Kernel ck_moe_2stages token=1: 43.2 µs → 30.0 µs (≈ cktile / pre-regression).
  • Serve perf (ticket repro, median E2EL): conc1 10846 ms → 9987 ms; conc8 → 13790 ms.
  • Accuracy gsm8k 5-shot (200): 0.965 (flexible & strict) — unchanged; the re-keyed kernel produces correct results.

Notes

  • Fixes the main manifestation of ROCM-25536. The same ticket symptom on the aiter 0.1.14 / 0.1.15.post2 release line has a different cause (the CK cktile path regressed by kimi a16wi4 moe support #2863 — split-K disabled + unfused activation for fp4x2); that needs a separate cktile-path fix/backport.
  • DCO: add your Signed-off-by: on push if aiter requires it.

@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:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 3911 --add-label <label>

@zufayu
zufayu requested review from yzhou103 and zufayu and removed request for zufayu June 26, 2026 06:14
@Rohan138
Rohan138 marked this pull request as ready for review June 30, 2026 20:30
@Rohan138
Rohan138 requested review from a team and Copilot June 30, 2026 20:30

Copilot AI 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.

Pull request overview

This PR updates the DeepSeek-V3/R1 FP4 tuned fused-MoE configuration so runtime lookup on gfx950 (MI350X/MI355X) can hit tuned entries for the routed-expert call shape (E=256, topk=8) instead of falling back to the slower heuristic path.

Changes:

  • Add tuned config rows keyed for expert=256 / topk=8 (DeepSeek routed-expert MoE) by re-keying existing tuned entries.
  • Preserve the existing expert=257 / topk=9 rows for callers that include the shared expert in the fused MoE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

valarLip
valarLip previously approved these changes Jul 7, 2026
…-V3/R1 (gfx950)

DeepSeek-R1-0528-MXFP4 calls the fused MoE with 256 routed experts / topk=8
(the shared expert is handled separately by the serving framework), but
dsv3_fp4_tuned_fmoe.csv keys the tuned FlyDSL entries at expert=257/topk=9
(256 routed + 1 shared). On gfx950 the runtime lookup misses and falls back
to the slow FlyDSL heuristic -- ~8% E2EL regression at low concurrency
(ROCM-25536; ROCm#3909).

Add expert=256/topk=8 entries for the model_dim=7168 routed-expert shapes
(inter_dim 256 [TP8] and 512 [TP4], all token buckets) by re-keying the
existing tuned rows. Expert count does not change the per-expert GEMM shape,
so the tuned kernel selection is unchanged; the rows now reflect the k_wave
fp4 gemm1 kernels from ROCm#3825 and the fallback-hint cleanup from ROCm#4025.

Perf/accuracy validated earlier on MI350X/gfx950, vLLM 0.21.0, DSR1-MXFP4 TP8
(pre-ROCm#3825 kernels): ck_moe_2stages token=1 43->30us; serve E2EL conc1
10846->9987ms; gsm8k 5-shot 0.965. Re-validation on the ROCm#3825-retuned kernels
is advisable.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Rohan138 <[email protected]>
@Rohan138
Rohan138 force-pushed the fix/rocm-25536-dsv3-fp4-moe-tuned-key branch from a3e553d to f9afc97 Compare July 9, 2026 21:26
@Rohan138

Copy link
Copy Markdown
Contributor Author

@valarLip could you stamp again? had to rebase and update configs

@valarLip
valarLip merged commit 31eb2c8 into ROCm:main Jul 11, 2026
44 checks passed
@Rohan138
Rohan138 deleted the fix/rocm-25536-dsv3-fp4-moe-tuned-key branch July 17, 2026 16:39
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