Repository navigation
[ASM] Add gfx950 Qwen3.8-Flash-Next fused MXFP4 prefill producers - #8044
vstakhov-amd wants to merge 4 commits into
Conversation
Install two fused assembly producers for Qwen3.8-Flash-Next MoE prefill (model 2560, 513 experts with the fused shared expert, top-k 11, SiLU, MXFP4 activations and weights): one for intermediate 384 (TP2: 320 plus 64 padding) and one for intermediate 640 (TP1). Both use the existing post-reduction mode (flat=3): standard fmoe launcher, Opus sort with 256-row tiles, token-major BF16 partials and the FlyDSL reduction. Select them in the Flash MXFP4 config: - intermediate 384: 8192, 16384 and 32768 token rows (4097+ tokens), which had no tuned rows and ran the heuristic FlyDSL default; - intermediate 640: the 16384 row (replacing FlyDSL) and a new 32768 row (8193+ tokens). The 8192 row stays on FlyDSL.
Replace both code objects with faster builds that produce bitwise identical output: - tiles with at most 32 valid rows take a direct path that loads their activations straight into registers instead of staging them; - workgroups visit tiles in a cost-balanced order instead of the fixed one (for intermediate 384 these two apply up to 8192 tokens only); - per-load prefetch guards are dropped and the activation is applied in place; intermediate 640 now also keeps the down accumulators in VGPRs, as 384 already did. Refresh the timings of the five config rows. Manifest rows and the selected token rows are unchanged.
4ebe538 to
733dab2
Compare
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
Resolve the conflict with #8123, which added tuned FlyDSL rows for intermediate 384 at 1024..16384 tokens to the Flash MXFP4 config: - keep the FlyDSL 8192 row. It serves 4097..8192 tokens, where the producer is 3% faster at 8192 but 8-22% slower at 4097..6000; - the producer replaces the FlyDSL 16384 row and keeps its new 32768 row, so intermediate 384 uses it from 8193 tokens, as intermediate 640 already does. The intermediate 640 rows, both code objects and the manifest rows are unchanged.
mjkvaak-amd
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Just FYI, this work #8044 and #8867 (#8123 follow-up) both fill the same gap as this PR using FlyDSL.
Qwen3.8-Flash-Next, MI355X. Kernel: one fused_moe call, vLLM's padding and env. E2E: TP2, MTP-3, --max-num-batched-tokens 32768, 2 passes with GPU pairs swapped, output tok/s vs main.
| main (#8123) | #8044 | #8123 + #8867 | |
|---|---|---|---|
| inter 384 (TP2), 32768 tokens | 2476 µs | 1433 µs | 1524 µs |
| inter 640 (TP1), 32768 tokens | 3172 µs | 1754 µs | 1882 µs |
| inter 256 (TP4), 32768 tokens | 2017 µs | no row | 1206 µs |
| inter 384, 16384 tokens | 824 µs | 846 µs | 824 µs |
| E2E 60k/128k | — | +6.4% | +5.1% |
| E2E 8k/1k | — | +1.8% | +1.5% |
Your #8044 is the faster at 32k and at 16k it's on par with #8123 (main), so I recommend landing yours instead of #8867 after fixing the small requests I left. I'm taking down #8867.
| _ZN5aiter49fmoe_bf16_pertokenMXfp4_g1u1_flat_novs_silu_16x32E,fmoe_bf16_pertokenMXfp4_g1u1_flat_novs_silu_16x32.co,0,0,0,2,0,16,32,1,0,0,0 | ||
| _ZN5aiter50fmoe_bf16_pertokenMXfp4_g1u1_flat_novs_silu_16x160E,fmoe_bf16_pertokenMXfp4_g1u1_flat_novs_silu_16x160.co,0,0,0,1,0,16,160,1,0,0,0 | ||
| _ZN5aiter50fmoe_bf16_pertokenMXfp4_g1u1_flat_novs_silu_16x320E,fmoe_bf16_pertokenMXfp4_g1u1_flat_novs_silu_16x320.co,0,0,0,1,0,16,320,1,0,0,0 | ||
| fmoe_bf16_pertokenMXfp4_g1u1_silu_prefill_1tg_4w_256mx1_128nx1_ps_fp32gate_i640_route,fmoe_bf16_pertokenMXfp4_g1u1_silu_prefill_1tg_4w_256mx1_128nx1_ps_fp32gate_i640_route.co,0,0,0,1,1,256,640,3,0,0,0 |
There was a problem hiding this comment.
This file conflicts with main. #7611 added a 14th column, dim_align, to every row. After the rebase, both new rows need it. kernel_fits and the AITER_CHECK in asm_fmoe.cu require model_dim % dim_align == 0. For Flash-Next (model_dim 2560), the value has to be 512, as for the existing ..._fp32gate_route producer: 1024, which kernels without the 512-column tail drain declare, would reject every call at these keys. Since your harness already runs these at 2560, 512 should be correct.
[ASM] Add gfx950 Qwen3.8-Flash-Next fused MXFP4 prefill producers (TP1 and TP2)
What
Two fused assembly MoE producers for Qwen3.8-Flash-Next prefill on gfx950 (model 2560, 513 experts with the fused shared expert, top-k 11, SiLU, MXFP4 activations and weights):
..._fp32gate_i384_route.co— intermediate 384 (TP2: 320 + 64 padding)..._fp32gate_i640_route.co— intermediate 640 (TP1)Both use the existing post-reduction mode (
flat=3): standard fmoe launcher, Opus sort with 256-row tiles, token-major BF16 partials and the FlyDSL reduction. No Python, C++, FlyDSL or Triton changes: two code objects, two manifest rows and config rows inqwen3_8_flash_fp4_tuned_fmoe.csv.Config rows, the same for intermediate 384 and 640:
The producers therefore serve 8193+ tokens. The 8192 rows stay on FlyDSL (for intermediate 384, the row added in #8123): they serve 4097–8192 tokens, where the producer is 3% ahead at 8192 but 8–22% behind at 4097–6000.
Performance
MI355X, one GPU, arms interleaved in one lease, 3 rounds,
AITER_USE_FLYDSL_MOE_SORTING=1, main at d6d60ef. Wholefused_moecall, µs per layer.Captured vLLM routing (12-layer chain, layers 24–35, 50 samples per round):
Against a tuned FlyDSL 32768 row for inter 640 (2002 µs) the producer is −10.2%.
Uniform synthetic routing (
test_moe_q256_prefill.py):The inter 640 / 16384 row is 2.9% behind tuned FlyDSL at 12000 tokens on uniform routing and ahead at both ends of its range and on captured routing.
Accuracy
Dispatch checks