Repository navigation
[DSV4.1Flash] Bound the a8w4 MoE activation quant to the live token count - #6610
Conversation
Under EP the activation buffer handed to aiter is MoRI's dispatch receive buffer, sized for the worst case (max_num_tokens * ep_size = 32768 rows for DSv4.1-Flash at DP8/EP8) with only the dispatched rows valid. The mxfp4 quant call sites bound their work with num_rows=num_local_tokens; the two mxfp8 (a8w4) call sites did not, so per_1x32_mx_quant_hip streamed all 32768 rows for stage 1 and all 32768*topk rows for stage 2 no matter how few tokens arrived. fused_dynamic_mxfp8_quant_moe_sort already forwards num_rows to the split path, so this just supplies the value the mxfp4 siblings already pass. On an MI355X decode profile of DSv4.1-Flash (DP8/EP8, mori_high_throughput) the two quant kernels were 40.5% of all GPU kernel time: 164us for stage 1 and 434us for stage 2 per MoE layer, against 186us/227us for the GEMMs they feed. Isolated on the live/padded shapes this change is worth 2.2-3.5x on those kernels; the sorted scale region the GEMMs consume is unchanged. Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
Motivation
Under expert parallelism the activation buffer handed to
fused_moe_2stagesisMoRI's dispatch receive buffer, sized for the worst case rather than for what
actually arrived:
max_num_tokens * ep_size, which is 32768 rows forDeepSeek-V4.1-Flash at DP8/EP8. Only the dispatched rows are valid.
The mxfp4 quant call sites already bound their work with
num_rows=num_local_tokens. The two mxfp8 (a8w4) call sites did not, soper_1x32_mx_quant_hipstreamed all 32768 rows for stage 1 and all32768 * topkrows for stage 2 no matter how few tokens the rank received.On an MI355X decode profile of DeepSeek-V4.1-Flash (DP8/EP8,
mori_high_throughput) those two quant kernels were 40.5% of all GPU kerneltime: 164us for stage 1 and 434us for stage 2 per MoE layer, against 186us and
227us for the GEMMs they feed.
Summary of changes
Pass
num_rows=num_local_tokensat the two mxfp8 call sites inaiter/fused_moe.py, matching what the mxfp4 siblings in the same functionalready do.
fused_dynamic_mxfp8_quant_moe_sortalready forwardsnum_rowstothe split path, so this only supplies a value that was being dropped.
Two lines, no new API, no behavior change when
num_local_tokensisNone.The sorted scale region the GEMMs consume is unchanged.
Results
8x MI355X (gfx950), DeepSeek-V4.1-Flash, DP8/EP8 with
mori_high_throughput,speculative decoding off. 8192 in / 1024 out, 256 prompts at concurrency 64.
Measured against a stock vLLM nightly (
0.32.0rc1.dev190+g3f1bcfd82)Performance
Accuracy
gsm8k, 5-shot, all 1319 questions, strict-match.
Reproduction
Server:
Benchmark:
Accuracy: