Repository navigation
[Config] [DSv4.1] gfx950 FP8 fused_moe: retune TP4 prefill rows (token 4096-16384) - #7656
Conversation
The shipped rows for tokens 4096-16384 were picked under the v2 tuner's balanced routing, where each expert gets exactly token*topk/E rows and a block_m of that size has no padding tile. With real routing (dumped from a DSv4.1 Flash TP4 server) those rows are 6-16% slower than bm64 pairs already in this table. Op time, median over real routings: 4096 (draft 8192 pair) 789 -> 709 us 8192 (target 32768 pair) 1204 -> 1026 us 16384 (target 32768 pair) 2027 -> 1706 us and 2-12% faster across each bucket (M 2100-12500). Output is bit-identical to the current rows.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
5ff2496 to
ee734c9
Compare
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 |
) The shipped rows for tokens 4096-16384 were picked under the v2 tuner's balanced routing, where each expert gets exactly token*topk/E rows and a block_m of that size has no padding tile. With real routing (dumped from a DSv4.1 Flash TP4 server) those rows are 6-16% slower than bm64 pairs already in this table. Op time, median over real routings: 4096 (draft 8192 pair) 789 -> 709 us 8192 (target 32768 pair) 1204 -> 1026 us 16384 (target 32768 pair) 2027 -> 1706 us and 2-12% faster across each bucket (M 2100-12500). Output is bit-identical to the current rows.
Summary
Replaces three rows of
aiter/configs/model_configs/dsv41_fp8_tuned_fmoe.csv(DeepSeek-V4.1-Flash target MoE, TP4: E=384, topk=6, inter_dim=640, FP8 activations, FP4 weights) for the 4096, 8192 and 16384 token buckets. Each new row reuses a bm64 kernel pair that is already in this table. On MI355X this gives 2-3% higher prefill throughput when serving DeepSeek-V4.1-Flash TP4, and the output is bit-identical to the current rows.Motivation
The rows from #6125 for these buckets were picked by the v2 (FlyDSL mxfp4) tuner, which builds its routing with
balanced_score: every expert gets exactlytoken * topk / Erows. At a power-of-two token count that is itself a block_m candidate (8192 * 6 / 384 = 128), so the bm128 kernels run with no padding tile and win. Real routing never lines up like that. I replayedtopk_ids/topk_weightsdumped from a live vLLM server through the op. Real routing is within about 3% oftorch.randnrouting, even for layers where one expert takes most of the tokens. Under real routing the bm128 picks are 10-16% slower than bm64 pairs already in the table. The tuner itself is fixed in a separate PR.Changes
t64x256x256_w2_gui_fp8/layout_t64x256x128_reduce_nt_sbm64t64x128x256_w2_bnt0_gui_fp8/layout_t64x256x128_reduce_sbm64(the pair from the E=128 row at token 8192)t128x128x256_w2_gui_fp8/layout_t64x256x128_reduce_sbm128t64x128x256_w4_bnt0_gui_xcd4_fp8/layout_t64x256x128_reduce_sbm64(the pair from the E=384 row at token 32768)t128x256x256_w2_bnt0_gui_fp8/layout_t64x256x128_reduce_sbm128t64x256x256_w4_bnt0_gui_xcd4_fp8, but at inter_dim=640 tile_n=256 is forced down to 128 ("tile=256 is NOT usable/tunable"). The new rows name the tile that actually runs,t64x128x256_w4_bnt0_gui_xcd4_fp8, which compiles to the same kernel symbol (mfma_moe1_silu_mul_afp8_wfp4_fp8_t64x128x256_pm1_fp8q_sort_async_gui_xcd4_v2out_v33).us1/us2/errare left empty andusis the measured op time under real routing.Performance
Op time,
fused_moe2-stage (quant+sort, stage 1, stage 2, reduction). MI355X, one GPU, real DeepSeek-V4.1-Flash layer activations and routing. Median over three dumped routings (with three repeats for the 4096 bucket), measured after a 512 MiB L2/MALL flush.End to end, vLLM serving DeepSeek-V4.1-Flash TP4 on 4x MI355X. The flags are
--block-size 64 --max-num-batched-tokens 16384 --monokernel --moe-backend aiter --kv-cache-dtype fp8, DSpark k=5 speculative decoding,VLLM_ROCM_USE_AITER_MOE=1, andvllm bench serverandom dataset with range ratio 0.8. Total token throughput is the mean of four paired runs: both GPU sets, both arm orders.Decode TPOT (8k/1k, 60k/600) is unchanged within run-to-run noise. Those buckets don't use these rows.
Testing
The table only applies to gfx950. Each new pair was checked against the current row on the same inputs: relative error is 0, i.e. bit-identical output, since both old and new rows use the
reducestage-2 variant. During serving, the[fused_moe] using 2stagelog lines show the new kernels selected for 4096, 8192 and 16384.Accuracy on 4x MI355X, DeepSeek-V4.1-Flash TP4 (
--moe-backend aiter --max-num-batched-tokens 16384, lm_eval 0.4.13). Before is this branch withAITER_CONFIG_FMOEpointing at main'sdsv41_fp8_tuned_fmoe.csv, after is this branch:Per sample, gsm8k has 39 questions only before got right and 40 only after got right. That is run-to-run serving nondeterminism, not a bias.
Documentation
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
cd6d84a
Behavior and intent
The DSv4.1 FP8 TP4 target MoE at token buckets 4096, 8192 and 16384 now dispatches bm64 kernel pairs instead of the current bm64 / bm128 picks. The current picks were tuned under perfectly balanced routing, which over-rates block_m equal to
token * topk / E.Validation and unverified scope
rocm_aiter_fused_moe(8k random prompts plus four natural-text prompts) and replayed throughfused_moewithAITER_CONFIG_FMOEset to a one-row CSV per candidate. Results are in the op-time table above; each new pair's output was compared with the current row on the same inputs (relative error 0, bit-identical).AITER_CONFIG_FMOEat the default merge list with this file swapped in (vllm bench serve, flags above); the[fused_moe] using 2stagelog lines show the new kernels selected for 4096, 8192 and 16384. Accuracy:lm_evalgsm8k 5-shot andniah_single_232k/64k, table above.inter_dimtables.PR-specific question
Exactly three lookup keys consume the change, all in
aiter/configs/model_configs/dsv41_fp8_tuned_fmoe.csv. The key columns aregfx,cu_num,token,model_dim,inter_dim,expert,topk,act_type,dtype,q_dtype_a,q_dtype_w,q_type,use_g1u1,doweight_stage1, and the changed rows are:gfx950,256,{4096,8192,16384},5120,640,384,6,ActivationType.Silu,torch.bfloat16,torch.float8_e4m3fn,torch.float4_e2m1fn_x2,QuantType.per_1x32,1,0That is DeepSeek-V4.1-Flash TP4 target MoE (E=384, topk=6, inter_dim=640), FP8 activations with MXFP4 weights, on gfx950 with 256 CUs, for the 4096, 8192 and 16384 token buckets.
Evidence that unrelated shapes keep their selection:
dsv41_fp4_tuned_fmoe.csv, whose rows haveq_dtype_a=torch.float4_e2m1fn_x2, a different key, and it is not modified.Changed op tests
None. No
op_tests/file changes; this PR only edits tuned-config rows.