Repository navigation
configs: add DSv3-MXFP4 E=33/topk9 fused-MoE shape (shared-expert fus… - #3739
Conversation
…ion)
The existing dsv3_fp4 fused-MoE configs cover the routed-only shapes
(model_dim=7168, inter_dim=2048, expert in {32,64}, topk=8) and the
EP-sharded shapes (inter_dim in {256,512}, expert=257, topk=9). There is
no entry for model_dim=7168, inter_dim=2048, expert=33, topk=9.
That shape appears with shared-experts fusion ON: the always-on shared
expert is folded in as the 33rd grouped-GEMM expert and topk goes 8 -> 9,
so every token routes through it. With no tuned row the runtime fmoe
dispatch MISSes and falls back to the generic ck::kernel_moe_mxgemm_2lds
for BOTH stages, which is ~3x slower on stage2 than the flydsl/cktile
kernels that already exist for the neighbouring shapes.
Adds 32 rows (16 token buckets 1..32768, each a primary best-us row plus
a flydsl_fallback row) to dsv3_fp4_tuned_fmoe.csv, and the 16 matching
input rows to dsv3_fp4_untuned_fmoe.csv. The buckets are the contiguous
powers of two (1,2,4,...,32768) that the runtime's nextPow2 token padding
can request, so there is no cache-miss gap. Same FP4X2 x FP4X2 x BF16 +
per_1x32 dtype combo as the existing dsv3 rows.
Data produced by gemm_moe_tune.py end-to-end on 8x MI355X (gfx950,
cu_num=256), aiter v0.1.14-rc0-209-g6740fb791.
Signed-off-by: Rita Brugarolas Brufau <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
…moe-e33-shared-fusion
…tuned set Replace the (33,9) tuned rows with the set validated (best measured E2E) on the DeepSeek-R1 MXFP4 harness. The fused flydsl `_fp4` stage-1 was being missed by the tuner due to a fused-vs-non-fused selection bug (fixed in ROCm#3805); it is now picked at the larger token buckets. Small-token buckets intentionally keep the non-fused kernel where it benchmarked better E2E, so stage-1 is a mix of fused/non-fused by design. Non-(33,9) rows untouched (match main after ROCm#3825 dsv3-v4 retune). 16 primary + 16 flydsl_fallback rows, 26-col schema. Signed-off-by: Rita Brugarolas Brufau <[email protected]> Co-Authored-By: Claude Opus 4.8 <[email protected]>
…moe-e33-shared-fusion
|
The These are DeepSeek-R1 MXFP4 (gfx950), EP + shared-expert fusion: per rank #3377 (cc @yadaish) added an unconditional The patch attached to #3999 (convention-aware strip — only strip a column that's genuinely always-masked) is the right fix and resolves both reports. With that fix the shared column isn't stripped, the lookup keys at the real width cc: @valarLip @junhaha666 |
@rbrugaro-amd EP tuning will be redesigned in the near future. Could you use current convention to support your tuning? |
Resolve dsv3_fp4_{tuned,untuned}_fmoe.csv conflict by re-keying the E=33
shared-expert-fusion rows from topk=9 to topk=8, per the current EP
convention: get_2stage_cfgs strips one column via 'topk -= int(is_ep)'
(issue ROCm#3999 resolved as keep-convention), so the runtime looks up
(expert=33, topk=8). Keep the 16 primary rows only and drop the
flydsl_fallback rows to match upstream's now fallback-free CSV.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Rita Brugarolas Brufau <[email protected]>
|
@yadaish thanks for your review and comments, I re-keyed the CSV to 33,8 according to current upstream and also removed the flyDSL fallbacks I had to CK moe because looks like the new convention is not to have fallbacks now, is that correct? |
|
LGTM |
|
@ROCm/team_aiter can we merge? |
configs: add DSv3-MXFP4 E=33/topk9 fused-MoE shape (shared-expert fusion) — stage-1 + stage-2 tuned
Problem
The
dsv3_fp4fused-MoE configs cover the routed-expert and EP-sharded shapesbut have no entry for
model_dim=7168, inter_dim=2048, expert=33, topk=9.That shape is what DeepSeek-R1 MXFP4 produces with shared-experts fusion ON:
the always-on shared expert is folded in as the 33rd grouped-GEMM expert and
topkgoes8 -> 9, so every token routes through it. With no tuned row theruntime fused-MoE dispatch (
get_2stage_cfgs) MISSes,cfgresolves toNone,and the C++ auto-pick falls back to the generic
ck::kernel_moe_mxgemm_2ldsforboth stages.
The fast kernels already exist for the neighbouring shapes — this is a
tuning/selection gap, not a missing kernel.
What this PR adds
dsv3_fp4_tuned_fmoe.csv: +32 rows for(expert=33, topk=9)— 16 tokenbuckets (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384,
32768), each a primary best-
usrow plus aflydsl_fallbackCK row,matching the existing (32,8)/(257,9) dual-row convention. Buckets are the
contiguous powers of two the runtime's
nextPow2token padding can request, sothere is no cache-miss gap. Same
FP4X2 × FP4X2 × BF16+QuantType.per_1x32,ActivationType.Silu,use_g1u1=1,doweight_stage1=0combo and 26-columnschema (ending in
_tag) as the existing dsv3 rows.Both stages are tuned. The fused flydsl
_fp4stage-1 (quant+sort fused into thegemm1 epilogue) was being missed by the tuner due to a fused-vs-non-fused
selection bug — fixed in #3805; it shows up here at the larger
token buckets. The per-bucket selections below are the best-measured-E2E
picks: some small-token buckets intentionally use the non-fused kernel where it
benchmarked better end-to-end, so the column is a mix of fused (
_fp4) andnon-fused by design, not a uniform fused sweep.
Per-bucket primary selections (
expert=33, topk=9, model_dim=7168, inter_dim=2048, cu_num=256)(Full kernel names are in the committed CSV.
_fp4suffix = fused stage-1;others are the non-fused pick chosen for best E2E.)
End-to-end validation (standard sglang server benchmark)
Measured with the standard
sglang.bench_servingclient against asglang.launch_serverinstance configured like the production DeepSeek-R1 MXFP4deployment — TP8, attention DP=8, EP=8, MoRI-EP a2a, shared-experts fusion ON
(this (33,9) shape) — on 8×MI355X.
(
tok/s= total token throughput;ITL= median inter-token latency, i.e. theper-decode-step cost where the MoE GEMMs sit.)
Exact repro
Server (identical for before/after; only
dsv3_fp4_tuned_fmoe.csvdiffers):8×MI355X (gfx950). Full server + client logs for each point are in the run dir.
Trace showing kernel change
Before: shows stage 1 unfused followed by quant and sort

After: shows fused stage 1 followed by stage 2 moe

Accuracy (no regression)
GSM8K, 200 questions, 5-shot, same server config: