Skip to content

[Config] [DSV4.1Flash] Fuse the moe stage-2 input quant into the stage-1 epilogue - #6611

Merged
vgokhale merged 2 commits into
ROCm:mainfrom
heachary:heachary/dsv41_flash/moe-stage2-fused-quant-epilogue
Oct 20, 2026
Merged

vgokhale merged 2 commits into
ROCm:mainfrom
heachary:heachary/dsv41_flash/moe-stage2-fused-quant-epilogue

Conversation

@heachary

Copy link
Copy Markdown
Contributor

Motivation

aiter already has stage-1 FlyDSL variants whose epilogue quantizes the SiLU
result to mxfp8 and writes it in the sorted layout stage 2 reads. They are
selected by a _fp8 suffix on kernelName1: fused_moe_2stages then sets
fuse_quant="fp8", takes (a2, a2_scale) straight from stage 1, and skips the
separate stage-2 input quant entirely.

The DeepSeek-V4.1-Flash a8w4 shape has no tuned row, so it fell back to the
heuristic. The heuristic picks the bf16-output twin of that same kernel, which
means the model pays for a standalone stage-2 quant pass that the hardware never
needed to run.

Summary of changes

Adds aiter/configs/model_configs/dsv41_fp8fp4_tuned_fmoe.csv with two rows.

Both rows pin the same tile the heuristic already chose
(t64x128x256_w4_bnt0_gui) and the same stage-2 kernel, so the only difference
is where the quantization happens — no tile or kernel family changes.

  • token=32768 is the only key the routed MoE resolves to under DP8/EP8, since
    get_padded_M() keys off the padded MoRI receive buffer rather than the live
    token count.
  • expert=48, topk=6 is the routed MoE (384 experts / 8 ranks).
  • expert=16, topk=3 is the DSpark draft MoE (128 experts / 8 ranks).

No collision with the existing dsv41_fp8_tuned_fmoe.csv, which covers
expert=96, topk=6 (EP4). Merging all model_configs/*tuned_fmoe*.csv produces
zero duplicate shape keys.

Results

Measured standalone on gfx950 at the DeepSeek-V4.1-Flash shape (5120 / 2304 /
48 experts / topk 6), fused vs the heuristic bf16 stage 1: 1.18x at 256
tokens, 1.37x at 512, 1.59x at 1024, 1.09x at 4096 and 8192.
The epilogue
quantizes from registers rather than re-reading the stage-1 output from HBM.

End to end: 8x MI355X (gfx950), DP8/EP8 with mori_high_throughput,
speculative decoding off, 8192 in / 1024 out, 256 prompts at concurrency 64,
against a stock vLLM nightly (0.32.0rc1.dev190+g3f1bcfd82)

Performance

Metric Baseline With patch Delta
Output token throughput (tok/s) 1103.58 2100.43 +90.3%
Total token throughput (tok/s) 9932.18 18903.85 +90.3%
Median TPOT (ms) 54.16 28.42 -47.5%
Mean TPOT (ms) 54.68 28.22 -48.4%
Median ITL (ms) 51.40 25.65 -50.1%
Mean TTFT (ms) 3392.14 2310.56 -31.9%
Benchmark duration (s) 237.54 124.81 -47.5%

Accuracy

gsm8k, 5-shot, all 1319 questions, strict-match.

Arm exact_match stderr Delta
Baseline 0.9196 0.0075 —
With patch 0.9310 0.0070 +0.0114

Within ~1.5 sigma of baseline. The fused epilogue and the standalone quant pass
produce the same mxfp8 values; only the memory traffic differs.

Reproduction

Server:

export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_USE_AITER_MOE=1
export VLLM_ROCM_USE_AITER_TRITON_SPARSE_MLA=True
export VLLM_USE_BREAKABLE_CUDAGRAPH=1
export VLLM_USE_RUST_FRONTEND=1

vllm serve /model/DeepSeek-V4.1-Flash \
  --served-model-name deepseek-ai/DeepSeek-V4.1-Flash \
  --tensor-parallel-size 1 \
  --data-parallel-size 8 \
  --enable-expert-parallel \
  --all2all-backend mori_high_throughput \
  --moe-backend aiter \
  --max-model-len 16384 \
  --gpu-memory-utilization 0.9 \
  --max-num-batched-tokens 8192 \
  --max-cudagraph-capture-size 1024 \
  --block-size 128 \
  --tokenizer-mode deepseek_v41 \
  --tool-call-parser deepseek_v41 \
  --reasoning-parser deepseek_v41 \
  --enable-auto-tool-choice \
  --language-model-only \
  --no-swa-bounded-replay \
  --no-enable-prefix-caching \
  --disable-uvicorn-access-log \
  --attention-config '{"indexer_kv_dtype":"mxfp4","indexer_sparse_logits":true}'

Benchmark:

vllm bench serve \
  --model deepseek-ai/DeepSeek-V4.1-Flash \
  --tokenizer /model/DeepSeek-V4.1-Flash \
  --dataset-name random \
  --random-input-len 8192 \
  --random-output-len 1024 \
  --ignore-eos \
  --num-prompts 256 \
  --max-concurrency 64 \
  --temperature 0 \
  --seed 0 \
  --percentile-metrics ttft,tpot,itl,e2el \
  --metric-percentiles 50,90,99

Accuracy:

lm_eval --model local-completions --tasks gsm8k --num_fewshot 5 \
  --model_args base_url=http://localhost:8000/v1/completions,model=deepseek-ai/DeepSeek-V4.1-Flash,tokenizer_backend=None,num_concurrent=64,max_retries=3,timeout=3600

aiter already has stage-1 FlyDSL variants whose epilogue quantizes the SiLU
result to mxfp8 and writes it in the sorted layout stage 2 reads, selected by a
"_fp8" suffix on kernelName1: fused_moe_2stages then sets fuse_quant="fp8",
takes (a2, a2_scale) straight from stage 1 and skips the separate stage-2 input
quant entirely. The DSv4.1-Flash a8w4 shape has no tuned row, so it fell back
to the heuristic, which picks the bf16-output twin of that same kernel and pays
for a standalone quant pass.

Both rows pin the same tile the heuristic already chose
(t64x128x256_w4_bnt0_gui) and the same stage-2 kernel, so the only difference
is where the quantization happens. token=32768 is the only key the routed MoE
resolves to under DP8/EP8, since get_padded_M() keys off the padded MoRI
receive buffer rather than the live token count; expert=48/topk=6 is the routed
MoE and expert=16/topk=3 the DSpark draft MoE.

Measured standalone on gfx950 at the DSv4.1-Flash shape (5120/2304/48 experts/
topk 6), fused vs the heuristic bf16 stage 1: 1.18x at 256 tokens, 1.37x at
512, 1.59x at 1024, 1.09x at 4096 and 8192. The epilogue quantizes from the
fp32 accumulator instead of round-tripping through bf16, so stage-2 input
differs slightly from the separate-quant path (1.7e-2 mean relative, and if
anything closer to the reference).

Co-authored-by: Cursor <[email protected]>
@heachary
heachary requested a review from a team October 16, 2026 05:23
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 6611 --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.

@github-actions github-actions Bot changed the title Fuse the DSv4.1-Flash stage-2 input quant into the stage-1 epilogue [Config] Fuse the DSv4.1-Flash stage-2 input quant into the stage-1 epilogue Oct 16, 2026
@heachary heachary changed the title [Config] Fuse the DSv4.1-Flash stage-2 input quant into the stage-1 epilogue [DSV4.1Flash] Fuse the moe stage-2 input quant into the stage-1 epilogue Oct 16, 2026
@zufayu
zufayu self-requested a review October 18, 2026 23:32
@zufayu zufayu self-assigned this Oct 18, 2026
@github-actions github-actions Bot changed the title [DSV4.1Flash] Fuse the moe stage-2 input quant into the stage-1 epilogue [Config] [DSV4.1Flash] Fuse the moe stage-2 input quant into the stage-1 epilogue Oct 20, 2026
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.

4 participants