-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Misc]: Implement CPU/GPU swapping in BlockManagerV2 #3834
[Misc]: Implement CPU/GPU swapping in BlockManagerV2 #3834
Conversation
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.
Thanks for working on this. I'm leaving some early feedback.
Will take another pass tomorrow |
I passed through the code. I think this PR is mixing the abstraction boundaries too much. I wrote out some pseudocode for a better way of using the existing APIs -- take a look. https://docs.google.com/document/d/157VCEOs5EIB1aztD51ZrT2RvdjxMx1spazyBM4LS4aQ/edit |
Hi Cade, It's ready for review. @cadedaniel |
OK, will take a look thurs or fri this week |
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.
Looking a lot better! Thanks for improving the PR.
Some missing things:
- We'll need e2e tests which verify swapping works and produces correct results. You can basically copy these tests and simply enable preemption by swap instead of by compute.
vllm/tests/core/block/e2e/test_correctness.py
Line 187 in c1b4e41
def test_lookahead_greedy_equality_with_preemption(baseline_llm_generator, def test_v1_v2_greedy_equality_with_cow(baseline_llm_generator, def test_v1_v2_greedy_equality_with_preemption(baseline_llm_generator,
- The unit test in this PR is pretty narrow in its coverage. I suggest writing the test at a lower level (at the BlockAllocator level), so that you can more easily test
num_lookhead=[0, 2]
andtype=[prefix, naive]
.
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.
Is it ready for review again?
Nope, still working on the test, will push the new version later today or tmr and notify you. Thanks for the attention! |
@cadedaniel Hi cade, i think it's ready for another round of review. One small point is currently the |
Hi Cade, can you help to retry the last failed test one more time? Thanks! |
retried |
@cadedaniel TY! I think all tests are passed now. |
@cadedaniel Hi cade, solved the new conflicts. Can you help to retry and get it merged? TY! |
thanks @Kaiyang-Chen . i was out last week. I will get this merged this week, thanks for all your work! |
@cadedaniel resolve the conflicts again. Can we merge this now? |
Enabled auto merge |
Head branch was pushed to by a user without write access
@cadedaniel It seems this cannot be auto merged because I don't have write access to the repo? |
Done! thanks again @Kaiyang-Chen |
device) < num_blocks_touched: | ||
return AllocStatus.NEVER | ||
elif self.block_allocator.get_num_free_blocks( | ||
device) - num_blocks_touched >= watermark_blocks: |
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.
@Kaiyang-Chen What's watermark responsible for over here?
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.
@cadedaniel Is watermark even necessary in the current version? It was used to avoid frequent cache eviction, but I suspect if that's still the case since you last added it.
A draft PR for #3666, supporting CPU-GPU swapping for Block Manager V2.
PR Checklist (Click to Expand)
Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]
for bug fixes.[CI/Build]
for build or continuous integration improvements.[Doc]
for documentation fixes and improvements.[Model]
for adding a new model or improving an existing model. Model name should appear in the title.[Frontend]
For changes on the vLLM frontend (e.g., OpenAI API server,LLM
class, etc.)[Kernel]
for changes affecting CUDA kernels or other compute kernels.[Core]
for changes in the core vLLM logic (e.g.,LLMEngine
,AsyncLLMEngine
,Scheduler
, etc.)[Hardware][Vendor]
for hardware-specific changes. Vendor name should appear in the prefix (e.g.,[Hardware][AMD]
).[Misc]
for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
format.sh
to format your code.docs/source/
if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.Notes for Large Changes
Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with
rfc-required
and might not go through the PR.What to Expect for the Reviews
The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:
action-required
label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.Thank You
Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!