- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10.9k
Delete useless allgather in qwen2_5_vl vit attention #21493
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
base: main
Are you sure you want to change the base?
Conversation
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.
Code Review
This pull request addresses a performance issue in the Qwen2_5_VisionAttention module by removing a redundant all_gather operation. The original implementation performed an all-gather on a tensor-parallel sharded QKV tensor, only to immediately split it back, which is an expensive no-op. The change correctly removes this unnecessary communication overhead, leading to better performance in distributed settings. The code is now simpler and more efficient. The change is correct and well-justified.
| 👋 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  🚀 | 
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.
cc @fyabc can you validate this?
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.
I vaguely remember this allgather was added on purpose due to some issue seeing from supporting Qwen2.5 Omni back then that broke Qwen2.5VL.
Could you verify if both models work under all TP scenarios? Thank you!
| It makes sense. Each TP rank has already had the associated weight pieces of the WQ WK WV, so the activation is the associated part of q, k and v, so there is no need to do all gather for interleaved concat the activation. | 
| This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you! | 
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Purpose
The allgator+split_tensor-alond_last-dim operation after qkv fusion calculation can be optimized to split according to the last dimension. Redundant communication can be removed to improve inference performance.
Test Plan
vllm serve --model=/home/jenkins/Qwen2.5-VL-3B-Instruct/ --trust_remote_code --tensor_parallel_size=8 --max_model_len=32768 --max-num-seqs 64
Test Result
1080P picture,parallel-num=64 output-tokens=256,verify the tokens throughput
before optimization

after optimization

(Optional) Documentation Update