Skip to content

[BugFix] Fix potential cuda-graph IMA #21196

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 Jul 18, 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

Cuda-graph padding happens after prepare inputs; it's safer to -1 fill here (and closer behavior to pre #20466 ). No errors reported yet this is just preventative

Test Plan

lm_eval

Test Result

VLLM_ATTENTION_BACKEND=TRITON_ATTN_VLLM_V1  lm_eval   --model vllm   --model_args '{
    "pretrained": "meta-llama/Meta-Llama-3-8B-Instruct",
    "compilation_config": { "full_cuda_graph": true }
  }'   --tasks gsm8k   --batch_size auto 
...
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.7559|±  |0.0118|
|     |       |strict-match    |     5|exact_match|↑  |0.7574|±  |0.0118|

(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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR addresses a bug in full CUDA graph mode related to incorrect padding of slot_mapping. The removal of the ineffective __post_init__ method is correct. However, the new logic targets an incorrect tensor. The provided critical comment suggests a fix to target the correct slot_mapping tensors within self.input_batch.block_table.

@LucasWilkinson LucasWilkinson changed the title [BugFix] Potential full cuda-graph fix [BugFix] Potential cuda-graph IMA Jul 18, 2025
@LucasWilkinson LucasWilkinson changed the title [BugFix] Potential cuda-graph IMA [BugFix] Fix potential cuda-graph IMA Jul 18, 2025
@LucasWilkinson LucasWilkinson marked this pull request as ready for review July 18, 2025 17:00
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.

Seems reasonable to me, I guess there shouldn't be a performance concern aside from this being potentially moved out of the cudagraph?

@mgoin mgoin added bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed labels Jul 18, 2025
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
@LucasWilkinson LucasWilkinson force-pushed the lwilkinson/potential-cuda-graph-fix branch from ec2e999 to 5d65c32 Compare July 18, 2025 18:14
@LucasWilkinson
Copy link
Collaborator Author

Seems reasonable to me, I guess there shouldn't be a performance concern aside from this being potentially moved out of the cudagraph?

Basically we just fill more during input prep; when it was in CommonAttentionMetadata it would only fill the already sliced tensor (we want to fill the whole thing incase we pad for cuda-graphs)

@LucasWilkinson LucasWilkinson added this to the v0.10.0 milestone Jul 18, 2025
@LucasWilkinson LucasWilkinson enabled auto-merge (squash) July 18, 2025 18:21
@vllm-bot vllm-bot merged commit 59f9353 into vllm-project:main Jul 19, 2025
63 of 67 checks passed
hj-mistral pushed a commit to hj-mistral/vllm that referenced this pull request Jul 19, 2025
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Signed-off-by: Himanshu Jaju <hj@mistral.ai>
LyrisZhong pushed a commit to LyrisZhong/vllm that referenced this pull request Jul 23, 2025
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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