-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[v1][attention] Support Hybrid Allocator + FlashInfer #21412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v1][attention] Support Hybrid Allocator + FlashInfer #21412
Conversation
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
👋 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 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 🚀 |
Warning Gemini is unable to generate a review due to a potential policy violation. |
Signed-off-by: Chen Zhang <[email protected]>
@LucasWilkinson seems that we met the same problem when hybrid allocator is disabled as here. #21093 (comment) |
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]>
@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. |
@heheda12345 Great. I think we shouldn't mix the two. |
This pull request has merge conflicts that must be resolved before it can be |
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): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]>
my precommit fails at this test Line 141 in 2f6e6b3
import re to import regex as re
|
This pull request has merge conflicts that must be resolved before it can be |
…hybrid Signed-off-by: Chen Zhang <[email protected]>
There was a problem hiding this 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!
Signed-off-by: Chen Zhang <[email protected]>
Signed-off-by: Chen Zhang <[email protected]>
reverted due to ci failure. |
Signed-off-by: Chen Zhang <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: shuw <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: shuw <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: x22x22 <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: x22x22 <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: Jinzhen Lin <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: Noam Gat <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: Paul Pak <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: Boyuan Feng <[email protected]>
…1412) Signed-off-by: Chen Zhang <[email protected]> Signed-off-by: Diego-Castan <[email protected]>
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
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
(Optional) Documentation Update