-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Core] Run garbage collector after CUDA graph capture to fix throughput regression #24128
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
Conversation
👋 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 You ask your reviewers to trigger select CI tests on top of 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 If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
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 throughput regression by adding a gc.collect()
call immediately after CUDA graph capture completes. The change is located within the freeze_gc
context manager in GPUModelRunner
. By explicitly triggering garbage collection after it has been re-enabled, this change reclaims memory that may have accumulated while the garbage collector was frozen during graph capture. The benchmarks provided in the pull request description demonstrate that this successfully recovers the lost throughput without reintroducing the graph capture slowdown. The implementation is correct and well-justified.
good find! |
@micah-wil small question ... does it make a positive or negative difference if you move that |
Good question. I ran 5 of the same test with this change, and the average tok/s was |
Thanks @micah-wil! |
Signed-off-by: Gregory Shtrasberg <[email protected]>
c9d1623
to
0c83651
Compare
…ut regression (vllm-project#24128) Signed-off-by: Gregory Shtrasberg <[email protected]> Co-authored-by: Gregory Shtrasberg <[email protected]>
…ut regression (vllm-project#24128) Signed-off-by: Gregory Shtrasberg <[email protected]> Co-authored-by: Gregory Shtrasberg <[email protected]>
…ut regression (vllm-project#24128) Signed-off-by: Gregory Shtrasberg <[email protected]> Co-authored-by: Gregory Shtrasberg <[email protected]>
Summary
We identified a regression in throughput caused by #21146 in some tests (most noticeably when using small input & output lengths). Specifically, on 8xMI300X:
Whereas if we disable gc freeze during graph capture by setting
VLLM_ENABLE_CUDAGRAPH_GC=1
:The throughput is ~5% higher with
VLLM_ENABLE_CUDAGRAPH_GC=1
.It seems that we can recover the throughput if we force a gc.collect() right after the CUDA graph capture is complete. With this PR:
That is, with this PR, it seems that we can recover the baseline throughput while getting the speedup from freezing gc during CUDA graph capture.