Skip to content

[ROCm][Perf] Add MI325X FP8 fused MoE configs for Qwen3.8-Flash-Next - #64662

Open
tc3oliver wants to merge 1 commit into
vllm-project:mainfrom
tc3oliver:rocm-mi325x-qwen38-moe-configs
Open

tc3oliver wants to merge 1 commit into
vllm-project:mainfrom
tc3oliver:rocm-mi325x-qwen38-moe-configs

Conversation

@tc3oliver

@tc3oliver tc3oliver commented Oct 30, 2026 •

Copy link
Copy Markdown

Overview

Adds tuned Triton fused-MoE configs for Qwen3.8-Flash-Next-FP8 (E=512, hidden 2560, MoE intermediate 640) on MI325X at TP2 and TP4.

At these TP sizes refine_fp8_moe_block_shape refines the 128x128 FP8 weight blocks to 64x64 (N=320) and 32x32 (N=160). MI325X has no configs for these shapes, so the Triton kernel falls back to get_default_config().

TP file
2 E=512,N=320,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[64,64].json
4 E=512,N=160,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[32,32].json

Claims

  • TP4 (main nightly, 2026-10-29): c64 output throughput +20.4%, TPOT -20.2%, prefill throughput +15.7%.
  • TP2 (v0.32.0): c64 output throughput +4.9%, prefill throughput +5.1%.
  • The configs are only used when the Triton FP8 MoE backend is selected and the layer has N=160 or N=320 with the refined block shape on MI325X. They do not apply with expert parallelism, where the local expert count changes E.

Validation

End to end

vllm serve Qwen/Qwen3.8-Flash-Next-FP8 --tensor-parallel-size 4 \
  --max-model-len 262144 --max-num-seqs 64 --max-num-batched-tokens 32768 \
  --gpu-memory-utilization 0.93 --enable-chunked-prefill --enable-prefix-caching \
  --async-scheduling --engram-config '{"cpu_offload":false}' \
  --speculative-config '{"method":"mtp","num_speculative_tokens":3}' \
  --compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}'

TP2 used the same command with --tensor-parallel-size 2. The baseline is the same server without the new file; the tuned run passes it through VLLM_TUNED_CONFIG_FOLDER. VLLM_ROCM_USE_AITER was unset; both arms set HIP_FORCE_DEV_KERNARG=1 HSA_NO_SCRATCH_RECLAIM=1 TORCH_BLAS_PREFER_HIPBLASLT=1 SAFETENSORS_FAST_GPU=1 OMP_NUM_THREADS=8. Logs showed Using TRITON Fp8 MoE backend, the refined block shape, and Using default MoE config (baseline) or Using configuration from .../E=512,N=...json (tuned).

Client: a local streaming-chat script (can share on request) with ignore_eos, temperature=0.6, seed=1 and a unique prefix per prompt (no prefix-cache hits). cN: N concurrent requests, ~1K-token prompts, 512 output tokens (c1 was run at TP2 only). prefill: 8 concurrent 32K-token prompts, 1 output token. Medians [min-max] of 6 warm passes per arm (2 server boots x 3 passes).

TP4, vllm/vllm-openai-rocm:nightly-3966924d (main, 2026-10-29), boots alternated baseline/tuned:

workload metric baseline tuned change
c64 output tok/s 2126 [2033-2180] 2560 [2440-2600] +20.4%
c64 TPOT p50 (ms) 17.55 [17.1-18.7] 14.00 [13.8-14.2] -20.2%
c16 output tok/s 1416 [1400-1462] 1646 [1472-1679] +16.2%
prefill prefill tok/s 11439 [11328-11528] 13238 [12955-13276] +15.7%
prefill TTFT p50 (s) 19.89 [19.74-20.16] 17.29 [17.11-17.51] -13.1%

TP2, vllm/vllm-openai-rocm:v0.32.0, both arms in parallel on separate GPU pairs, swapped between boots:

workload metric baseline tuned change
c64 output tok/s 1981 [1935-2021] 2077 [2028-2096] +4.9%
prefill prefill tok/s 11048 [10869-11091] 11614 [11519-11689] +5.1%

TP2 c1 and c16 were within noise. The v0.32.0 run used an earlier copy of the TP2 file whose BLOCK_SIZE_K values above 64 are clamped to 64 by the kernel, so it runs the same configs.

Accuracy, GSM8K (n=200, zero-shot, greedy, thinking off), baseline and tuned under the same setup: TP4 nightly 0.970 / 0.970, TP2 v0.32.0 0.975 / 0.970.

Lookup, correctness, kernel

On one MI325X with the nightly image above and the two files installed:

  • Lookup (using the fused_moe.py lookup code from main 335dd77): both files resolve and every M picks the nearest key. EP local expert counts (E=256/128), bf16, unrefined [128,128], other N, and other device names fall back to the default config.
  • fused_experts output with the files is bit-identical to the default config at 17 M values from 1 to 32768 (all entries keep the default BLOCK_SIZE_K).
  • Kernel time vs get_default_config() (CUDA graph) at every key and the geometric midpoint between keys: 1.01x-1.54x at N=320, 1.36x-2.32x at N=160. No point is slower.
  • pre-commit run --files <2 files> passes.

CI has no MI325X runner; the checks above were run locally.

Details


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

Tuned Triton fused-MoE configs for E=512 at N=320 with [64,64] blocks
(TP2) and N=160 with [32,32] blocks (TP4), the refined FP8 block shapes
used on MI325X.

AI assistance was used.

Signed-off-by: Oliver Yu <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@tc3oliver
tc3oliver requested a review from bnellnm as a code owner October 30, 2026 05:19
@mergify mergify Bot added qwen Related to Qwen models rocm Related to AMD ROCm labels Oct 30, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Oct 30, 2026
@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment /ci run for upstream CI or /amd-ci run for AMD CI only whenever CI signals are needed.

Once the PR is approved or has the ready label, the PR author can also use the corresponding /ci run, /ci retry, and /ci cancel commands, or their /amd-ci variants. New commits do not start upstream CI automatically.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qwen Related to Qwen models rocm Related to AMD ROCm

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant