Skip to content

[Attention] MLA move rotary embedding to cuda-graph region #17668

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

Merged

Conversation

LucasWilkinson
Copy link
Collaborator

@LucasWilkinson LucasWilkinson commented May 5, 2025

Following on from #17484, with: #14770 we are no longer materializing the absorbed matrices so we can move the rotary embeddings into the cuda-graph region lowering CPU overhead:

Perf

Main

CPU time for unified_attention is 216us
image

PR

CPU time for unified_attention is 149us
image

Accuracy

VLLM_USE_V1=1 lm-eval --model vllm --model_args pretrained=deepseek-ai/DeepSeek-V2-Lite-Chat,tensor_parallel_size=2,dtype=auto,gpu_memory_utilization=0.9,trust_remote_code=True,max_model_len=16
384 --task gsm8k --num_fewshot 5  --batch_size auto
...
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.6649|±  |0.0130|
|     |       |strict-match    |     5|exact_match|↑  |0.6558|±  |0.0131|
VLLM_USE_V1=0 lm-eval --model vllm --model_args pretrained=deepseek-ai/DeepSeek-V2-Lite-Chat,tensor_parallel_size=2,dtype=auto,gpu_memory_utilization=0.9,trust_remote_code=True,max_model_len=16
384 --task gsm8k --num_fewshot 5  --batch_size auto
...
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.6649|±  |0.0130|
|     |       |strict-match    |     5|exact_match|↑  |0.6550|±  |0.0131|

Signed-off-by: Lucas Wilkinson <[email protected]>
Copy link

github-actions bot commented May 5, 2025

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

🚀

@mergify mergify bot added the v1 label May 5, 2025
Signed-off-by: Lucas Wilkinson <[email protected]>
Signed-off-by: Lucas Wilkinson <[email protected]>
@LucasWilkinson LucasWilkinson changed the title [WIP][Attention] MLA move rotary embedding to cuda-graph region [Attention] MLA move rotary embedding to cuda-graph region May 7, 2025
@LucasWilkinson LucasWilkinson marked this pull request as ready for review May 7, 2025 16:43
Signed-off-by: Lucas Wilkinson <[email protected]>
Copy link
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 reasonable to me and nice simplifications!

@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label May 8, 2025
@DarkLight1337 DarkLight1337 merged commit 5e6f939 into vllm-project:main May 9, 2025
75 checks passed
princepride pushed a commit to princepride/vllm that referenced this pull request May 10, 2025
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
mawong-amd pushed a commit to ROCm/vllm that referenced this pull request May 14, 2025
zzzyq pushed a commit to zzzyq/vllm that referenced this pull request May 24, 2025
minpeter pushed a commit to minpeter/vllm that referenced this pull request Jun 24, 2025
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 v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants