Repository navigation
[Config] [MoE] Qwen3.8-Flash-Next MXFP4: FlyDSL rows at M=32768 for inter_dim 384/256/640 - #8867
mjkvaak-amd wants to merge 1 commit into
Conversation
…ter_dim 384/256/640 The Flash-Next MXFP4 MoE rows stop at M=16384, and get_2stage_cfgs only falls back to a lower tier above 32768 tokens, so batches of 16385..32768 tokens (reached with max_num_batched_tokens > 16384) ran the heuristic FlyDSL default. Add tuned FlyDSL 2-stage rows at M=32768 for TP2 (384, intermediate_pad 64), TP4 (256, pad 64) and TP1 (640), tuned with gemm_moe_tune.py --mxfp4-flydsl. Co-authored-by: Cursor <[email protected]> Signed-off-by: Mikko Tukiainen <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
DRAFT — evaluation pausedPR Self-ReviewRevision This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes. |
Summary
Adds tuned FlyDSL 2-stage rows at M=32768 for the Qwen3.8-Flash-Next MXFP4 MoE in the shapes vLLM passes at TP2 (
inter_dim=384,intermediate_pad=64), TP4 (inter_dim=256, pad 64) and TP1 (inter_dim=640). These rows serve prefill batches of 16385–32768 tokens, which happen whenever--max-num-batched-tokensis above 16384. Against main, TP2 serving at--max-num-batched-tokens 32768gains +5.1% output throughput on 60k and 128k prompts and +1.5% on 8k prompts.Motivation
#8123 added rows up to M=16384.
get_padded_Mbuckets 16385..32768 tokens to 32768, andget_2stage_cfgsonly falls back to a lower tier above 32768. As a result, this bucket gets no tuned row and no fallback: main logsusing 2stage defaultand runs the heuristic FlyDSL kernel, which is 1.6–1.7× slower than the tuned pair (table below). vLLM's defaultmax_num_batched_tokenson MI355X is 16384, so the bucket is reached only when that is raised. That is common for long-context serving.Not a duplicate: I searched open PRs for Qwen3.8-Flash-Next,
2560,384,2560,256,2560,640and32768. #8044 adds ASM producer rows at M=32768 for 384 and 640, but not 256. Those producers are about 5–8% faster than these rows at that size, and end to end they lead by about 1% on long prompts. With both PRs' rows,test_config_shape_collision.py::test_fmoefails on those two keys. Whichever PR lands second drops them; if #8044 lands first, this PR shrinks to the inter 256 row.Changes
aiter/configs/model_configs/qwen3_8_flash_fp4_tuned_fmoe.csvandqwen3_8_flash_fp4_untuned_fmoe.csv: one row per inter_dim at M=32768. They were tuned withgemm_moe_tune.py --mxfp4-flydsl(with [CK] [Tune][MoE] Clear inherited rocprofiler env before the MXFP4 FlyDSL tuner spawns shape workers #8121's fix) on MI355X, and theuscolumn is the tuner's. Winners:flydsl_mxmoe_g1_a4w4_128x256x256_xcd2+flydsl_moe2_layout_afp4_wfp4_bf16_t128x256x128_scatter_sbm128flydsl_mxmoe_g1_a4w4_128x256x256_xcd4+flydsl_moe2_layout_afp4_wfp4_bf16_t128x256x256_scatter_nt_sbm128flydsl_mxmoe_g1_a4w4_128x256x256_xcd2+flydsl_moe2_layout_afp4_wfp4_bf16_t128x256x128_scatter_sbm128All three are BM128 and not inline-sort, so the padding rejection in
_mxfp4_inline_sort_unsupporteddoes not apply. Batches of up to 16384 tokens keep #8123's rows. Decode is unaffected.Performance (if applicable)
Kernel.
fmoe_pad_bench.py(from #8123) times one wholefused_moecall with CUDA-graph replay, set up the way vLLM calls it. Weights are random bf16 at the true width (320 / 160 / 640), zero-padded to 384 / 256 the way vLLM stores them, and quantized per 1x32 to fp4x2.intermediate_padis 64 / 64 / 0, routing is uniform random throughfused_topk, andAITER_USE_FLYDSL_MOE_SORTING=1as in the server.vllm/vllm-openai-rocm:nightly-5aea30579ad672c3c35be43112b7a1f7b293a09ewith [HIP] [MoE] Qwen3.8-Flash-Next MXFP4 TP2/TP4: aux shape gates and FlyDSL rows for padded inter_dim, M>=1024 #8123's files. The after arm appends this PR's rows.AITER_LOG_MORE=1logs2stage defaultat 32768 before and this PR's kernel names after. 16384 is the control; both arms log [HIP] [MoE] Qwen3.8-Flash-Next MXFP4 TP2/TP4: aux shape gates and FlyDSL rows for padded inter_dim, M>=1024 #8123's row there.The relative L2 error against an fp32 MoE at the true width is 0.289 in both arms at every size. That is the W4A4 quantization error.
Serving, TP2. Same image, before = #8123's files, after = #8123 + this PR. Both arms are otherwise identical. They ran side by side on two GPU pairs and swapped pairs between 2 passes; each cell is the mean of the passes.
The geomeans are +1.5% output tok/s and −8.5% mean TTFT for 8k, and +5.1% and −4.4% for 60k/128k.
Accuracy, TP2. Same servers and flags, run side by side.
91% of GSM8K generations differ textually, with symmetric flips, which is churn from a kernel change. NIAH at 64k/128k runs 32k-token prefill chunks, so the new 384 row ran during it; the candidate's server log shows its kernel names at the 32768 bucket.
Testing
Documentation
Config rows only.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
905a08e
Behavior and intent
Flash-Next MXFP4 MoE calls with 16385–32768 tokens at
inter_dim384, 256 or 640 now run a tuned FlyDSL 2-stage pair. Before this PR they ran the heuristic FlyDSL default, because #8123's rows stop at 16384 andget_2stage_cfgsdoes not tier down at 32768. Every other key is unchanged.Validation and unverified scope
python3 -m pytest -q op_tests/tuning_tests/test_config_shape_collision.pypasses (34 tests), run in the image above against this branch on main 1a191f8.TRUE_INTER=320 INTER=384 PAD=64,TRUE_INTER=160 INTER=256 PAD=64andTRUE_INTER=640 INTER=640 PAD=0withTOKENS=16384,24576,32768 AITER_USE_FLYDSL_MOE_SORTING=1 python3 fmoe_pad_bench.py <tag>. It ran with and without this PR's rows in 2 GPU-swapped rounds.Remaining and unverified:
fmoe_pad_bench.py
PR-specific question
(gfx950, cu_num=256, token 32768, 2560, inter_dim 384/256/640, 513, 11, Silu, bf16, fp4x2, fp4x2, per_1x32, g1u1, doweight_stage1=0).get_padded_Mmaps 16385..32768 tokens to 32768.get_2stage_cfgsthen tries 32768, so those calls now also take this PR's row, where before they ran the heuristic. That case is not measured here. vLLM reaches it only with--max-num-batched-tokensabove 32768.(513, 2560, 512, 11)and(513, 2560, 256, 11). For 640, main already has a FlyDSL row at 16384. The kernel A/B's dispatch log shows this PR's kernel names at 32768 for all three widths.get_2stage_cfgsstill validates each MXMOE row and falls back on failure. It checks the sortblock_magainst GEMM1 BM and GEMM2, the registered aux shape, the input dtype forinline_quant, stage-2 bias, and EPexpert_mask. None of the rows is inline-sort.Changed op tests
None.
Co-authored-by: Cursor [email protected]