Skip to content

Conversation

heheda12345
Copy link
Collaborator

@heheda12345 heheda12345 commented Jul 22, 2025

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.

Purpose

Support hybrid allocator + flashinfer backend. Achieved by letting the attention backend know the set of layers that use this backend, and only performs plan for these layers.

Limitation:
For a model with both sliding window attention and full attention, when hybrid allocator is disabled, both the two types of layer use the same attention metadata builder, and flashinfer cannot handle this case. As a temporary solution, I add an error message to tell user to set disable_sliding_window manually. (This config was set automatically when using flashinfer backend before this PR).

Test Plan

Run basic.py with "google/gemma-3-1b-it"

Test Result

Not cap the max length to the sliding window size, and generate meaningful result

VLLM_ATTENTION_BACKEND=FLASHINFER python3 basic.py

output
------------------------------------------------------------
Prompt:    'Hello, my name is'
Output:    " Alex. I'm a software engineer.\n\nI'm passionate about creating"
------------------------------------------------------------
Prompt:    'The president of the United States is'
Output:    ' currently Joe Biden. He was elected in November 2020.\n\n'
------------------------------------------------------------
Prompt:    'The capital of France is'
Output:    ' Paris.\nThe largest city in the world is Tokyo.\nThe most populous'
------------------------------------------------------------
Prompt:    'The future of AI is'
Output:    ' being shaped by a critical question: can we build AI that is aligned with human'
------------------------------------------------------------

(Optional) Documentation Update

Copy link

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

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

Warning

Gemini is unable to generate a review due to a potential policy violation.

@mergify mergify bot added rocm Related to AMD ROCm v1 labels Jul 22, 2025
Signed-off-by: Chen Zhang <[email protected]>
@heheda12345
Copy link
Collaborator Author

CC @LucasWilkinson @WoosukKwon

@heheda12345
Copy link
Collaborator Author

@LucasWilkinson seems that we met the same problem when hybrid allocator is disabled as here. #21093 (comment)

@WoosukKwon
Copy link
Collaborator

For models like Gemma 3, is it using flash-attn for global attn and flashinfer for sliding window attn?

Signed-off-by: Chen Zhang <[email protected]>
@heheda12345
Copy link
Collaborator Author

@WoosukKwon No, all layers are using flashinfer. Mixing flash-attn + flashinfer should be easy with the current design but prefer to put it into next pr if you think it is needed.

@WoosukKwon
Copy link
Collaborator

@heheda12345 Great. I think we shouldn't mix the two.

Copy link

mergify bot commented Jul 24, 2025

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

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 Jul 24, 2025
def __init__(self, kv_cache_spec: AttentionSpec, vllm_config: VllmConfig,
device: torch.device):
def __init__(self, kv_cache_group_spec: KVCacheGroupSpec,
vllm_config: VllmConfig, device: torch.device):
Copy link
Collaborator

Choose a reason for hiding this comment

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

might play nicer with: #21588

if we do:

    def __init__(self, kv_cache_spec: AttentionSpec, layer_names: list[str],
                  vllm_config: VllmConfig, device: torch.device):

instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. I've fixed it.

Signed-off-by: Chen Zhang <[email protected]>
@mergify mergify bot added documentation Improvements or additions to documentation ci/build and removed needs-rebase labels Jul 26, 2025
@heheda12345
Copy link
Collaborator Author

my precommit fails at this test

- id: enforce-import-regex-instead-of-re
, so I change some import re to import regex as re

Copy link

mergify bot commented Jul 26, 2025

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

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 Jul 26, 2025
@mergify mergify bot removed the needs-rebase label Jul 27, 2025
Copy link
Collaborator

@LucasWilkinson LucasWilkinson left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for doing this!

@LucasWilkinson LucasWilkinson enabled auto-merge (squash) July 29, 2025 04:29
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 29, 2025
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
@heheda12345
Copy link
Collaborator Author

my precommit fails at this test

- id: enforce-import-regex-instead-of-re

, so I change some import re to import regex as re

reverted due to ci failure.

Signed-off-by: Chen Zhang <[email protected]>
@LucasWilkinson LucasWilkinson merged commit 555e722 into vllm-project:main Jul 30, 2025
67 checks passed
liuyumoye pushed a commit to liuyumoye/vllm that referenced this pull request Jul 31, 2025
wenscarl pushed a commit to wenscarl/vllm that referenced this pull request Aug 4, 2025
wenscarl pushed a commit to wenscarl/vllm that referenced this pull request Aug 4, 2025
vadiklyutiy pushed a commit to CentML/vllm that referenced this pull request Aug 5, 2025
x22x22 pushed a commit to x22x22/vllm that referenced this pull request Aug 5, 2025
x22x22 pushed a commit to x22x22/vllm that referenced this pull request Aug 5, 2025
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
noamgat pushed a commit to noamgat/vllm that referenced this pull request Aug 9, 2025
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
taneem-ibrahim pushed a commit to taneem-ibrahim/vllm that referenced this pull request Aug 14, 2025
BoyuanFeng pushed a commit to BoyuanFeng/vllm that referenced this pull request Aug 14, 2025
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build documentation Improvements or additions to documentation ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm speculative-decoding v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants