Skip to content

[Perf][ROCm][MiniMax-M3.1] Add opt-in parallel decode top-k - #65032

Closed
jiacao-amd wants to merge 1 commit into
vllm-project:minimax-m31-flashfrom
jiacao-amd:jiacao/minimax-m31-dynamic-topk-patch02b
Closed

jiacao-amd wants to merge 1 commit into
vllm-project:minimax-m31-flashfrom
jiacao-amd:jiacao/minimax-m31-dynamic-topk-patch02b

Conversation

@jiacao-amd

@jiacao-amd jiacao-amd commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Add an opt-in parallel decode top-16 selector for MiniMax-M3.1 on gfx950, replacing the fixed FlyDSL w26 selector in the NVFP4 indexer.

Superseded by #65267, which targets main and includes the review follow-up. This PR was automatically closed when its target branch was deleted.

Claims

  • Preserve selected block IDs, ordering, tie handling and causal boundaries.
  • Use runtime shape metadata to avoid new row/stride specializations during mixed-batch serving.
  • Enable with VLLM_ROCM_MINIMAX_M3_1_PARALLEL_TOPK=1; default off. FP8 indexers, including C4 mono decode, bypass this path.

Validation

900 s AgentX: baseline vs top-k only

4× MI355X, TP4, AgentX 1.0.12; 900 s per arm after warmup. Model: amd/MiniMax-M3.1-Flash-Quark-MXFP4 at 0a00e0e39fc00499b23efccc18a8ea63fce5c44c. InferenceX #4671 at bed892b82, DSpark K7, synthetic AL 4.04, seed 42.

Values are baseline → candidate. p90 interactivity uses output_token_throughput_per_user.p10; total throughput includes cached input tokens.

Run 1 uses f9f83fb28; the repeats use the same kernel with the renamed flag in eae2f1099. Neither arm includes #62509. Each row is an independent pair.

Comparison p90 interactivity (tok/s/user) Output tok/s/GPU Total tok/s/GPU
C16, run 1 139.67 → 149.73 (+7.20%) 164.11 → 164.73 (+0.38%) 19,470.28 → 19,566.95 (+0.50%)
C16, run 2 138.85 → 152.69 (+9.97%) 164.59 → 166.63 (+1.24%) 19,542.95 → 19,982.19 (+2.25%)
C32, run 1 83.67 → 91.13 (+8.91%) 353.00 → 363.73 (+3.04%) 46,831.45 → 48,283.98 (+3.10%)
C32, repeat (r3) 87.18 → 91.26 (+4.68%) 356.29 → 365.85 (+2.68%) 47,237.91 → 48,630.29 (+2.95%)
ITL and TTFT (baseline → candidate)
Comparison Mean ITL (ms) p90 ITL (ms) Mean TTFT (ms) p90 TTFT (ms)
C16, run 1 5.221 → 5.302 7.158 → 6.669 540.663 → 517.630 875.833 → 920.976
C16, run 2 5.100 → 4.682 7.193 → 6.547 559.563 → 527.167 983.740 → 921.735
C32, run 1 8.307 → 7.906 11.947 → 10.965 703.343 → 698.839 1,374.336 → 1,267.423
C32, repeat (r3) 7.862 → 7.639 11.470 → 10.946 749.175 → 681.821 1,414.022 → 1,307.598

The first C32 repeat reached the 30 s drain limit with one cancelled request and is excluded. The table uses a fresh C32 pair with the same settings.

Configuration and reproduction

Pinned nightly: vllm/vllm-openai-rocm@sha256:9cef62361792bd9cc621725c3af799993b6a68b6b62e3778dcf9b65ff6fcd872 (source e0d00e4b8). Both repetitions use this image.

C16/C32 use NVFP4 KV/indexer, V2 + DBO and a 32K prefill budget. Both arms include the same text-only DBO startup-guard fix (supports_multimodal_inputs). C4 uses FP8 KV/indexer, mono decode, an 8K prefill budget and no DBO.

Use the corresponding #4671 serving lane. Set CONC to the table's concurrency and TOKENIZER to the pinned model snapshot:

agentx profile --url http://127.0.0.1:8000 \
  --model amd/MiniMax-M3.1-Flash-Quark-MXFP4 \
  --tokenizer "$TOKENIZER" \
  --concurrency "$CONC" --benchmark-duration 900 \
  --tokenizer-trust-remote-code \
  --server-metrics http://127.0.0.1:8000/metrics \
  --public-dataset semianalysis_cc_traces_weka_062126

In-tree tests: .venv/bin/python -m pytest -q tests/kernels/attention/test_minimax_m3_index_topk_decode.py -k parallel_decode — 78 passed. Direct-kernel and host-dispatch comparisons cover exact FlyDSL ordering, ties, NaNs, causal boundaries, query lengths 1/4/8, fused/staged merge and strided outputs. Two-stream graph replays switch the same rows across adaptive/merge boundaries and verify zero counters after every replay. Pre-commit hooks passed.

Model evaluation uses real DSpark rejection, C16, 5-shot, greedy decoding, seed 42, reasoning effort low and a 4096-token output limit.

GSM8K smoke (64 questions): 63 → 62 correct (98.44% → 96.88%); invalid answers 0 → 0.

GSM8K full (1,319 questions): 1,267 → 1,264 correct (96.06% → 95.83%); invalid answers 1 → 0.

Details

Small heads × rows <= 16 batches fuse selection and last-arriver merge; larger batches use staged merging. Scratch and counters are isolated by device, stream and shape.

The recipe adds opt-in parallel_topk; MI355 Buildkite kernel CI selects the new tests. Scoreboard enablement targets #4671's C16/C32 NVFP4 lane, zip_override_tp4_dspark7.roles.agg.env: set the flag to "1" in an image containing this patch and the text-only DBO startup fix noted above. Correctness CI does not enable serving; global default-on is not planned. Recipe validation, interactive command checks and documentation discovery passed.

Related work: #64130 targets sampling; #55122 changes C++ persistent top-k; #59980 targets index scoring; #64264 prebuilds existing FlyDSL kernels.

AI assistance: OpenAI Codex.

Pull Request Checklist
  • PR checklist used; AI assistance disclosed.
  • Design fit, tests, documentation and CI coverage reviewed.
  • Requested performance validation and model evaluation complete.
  • Attribute the observed GSM8K accuracy difference.
  • Hosted CI complete.

Use runtime shape metadata and fixed merge widths to avoid serving-time shape specialization. Preserve the FlyDSL selector ordering and causal bounds.

Co-authored-by: OpenAI Codex
Signed-off-by: jiacao-amd <jiahui.cao@amd.com>
@mergify mergify Bot added minimax rocm Related to AMD ROCm labels Nov 2, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Nov 2, 2026
@jiacao-amd
jiacao-amd marked this pull request as ready for review November 2, 2026 00:55

@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.

@jiacao-amd jiacao-amd changed the title [Perf][ROCm][MiniMax-M3] Add opt-in parallel decode top-k [Perf][ROCm][MiniMax-M3.1] Add opt-in parallel decode top-k Nov 2, 2026
@ChuanLi1101

Copy link
Copy Markdown
Collaborator

Thanks for the AgentX table and the ordering checks. Asks:

  1. Please add an in-tree pytest for parallel_decode_topk (vs the existing FlyDSL selector) covering ties / NaN / causal boundaries / query_len in {1,4,8} and at least one CUDA-graph replay path. The local harness results are useful, but this kernel should not land without repo tests.

  2. Please repeat the 900s AgentX comparison at least once more on the same pinned image (or report seed-to-seed variance). A single arm with intervening work on the node is too thin for a +7.8% p90 claim.

  3. Please document the intended enablement path. Default-off behind VLLM_ROCM_MINIMAX_M3_PARALLEL_TOPK is fine for landing, but note whether the MiniMax recipe / CI image will set it, and when default-on is planned. Otherwise this will not show up in production numbers.

  4. In the fused path, the last-arriver merge uses atomic_add + volatile loads + atomic_xchg reset. Please confirm (and ideally test) that a graph-captured launch with varying seq_lens cannot leave a non-zero counter if a prior launch took the adaptive early-exit path on some rows and the merge path on others. The PR claims concurrent replay passed; please point to that case or add it to the pytest above.

  5. Minor: the env name says M3 while the PR targets MiniMax-M3.1. Prefer VLLM_ROCM_MINIMAX_M3_1_PARALLEL_TOPK (or a shared MiniMax decode flag) to avoid confusion with other M3 paths.

@zyongye
zyongye deleted the branch vllm-project:minimax-m31-flash November 2, 2026 02:43
@zyongye zyongye closed this Nov 2, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Nov 2, 2026
jiacao-amd added a commit to jiacao-amd/vllm that referenced this pull request Nov 3, 2026
Use runtime shape metadata and fixed merge widths for the NVFP4 indexer.
Preserve FlyDSL ordering and causal bounds, with changing-length graph
replay tests, recipe opt-in and MI355 kernel CI coverage.

Reapply the reviewed vllm-project#65032 patch to main after its base branch was deleted.

Co-authored-by: OpenAI Codex
Signed-off-by: jiacao-amd <jiahui.cao@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minimax rocm Related to AMD ROCm

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants