Skip to content

[Config] [gfx942] Qwen3.8-Flash-Next BF16 TP4 FlyDSL MoE rows for 304 CUs - #8064

Merged
JohnNikolay84 merged 1 commit into
ROCm:mainfrom
frida-andersson:qwen38-flash-next-bf16-flydsl-moe-304cu
Nov 19, 2026
Merged

JohnNikolay84 merged 1 commit into
ROCm:mainfrom
frida-andersson:qwen38-flash-next-bf16-flydsl-moe-304cu

Conversation

@frida-andersson

@frida-andersson frida-andersson commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add gfx942 / cu_num=304 (MI325X) rows to aiter/configs/model_configs/qwen38_flash_next_bf16_tuned_fmoe.csv for Qwen3.8-Flash-Next BF16 TP4 with the shared expert fused into the MoE (VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1): key (2560, 192, 513, 11, Silu, bf16, bf16, bf16, QuantType.No, use_g1u1=1, doweight_stage1=0). The rows select the gfx942 FlyDSL whole-graph MoE at M = 1, 2, 4 and 8.

Motivation

The file has gfx942 rows for 80 CUs only, so on MI325X every M of this key logs using 2stage default. On 4x MI325X, TP4, the rows raise output throughput by 3.1–11.0% at concurrency 1 (1K to 128K input) and 2.9–4.4% at concurrency 2, and leave concurrency 8 and 32 unchanged.

Changes

  • qwen38_flash_next_bf16_tuned_fmoe.csv: +4 rows, all gfx942, cu_num=304, appended as one block; no existing row changed.
    • M = 1: impl__flydsl_gfx942__16_16_16_False (the single-token path).
    • M = 2, 4, 8: impl__flydsl_gfx942__16_16_16_False_True.
    • Other get_padded_M buckets stay on the default: from M = 16 up, every FlyDSL candidate was 5–34% slower.

How the rows were chosen: gemm_moe_tune.py --mp 1 --errRatio 0.05 --e2e_tune, one tuner per GPU over the 16 buckets.

Performance (if applicable)

Kernel level, a separate --e2e_tune pass against the 2-stage default (empty tuned file), MI325X, one GPU, one run per bucket. The CSV us column is the time the selection tune recorded for the same kernels (13.84 / 21.11 / 35.33 / 61.48 µs). For M = 1, 2 and 4 that run's baseline was the earlier CK table, so those numbers are not a comparison to the default. Same timer, two runs: the FlyDSL times differ by at most about 3%, and the ranking is unchanged. The speedups below are from this pass.

Hardware M Default (µs) These rows (µs) Speedup
MI325X 1 36.89 13.80 2.67x
MI325X 2 40.52 20.60 1.97x
MI325X 4 47.13 34.26 1.38x
MI325X 8 66.19 61.40 1.08x

The selected configs are within 0.01% of the reference.

End to end: Qwen/Qwen3.8-Flash-Next BF16, TP4, 4x MI325X, vLLM with stock AITER modules in both arms; the PR arm adds these rows. With MTP-3 a decode step runs M = 4 at concurrency 1 and M = 8 at concurrency 2, so the rows apply there; at concurrency 8 and 32 decode runs M ≥ 32, where no row applies. Each value is the median of 4 runs per arm (8 at 8K / 32).

Change, these rows against the default:

Hardware Input Conc Output tok/s Mean E2E Mean TPOT
4x MI325X 1K 1 +11.0% −9.9% −10.2%
4x MI325X 8K 1 +8.7% −8.0% −10.1%
4x MI325X 32K 1 +6.4% −6.0% −10.2%
4x MI325X 128K 1 +3.1% −3.0% −10.4%
4x MI325X 1K 2 +4.4% −4.1% −4.2%
4x MI325X 8K 2 +2.9% −2.7% −1.8%
4x MI325X 1K 8 −0.2% +0.3% +0.3%
4x MI325X 8K 8 −0.4% +0.5% +0.4%
4x MI325X 1K 32 +1.2% −1.2% −1.4%
4x MI325X 8K 32 +0.2% −0.2% +0.0%

At concurrency 1 (all four input lengths) and at 1K / 2, each run with the rows is faster than each run without, e.g. 397–402 vs 360–362 tok/s at 1K / 1. At 8K / 2 three of four runs are faster (471–473 vs 458–460 tok/s; the fourth is 450). At concurrency 8 and 32 the runs overlap. Time per output token drops about 10% at concurrency 1 for every input length; the throughput gain is smaller at long input because prefill takes a larger share of each request.

Full end-to-end results
Input Conc Arm Output tok/s Mean TTFT (ms) Mean TPOT (ms) Mean E2E (ms)
1K 1 Default 360.76 110.81 2.67 2838.19
1K 1 Rows 400.29 109.98 2.39 2557.94
1K 1 Δ +11.0% −0.8% −10.2% −9.9%
8K 1 Default 302.12 567.67 2.76 3389.13
8K 1 Rows 328.48 574.25 2.48 3117.21
8K 1 Δ +8.7% +1.2% −10.1% −8.0%
1K 8 Default 1602.18 286.94 4.70 5094.81
1K 8 Rows 1598.89 288.93 4.71 5109.04
1K 8 Δ −0.2% +0.7% +0.3% +0.3%
8K 8 Default 896.22 1336.95 7.59 9105.89
8K 8 Rows 892.91 1351.48 7.62 9148.26
8K 8 Δ −0.4% +1.1% +0.4% +0.5%
1K 32 Default 2996.77 716.45 9.93 10883.60
1K 32 Rows 3033.19 723.45 9.80 10753.56
1K 32 Δ +1.2% +1.0% −1.4% −1.2%
8K 32 Default 1236.17 3641.17 22.40 26449.73
8K 32 Rows 1238.14 3572.91 22.41 26405.67
8K 32 Δ +0.2% −1.9% +0.0% −0.2%
1K 2 Default 590.52 130.34 3.25 3452.17
1K 2 Rows 616.69 128.31 3.11 3311.27
1K 2 Δ +4.4% −1.6% −4.2% −4.1%
8K 2 Default 458.37 717.49 3.66 4456.37
8K 2 Rows 471.54 716.46 3.59 4334.29
8K 2 Δ +2.9% −0.1% −1.8% −2.7%
32K 1 Default 204.35 2168.52 2.78 5010.93
32K 1 Rows 217.33 2157.44 2.50 4711.50
32K 1 Δ +6.4% −0.5% −10.2% −6.0%
128K 1 Default 87.43 8753.74 2.87 11711.58
128K 1 Rows 90.18 8719.34 2.57 11354.72
128K 1 Δ +3.1% −0.4% −10.4% −3.0%
Setup

vLLM 0.34.0rc1.dev206+gf5d93296c + vllm-project/vllm#66784, AITER 0.1.29. VLLM_ROCM_USE_AITER=1, VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1, AITER_CUSTOM_AR_DISABLE_LAMPORT=1; the PR arm sets AITER_CONFIG_FMOE to a file holding these 4 rows. MTP-3 with synthetic acceptance (both arms decode the same tokens per step), random prompts with 1,024 output tokens. Two server starts per arm, alternating, order reversed in the second round; two seeds per start (four at 8K / 32), the same in both arms. Concurrency 2 and the 32K / 128K points come from a second run with the same protocol. Both arms' server logs show the expected selection (using 'impl__flydsl_gfx942…' for M = 1, 2, 4, 8 in the PR arm only).

Accuracy, standard MTP-3, same build and env: GSM8K 5-shot 0.9666 strict / 0.9674 flexible with the rows vs 0.9666 / 0.9666 without (±0.005).

Testing

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

Tested on MI325X (gfx942, 304 CUs), not MI300X; no unit tests apply to a config-only change. python3 -m unittest op_tests.tuning_tests.test_config_shape_collision: 33 tests OK on this branch (main at 91eecd523 + this commit).

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

Breaking Changes

None. Only new gfx942 / 304-CU keys; other architectures and CU counts resolve exactly as before.

PR Self-Review

Reviewed revision

105c577eb

Behavior and intent

On MI325X with shared-expert fusion, Qwen3.8-Flash-Next BF16 TP4 MoE calls at M ≤ 8 use the gfx942 FlyDSL whole-graph MoE instead of the 2-stage default. Other M are unchanged.

Validation and unverified scope

python3 -m unittest op_tests.tuning_tests.test_config_shape_collision: 33 tests OK on this branch (main at 91eecd523 + this commit). Kernel timings and end-to-end serving on MI325X are in the tables above. GSM8K 5-shot is 0.9666 strict / 0.9674 flexible with the rows, against 0.9666 / 0.9666 without.

Unverified: MI300X (same CU count), and the unfused key (512 experts, top-10).

PR-specific question

These rows are stored at M = 1, 2, 4 and 8 for (gfx942, cu_num=304, M, 2560, 192, 513, 11, Silu, bf16, bf16, bf16, QuantType.No, use_g1u1=1, doweight_stage1=0). That is Qwen3.8-Flash-Next BF16 TP4 with the shared expert fused in. Below 32768 the lookup uses the next power of two, so M = 3 also selects the M = 4 row and M = 5, 6 and 7 select the M = 8 row.

get_2stage_cfgs matches the whole tuple, including cu_num and inter_dim, and a miss still takes the 2-stage default. The four rows are appended and no existing row changes, so the gfx942 80-CU rows select as before. Other M of this key have no 304-CU row. The token fallback only runs for M above 32768 and only tries 32768 and smaller tiers of the same key, so M = 1 to 8 are never a fallback target. inter_dim 320 and 640 have no 304-CU row. Other architectures, and the unfused key (512 experts, top-10), are not in the diff. In the serve A/B the PR arm logged the FlyDSL kernel only for M = 1, 2, 4 and 8.

Changed op tests

None.

Add gfx942 / cu_num=304 (MI325X) rows to
model_configs/qwen38_flash_next_bf16_tuned_fmoe.csv for the
shared-expert-fused key (2560, 192, 513, 11, Silu, bf16, No). The file
had rows for 80 CUs only, so on MI325X every M took the 2-stage default.

Four rows, M = 1, 2, 4 and 8, all on the gfx942 FlyDSL whole-graph MoE
(impl__flydsl_gfx942, 16x16x16 tiles), from gemm_moe_tune.py --e2e_tune.
From M = 16 up the FlyDSL candidates were slower than the CK kernels, so
those buckets keep the default. The FlyDSL path needs no extra module.

Signed-off-by: Frida Andersson <[email protected]>
@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 8064 --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.

@msaffari-amd

Copy link
Copy Markdown
Contributor

Nit: the kernel-level table in the description (M=1/2/4/8: 13.80 / 20.60 / 34.26 / 61.40 µs) doesn't quite match the us column of the four new CSV rows (13.84 / 21.11 / 35.33 / 61.48 µs). M=2 and M=4 differ by about 2.5–3%. It might be worth a sentence saying whether the table is a separate re-measurement or the tuner's own numbers, so readers know which to trust.

@msaffari-amd

Copy link
Copy Markdown
Contributor

A follow-up question, not blocking: the file has gfx942 rows for inter_dim 320 and 640 at 80 CUs, but this PR adds 304-CU rows only for inter_dim 192. Are 304-CU rows for 320 and 640 (the TP2 and TP1 shapes) planned for a later PR? As far as I can tell from the CSV, those shapes have no 304-CU row and would use the 2-stage default on MI325X.

@frida-andersson

frida-andersson commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@msaffari-amd good catch, thanks. The table and the CSV us column come from two different --e2e_tune runs, and I should have said so in the description

The CSV values (13.84 / 21.11 / 35.33 / 61.48) are from the selection run, which picked these four kernels. That run's baseline for M = 1, 2 and 4 was our earlier CK table, not the 2-stage default. M = 8 had no CK row, so its baseline was the default

The table is a later pass with an empty tuned file, so every baseline is the 2-stage default: 36.89 → 13.80, 40.52 → 20.60, 47.13 → 34.26, 66.19 → 61.40. The kernels and their order are the same. The FlyDSL times move by at most about 3% between runs (M = 4 is the largest gap), and the speedups in the table are against the default. I added a line to the description to say this

@frida-andersson

frida-andersson commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@msaffari-amd not in this PR. It only adds rows for inter_dim 192, which is the TP4 shape: the 640 intermediate split four ways is 160, and vLLM pads that to 192 for the CK alignment.

TP1 (inter_dim 640) and TP2 (inter_dim 320, which vLLM pads to 384 at runtime) don't have 304-CU rows. On MI325X they take the 2-stage default today. We haven't tuned those shapes, so I don't have numbers for them yet. If we want those rows, they should go in a separate PR with their own tuning and measurements.

@msaffari-amd

Copy link
Copy Markdown
Contributor

Thanks.
LGTM.

@frida-andersson
frida-andersson marked this pull request as ready for review November 18, 2026 14:41
@frida-andersson
frida-andersson requested a review from a team November 18, 2026 14:41
@github-actions github-actions Bot changed the title [Config][gfx942] Qwen3.8-Flash-Next BF16 TP4 FlyDSL MoE rows for 304 CUs [Config] [gfx942] Qwen3.8-Flash-Next BF16 TP4 FlyDSL MoE rows for 304 CUs Nov 18, 2026
@aiter-bot

aiter-bot commented Nov 18, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 105c577eb592 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

On MI325X with shared-expert fusion, Qwen3.8-Flash-Next BF16 TP4 MoE calls at M ≤ 8 use the gfx942 FlyDSL whole-graph MoE instead of the 2-stage default. Other M are unchanged.

Validation and unverified scope

`python3 -m unittest op_tests.tuning_tests.test_config_shape_collision`: 33 tests OK on this branch (`main` at `91eecd523` + this commit). Kernel timings and end-to-end serving on MI325X are in the tables above. GSM8K 5-shot is 0.9666 strict / 0.9674 flexible with the rows, against 0.9666 / 0.9666 without.

Unverified: MI300X (same CU count), and the unfused key (512 experts, top-10).

PR-specific question

These rows are stored at M = 1, 2, 4 and 8 for `(gfx942, cu_num=304, M, 2560, 192, 513, 11, Silu, bf16, bf16, bf16, QuantType.No, use_g1u1=1, doweight_stage1=0)`. That is Qwen3.8-Flash-Next BF16 TP4 with the shared expert fused in. Below 32768 the lookup uses the next power of two, so M = 3 also selects the M = 4 row and M = 5, 6 and 7 select the M = 8 row.

`get_2stage_cfgs` matches the whole tuple, including `cu_num` and `inter_dim`, and a miss still takes the 2-stage default. The four rows are appended and no existing row changes, so the gfx942 80-CU rows select as before. Other M of this key have no 304-CU row. The token fallback only runs for M above 32768 and only tries 32768 and smaller tiers of the same key, so M = 1 to 8 are never a fallback target. `inter_dim` 320 and 640 have no 304-CU row. Other architectures, and the unfused key (512 experts, top-10), are not in the diff. In the serve A/B the PR arm logged the FlyDSL kernel only for M = 1, 2, 4 and 8.

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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

@yifehuan yifehuan 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.

LGTM

@JohnNikolay84
JohnNikolay84 merged commit f068621 into ROCm:main Nov 19, 2026
zufayu added a commit that referenced this pull request Nov 23, 2026
)

_iter_csv_cases selects every tuned row whose kernelName1 contains
"flydsl_" and runs it under FLYDSL_RUNTIME_RUN_ONLY=1. The AOT replay in
aiter/aot/flydsl/moe.py prebuilds only rows whose kernelName1 starts with
"flydsl_" or "cktile_", so it skips the whole-graph impl__flydsl_gfx942__
rows. #8064 added the first such rows for 304 CUs. On MI300X the first of
them fails with "FLYDSL_RUNTIME_RUN_ONLY=1 but no usable AOT cache for
launch_batch1".

Let those rows compile on demand, as the targeted and SiTUv2 cases
already do. They still run and are still compared with the reference.

Co-authored-by: Jin Pan <[email protected]>
frida-andersson added a commit to frida-andersson/aiter that referenced this pull request Nov 25, 2026
- Down picks TILE_K 32 for BF16 when either the stored or the valid K is
  not a multiple of 64, so 128 valid of 160 stored compiles.
- Split-K and batch-1 Gate/Up assert that their N blocks stay inside the
  weight rows, and Config.unsupported_reason rejects such a tile, so
  unpadded inter_dim 160 on 16_128_64 fails by name instead of returning
  wrong output, and the tuner skips it.
- Key the existing lookup dicts on intermediate_pad (0 when missing)
  instead of a separate padded dict, so padded rows get the same duplicate
  handling and activation-disabled fallback.
- The duplicate-shape check treats a blank intermediate_pad as 0, as the
  lookup does.
- Pad-32 rows for M = 1, 2, 4, 8 with the ROCm#8064 tiles, so the AOT build
  compiles the kernels pad 32 runs at those sizes.
- Docstrings no longer say the padded tail is never read.
- Tests for the above; drop the assert that the shipped tables have no
  unpadded FlyDSL row for M = 16 to 256.

Signed-off-by: Frida Andersson <[email protected]>
frida-andersson added a commit to frida-andersson/aiter that referenced this pull request Nov 25, 2026
…SL MoE

Qwen3.8-Flash-Next at TP4 has 160 intermediate columns per rank, stored
as 192. The gfx942 FlyDSL BF16 MoE computed and read the 32 zero columns
at the end of each Gate/Up half and of Down's K.

With intermediate_pad set, the split-K and batch-1 kernels now launch
Gate/Up only over the valid columns, and Down stops its K loop there
(TILE_K 32 for BF16 when the stored or valid width is not a multiple of
64). Split-K and batch-1 Gate/Up assert that their N blocks stay inside
the weight rows, and Config.unsupported_reason rejects a tile that would
not, so the tuner skips it. Configs that cannot skip the tail (the
prefill kernels, FP8 weights) compute a tail under 64 columns, as CK
does, so rows tuned without a pad keep their kernels; a wider tail still
falls back to CK. Without a pad the kernels and their cache keys are
unchanged.

The default fmoe table is keyed on an optional intermediate_pad column
(0 when missing or blank), read by aiter.moev2.dispatch.tuned for both
the legacy lookup and moev2. A row with a nonzero pad only matches calls
with that pad and is tried first; rows with 0 match any pad, as before.
The moev2 FlyDSL whole-graph row check takes the pad the same way as the
legacy one. The duplicate-shape check treats a blank pad as 0.

Add pad-32 rows for the Qwen3.8-Flash-Next BF16 TP4 key on gfx942 /
304 CUs at M = 1 to 256: the ROCm#8064 tiles at M = 1 to 8, so the AOT build
compiles the kernels pad 32 runs, and 16_16_16_False at M = 16 to 256,
which is 10-13% faster than CK with the pad and within 3.4% of it
without.

Signed-off-by: Frida Andersson <[email protected]>
frida-andersson added a commit to frida-andersson/aiter that referenced this pull request Dec 1, 2026
…SL MoE

Qwen3.8-Flash-Next at TP4 has 160 intermediate columns per rank, stored
as 192. The gfx942 FlyDSL BF16 MoE computed and read the 32 zero columns
at the end of each Gate/Up half and of Down's K.

With intermediate_pad set, the split-K and batch-1 kernels now launch
Gate/Up only over the valid columns, and Down stops its K loop there
(TILE_K 32 for BF16 when the stored or valid width is not a multiple of
64). Split-K and batch-1 Gate/Up assert that their N blocks stay inside
the weight rows, and Config.unsupported_reason rejects a tile that would
not, so the tuner skips it. Configs that cannot skip the tail (the
prefill kernels, FP8 weights) compute a tail under 64 columns, as CK
does, so rows tuned without a pad keep their kernels; a wider tail still
falls back to CK. Without a pad the kernels and their cache keys are
unchanged.

The default fmoe table is keyed on an optional intermediate_pad column
(0 when missing or blank), read by aiter.moev2.dispatch.tuned for both
the legacy lookup and moev2. A row with a nonzero pad only matches calls
with that pad and is tried first; rows with 0 match any pad, as before.
The moev2 FlyDSL whole-graph row check takes the pad the same way as the
legacy one. The duplicate-shape check treats a blank pad as 0.

Add pad-32 rows for the Qwen3.8-Flash-Next BF16 TP4 key on gfx942 /
304 CUs at M = 1 to 256: the ROCm#8064 tiles at M = 1 to 8, so the AOT build
compiles the kernels pad 32 runs, and 16_16_16_False at M = 16 to 256,
which is 10-13% faster than CK with the pad and within 3.4% of it
without.

Signed-off-by: Frida Andersson <[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.

6 participants