Skip to content

[Config] [Perf] Add DeepSeek-V4.1-Flash TP4 A8W4 MoE rows for gfx950 (E385, top-7) - #6363

Closed
amd-pedghazi wants to merge 2 commits into
ROCm:mainfrom
amd-pedghazi:amd/dsv41-tp4-a8w4-moe-e385-top7
Closed

amd-pedghazi wants to merge 2 commits into
ROCm:mainfrom
amd-pedghazi:amd/dsv41-tp4-a8w4-moe-e385-top7

Conversation

@amd-pedghazi

@amd-pedghazi amd-pedghazi commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds nine rows to aiter/configs/model_configs/dsv41_fp8_tuned_fmoe.csv, and the same shapes to the untuned CSV, for DeepSeek-V4.1-Flash on gfx950 at TP4 with SGLang's fused shared expert. The key is model dimension 5120, padded intermediate dimension 640, 385 experts, top-7, FP8 activations and MXFP4 weights, at padded M 64, 256, 512, 1024, 2048, 4096, 8192, 16384 and 32768. The M 16384 and 32768 rows pair a stage-1 kernel with the stage-2 layout reduce kernel and were measured with the FP8 stage-2 route (AITER_FLYDSL_STAGE2_FP8=1). Draft: merge after #6170.

Motivation

DeepSeek-V4.1-Flash on MI355X with 4 GPUs has no tuned MoE (mixture-of-experts) settings for its shape, so AITER falls back to guessed kernel settings. The rows for M 64-8192 make the MoE step take 0.89-0.98x of the time it takes today. Long prompts run every 16k prefill chunk in the M 16384 bucket, and the M 32768 row covers larger prefill batches. At M 16384 the first version of this PR did not help in serving, so its row is replaced by a kernel pair that lowers mean TTFT by 3-4% in serving.

No table has this key today, so every M bucket falls back to the heuristic tiles. Rows M 256, 512 and 4096-8192 reuse the kernel pairs from #6125, while M 64 and the pair shared by M 1024 and 2048 were tuned for this key, selected with the fused_moe call SGLang makes for this model, with shared-expert routing and CUDA graphs. #6433 adds rows for the same key (including M 256), so the two sets should be merged into one PR with one row per M.

Changes

  • aiter/configs/model_configs/dsv41_fp8_tuned_fmoe.csv: 9 rows (M 64, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768). M 16384 and 32768 use flydsl_moe1_afp8_wfp4_bf16_t64x128x256_w4_bnt0_gui with flydsl_moe2_layout_afp8_wfp4_bf16_t64x256x128_reduce_sbm64.
  • aiter/configs/model_configs/dsv41_fp8_untuned_fmoe.csv: the same 9 shapes.
  • No code change; other keys are unaffected.
  • Known gaps: the M=2048 row's timing columns (us1, us2, us, tflops, bw) repeat M=1024's (the kernel pair is shared on purpose); the M 16384 and 32768 rows leave tflops and bw at 0. Their us columns come from a one-GPU study with routing calibrated from a served expert histogram, so they are not comparable with the tuner timings of the other rows.

Performance (if applicable)

Hardware Workload/configuration Before After Change
MI355X (gfx950) fused_moe A8W4 for DeepSeek-V4.1-Flash TP4, M 768-8192 heuristic tiles tuned rows 0.90-0.98x MoE time
MI355X (gfx950) same, M 64-512 heuristic tiles tuned rows 0.89-0.93x MoE time
MI355X (gfx950) fused_moe stage 2 at M 16384, routing calibrated from a served expert histogram heuristic stage 2: 934 us this row's stage 2 with AITER_FLYDSL_STAGE2_FP8=1: 617 us -34% stage 2
4 x MI355X SGLang serving, DeepSeek-V4.1-Flash TP4, book prompts at 7 concurrencies, AITER_FLYDSL_STAGE2_FP8=1 in both arms, no speculative decoding / DSpark heuristic at M 16384 / 32768 M 16384 + 32768 rows mean TTFT -4.41% / -2.97%
4 x MI355X same, rows + FP8 route against neither, no speculative decoding / DSpark heuristic, BF16 route rows, FP8 route throughput +0.91% / +2.16%; mean TTFT -3.14% / -3.19%

Serving numbers are geomeans over the 7 concurrencies of single runs per arm, on a ROCm SGLang image of 2026-10-29 with #6170 applied. The first version's M 16384 row did not clear a 16k-prompt serving check (two A-B-B-A runs: +19.1% / +14.2%, then +4.1% within a 14.0% base spread), which is why it is replaced.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

The M 64-8192 rows produced no NaN and had the same 0.032-0.035 worst-row relative-L2 range as the heuristic against a bf16-intermediate reference. The M 64, 256 and 512 rows hit an async stage-1 race without #6170 (1-10 bad runs out of 192), as do the heuristic's own stage-1 kernels (7/192 at M 12288, 5/192 at 16384); with #6170, every tested point from M 64 through 1024 gave 0/192. For the M 16384 and 32768 rows, AITER's using 2stage (kernelName1=..., kernelName2=...) log line showed both kernels in every serving run. Accuracy with these rows and the FP8 route: GSM8K 97.11 -> 96.42 (no speculative decoding) and 97.26 -> 96.58 (DSpark), GPQA (3 runs, DSpark) mean 88.38 vs 88.89 (one question). The FP8 route itself costs about 0.5 GSM8K points (96.71 vs 97.17 over 4 runs each, rows in both arms). Only gfx950 is targeted, so MI250X and MI300X do not apply.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Tuned-config rows only.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Merge after #6170 (stage-1 race fix). The M 16384 and 32768 rows were measured on AITER with #6170 applied; our serving image, which also carries #7918, uses the _xcd1 variant of the same stage-1 kernel.

Breaking Changes

None.

PR Self-Review

Reviewed revision

628a5fb57e724634f56ec9ab6571d2f97dd15c86

Behavior and intent

The listed M buckets of this key use the tuned kernel pairs instead of the heuristic tiles; the M 16384 and 32768 buckets use the stage-2 layout reduce kernel, which writes FP8 route rows when AITER_FLYDSL_STAGE2_FP8=1. Other keys are unchanged.

Validation and unverified scope

Kernel timing, NaN and L2 checks on MI355X, and serving runs, as above. Not verified: the M 16384 and 32768 rows on current main (measured on an older AITER with #6170), the same rows without AITER_FLYDSL_STAGE2_FP8=1, and the M=2048 timing columns.

PR-specific question

There is no automated PR Self-Review comment on this PR yet.

Changed op tests

None.

@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: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: 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 6363 --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.

@amd-pedghazi
amd-pedghazi requested a review from valarLip November 9, 2026 12:19
@amd-pedghazi amd-pedghazi changed the title [AMD] Add DeepSeek-V4.1-Flash TP4 A8W4 MoE rows (E385, top-7) [Config] [Perf] Add DeepSeek-V4.1-Flash TP4 A8W4 MoE rows for gfx950 (E385, top-7) Nov 10, 2026
@amd-pedghazi

Copy link
Copy Markdown
Contributor Author

Closing this draft. The small-M rows gave no serving gain: SGLang prefills DeepSeek-V4.1-Flash in 16k-token chunks, which AITER pads to M 16384, so prefill never looks up the rows from M 64 to 8192, and in our serving tests the tuned small-M rows changed throughput by only +0.06 to +0.18%. The useful buckets are covered elsewhere: #8213 has the 16384 and 32768 rows (the same tile pair as here, with the XCD-remap stage 1), #8051 adds 4096, 8192 and 16384, and rows for 512 to 2048 tokens will come in a new PR with new measurements.

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.

1 participant