Skip to content

[Attention] Abstract the MLA prefill backends#32623

Open
MatthewBonanni wants to merge 33 commits intovllm-project:mainfrom
MatthewBonanni:mla_prefill_abstraction
Open

[Attention] Abstract the MLA prefill backends#32623
MatthewBonanni wants to merge 33 commits intovllm-project:mainfrom
MatthewBonanni:mla_prefill_abstraction

Conversation

@MatthewBonanni
Copy link
Copy Markdown
Collaborator

@MatthewBonanni MatthewBonanni commented Jan 19, 2026

Purpose

Abstracts the MLA prefill backends to simplify mla_attention.py and introduces a selection mechanism similar to that of the decode backends, via --attention-config.mla_prefill_backend. Old AttentionConfig arguments (use_cudnn_prefill, use_trtllm_ragged_deepseek_prefill, and disable_flashinfer_prefill) are retained (with deprecation warnings) for backwards compatibility.

Test Plan

tests/v1/attention/test_mla_prefill_selector.py

(introduced by this PR) should pass in CI (part of V1 attention (H100) and V1 attention (B200))

Test Result

TBD


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a well-designed abstraction for MLA prefill backends, which significantly simplifies mla_attention.py and improves modularity. The new selection mechanism via --attention-config.mla_prefill_backend is a great addition, and the backward compatibility for old flags is handled correctly. The refactoring moves backend-specific logic into separate, well-organized files, making the code cleaner and more maintainable. I've found one issue related to a hardcoded device that could affect non-CUDA platforms, which I've commented on. Overall, this is an excellent refactoring effort.

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify mergify bot added the rocm Related to AMD ROCm label Jan 19, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 20, 2026

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

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 Jan 20, 2026
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 2026

Documentation preview: https://vllm--32623.org.readthedocs.build/en/32623/

@mergify mergify bot added documentation Improvements or additions to documentation and removed needs-rebase labels Jan 29, 2026
@github-project-automation github-project-automation bot moved this to Todo in AMD Jan 29, 2026
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Copy link
Copy Markdown
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

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

Looks really clean to me, nice work! I'll defer to Lucas and would like someone from AMD to review as well cc @tjtanaa

MatthewBonanni and others added 4 commits January 30, 2026 11:29
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 31, 2026

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

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 Jan 31, 2026
@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 1, 2026
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify mergify bot removed the needs-rebase label Feb 2, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Feb 2, 2026

Hi @MatthewBonanni, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy or markdownlint failing?
mypy and markdownlint are run differently in CI. If the failure is related to either of these checks, please use the following commands to run them locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10
# For markdownlint
pre-commit run --hook-stage manual markdownlint

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Feb 5, 2026

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

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 Feb 5, 2026
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify mergify bot removed the needs-rebase label Mar 16, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 16, 2026

Hi @MatthewBonanni, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 16, 2026

Hi @MatthewBonanni, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
MatthewBonanni and others added 4 commits April 2, 2026 15:45
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation nvidia ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm v1

Projects

Status: Todo
Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants