Skip to content

[Performance][MiniMax-M3] Bound sparse decode work and split pages on Blackwell - #56932

Open
Micdiane wants to merge 1 commit into
vllm-project:mainfrom
Micdiane:codex/msa-paged-decode-blackwell
Open

Micdiane wants to merge 1 commit into
vllm-project:mainfrom
Micdiane:codex/msa-paged-decode-blackwell

Conversation

@Micdiane

Copy link
Copy Markdown

Purpose

Small-batch Triton sparse decode exposes insufficient parallel work inside pages and can schedule splits beyond the page-table capacity. This patch adds page splitting, bounds split count using CPU-visible table capacity, skips empty slices on the GPU, and fuses single-page calls with an actually one-column table into direct output.

The specialization targets GQA16, head dimension 128 and page size 128 with contiguous BF16 queries and BF16/E4M3 KV. General page splitting is enabled on SM120; the bounded single-page path supports SM103/SM120. Other geometries use the existing implementation. No sequence-length device-to-host synchronization is added. Empty slices overwrite scratch output and LSE; stable LSE merging handles empty rows and CUDA Graph replay after lengths shrink or grow. Scalar and physical-token/head FP8 scales and PDL are supported.

Test Result

Baseline: b7e8dd8. RTX 5090, driver 595.71.05, Torch 2.13.0+cu132, Triton 3.7.1; installed native vLLM, no platform shims.

Each independent invocation measures 72 cases (12 shapes × three KV modes × seeds 2027/4093), with a 256-column preallocated page table, three alternating baseline/candidate CUDA Graph timing rounds of 60 ms. Both implementations are checked against a dense reference. Timings include the complete attention call and merge.

KV mode Run 1 geomean Run 2 geomean
BF16 1.0974× 1.0971×
FP8 scalar 1.2850× 1.2856×
FP8 per-token/head 1.3756× 1.3778×
All 72 cases 1.2471× 1.2479×

Worst speedup: 0.9907× / 0.9963×; no case below 0.98×. Maximum relative RMS error against reference: 0.3269%.

Production metadata slices page-table rows, not columns: short context alone does not select the direct single-page path. The primary results above deliberately use padded tables. These are operator measurements, not indexer performance or model/serving throughput. Integrated native validation is on SM120; the SM103 single-page specialization has historical B300 prototype evidence but has not been rerun in this integrated revision.

Test Plan

  • 64 passed: .venv/bin/python -m pytest tests/kernels/test_minimax_m3_sparse_attn_fp8_scale.py -q.
  • 17 passed: .venv/bin/python -m pytest tests/kernels/attention/test_minimax_m3.py -k 'decode_sparse_attention or decode_wrong_layout' -q (NHD/HND, speculative query lengths, padded requests).
  • Default compute-sanitizer --tool memcheck on the 64-case suite: 0 errors.
  • All applicable pre-commit hooks on the five changed files passed, including Ruff, mypy and SPDX/import checks.
  • The repository model checker runs a two-layer MiniMaxM3 configuration with dummy/random weights through the real LLM engine. Baseline and candidate execute 14 decode calls, generate the same 24 tokens and top-logprob key sets; maximum logprob difference is 0.000123501. This is execution/output parity, not pretrained-model quality evaluation. The pinned registry marks MiniMax-M3 unavailable online; no pretrained quality or serving benchmark is claimed.

Reproduce performance after extracting the pinned baseline:

git show b7e8dd8f372c1324c376ba5dc03d92264eae8f24:vllm/models/minimax_m3/common/ops/sparse_attn.py > /tmp/msa_baseline.py
.venv/bin/python benchmarks/kernels/benchmark_minimax_m3_sparse_decode.py --baseline /tmp/msa_baseline.py --matrix heldout --seeds 2027 4093 --pad-capacity 256
.venv/bin/python benchmarks/kernels/check_minimax_m3_decode_model.py --baseline-source /tmp/msa_baseline.py --output /tmp/msa-model-baseline.json
.venv/bin/python benchmarks/kernels/check_minimax_m3_decode_model.py --reference-output /tmp/msa-model-baseline.json --output /tmp/msa-model-candidate.json

Related work

#55372 / #47763 build unions across speculative query rows to reuse KV. This patch keeps independent query rows and changes page-level work decomposition. #48994 and #56483 introduce FlashInfer backends; this patch optimizes the existing Triton implementation. It is not a standalone sentinel/empty-row fix duplicating #54597 or #49054. Duplicate search results are retained in the review package.

AI assistance

OpenAI Codex assisted implementation, tests and measurements. The human submitter has confirmed reviewing the code and test results and reproducing the tests on their own server.

… Blackwell

Co-authored-by: OpenAI Codex <noreply@openai.com>

Signed-off-by: MicDiane <114597733+Micdiane@users.noreply.github.com>

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

@mergify mergify Bot added performance Performance-related issues minimax labels Sep 15, 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

minimax performance Performance-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant