Repository navigation
[Config] [gfx942] Qwen3.8-Flash-Next BF16 TP4 FlyDSL MoE rows for 304 CUs - #8064
Conversation
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]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
|
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 |
|
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. |
|
@msaffari-amd good catch, thanks. The table and the CSV 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 |
|
@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. |
|
Thanks. |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
) _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]>
- 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]>
…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]>
…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]>
Summary
Add gfx942 /
cu_num=304(MI325X) rows toaiter/configs/model_configs/qwen38_flash_next_bf16_tuned_fmoe.csvfor 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, allgfx942,cu_num=304, appended as one block; no existing row changed.impl__flydsl_gfx942__16_16_16_False(the single-token path).impl__flydsl_gfx942__16_16_16_False_True.get_padded_Mbuckets 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_tunepass against the 2-stage default (empty tuned file), MI325X, one GPU, one run per bucket. The CSVuscolumn 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.The selected configs are within 0.01% of the reference.
End to end:
Qwen/Qwen3.8-Flash-NextBF16, 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:
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
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 setsAITER_CONFIG_FMOEto 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
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 (mainat91eecd523+ this commit).Documentation
Tuned-config rows only.
Dependencies
Breaking Changes
None. Only new gfx942 / 304-CU keys; other architectures and CU counts resolve exactly as before.
PR Self-Review
Reviewed revision
105c577ebBehavior 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 (mainat91eecd523+ 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_cfgsmatches the whole tuple, includingcu_numandinter_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_dim320 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.