-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[core] overhaul memory profiling and fix backward compatibility #10511
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. 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 do one of these:
🚀 |
cc @joerunde |
This pull request has merge conflicts that must be resolved before it can be |
any progress? I do need to run multi-instance with one GPU. |
is this function available? |
let me finish it this week. |
Thanks for taking this on @youkaichao! I think the docs for the |
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.
Excellent work Kaichao, I appreciate the walkthrough example in memory_profiling
. This passed my local usage and I didn't see the issue Joe saw, or think it is a serious issue. My only nit is on adding all the newlines to the log, I think it was fine as comma-separated list
vllm/worker/worker.py
Outdated
"PyTorch activation peak memory\t" | ||
f"{(result.torch_peak_increase_in_bytes / GiB_bytes):.2f}GiB\n" | ||
"available_kv_cache_memory\t" | ||
f"{(available_kv_cache_memory / GiB_bytes):.2f}GiB\n") |
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 think all of the newlines take too much space in the logs. IMO it would be more simple to keep the same single-line comma-separated result as before
Signed-off-by: youkaichao <youkaichao@gmail.com>
@mgoin changed the logging to be:
Let me know if you have further ideas on how to improve the readability. |
@joerunde this is because PyTorch's internal memory fragmentation. If PyTorch allocates 2MiB from cuda, and allocate 1MiB only, then this 1 MiB will be accounted as non-torch memory. And when you run it the next time, maybe you allocate another 1 MiB, and the internal memory fragmentation reduces. |
@joerunde that's a great idea! I added it now, PTAL. |
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.
Looks pretty good to me! Thanks for looking at this so thoroughly
errors are unrelated, merging |
fixes #10451 , and clearly explain the memory classification and the procedure.
I also added the initial pytorch memory, to be aligned with the pytorch memory profiler.
the profiling procedure is extracted into
vllm/utils
, so that we can use it later in v1 too.