Skip to content
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

[Perf]:Optimize qwen2-vl to reduce cudaMemcpyAsync #14377

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cynthieye
Copy link

@cynthieye cynthieye commented Mar 6, 2025

qwen2-vl logic optimization: During each forward propagation, the xformer branch of Qwen2VisionTransformer will execute multiple tensor tolist methods (flash attn branch will execute multiple tensor items) to force the GPU tensor to be copied to the CPU, triggering CUDAMemcpyAsync to increase time consumption. Since the input and output are the same multiple times, it will be executed once, and the remaining will reuse the first result. After optimization, the online environment xformer branch QPS can be improved by 15%, and the flash attn branch QPS can be improved by 7%

Copy link
Collaborator

@Isotr0py Isotr0py left a comment

Choose a reason for hiding this comment

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

Thanks for this optimization! Can you please also update qwen2.5-vl as well?

@cynthieye cynthieye changed the title feat:Optimize qwen2-vl to reduce cudaMemcpyAsync [Perf]:Optimize qwen2-vl to reduce cudaMemcpyAsync Mar 10, 2025
@cynthieye cynthieye force-pushed the main branch 3 times, most recently from ae09649 to 1fbb69c Compare March 10, 2025 06:53
@Isotr0py Isotr0py enabled auto-merge (squash) March 10, 2025 09:50
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 10, 2025
auto-merge was automatically disabled March 10, 2025 13:26

Head branch was pushed to by a user without write access

Signed-off-by: cynthieye <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants