-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Core] Minor comments and asserts changes in block pool #21351
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Jialin Ouyang <[email protected]>
👋 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 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 🚀 |
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 refactors some comments and replaces if...raise
error handling with assert
statements. The comment cleanups improve readability.
However, one of the changes from raise ValueError
to assert
in popleft()
is concerning. Using assert
for checking if the queue is empty can be disabled in production environments, which would lead to more obscure errors later on. I've left a critical comment with a suggestion to revert this specific change to ensure robustness.
assert (self.fake_free_list_head.next_free_block | ||
is not self.fake_free_list_tail), "No free blocks available" | ||
assert (self.fake_free_list_head.next_free_block is not None | ||
), "fake_free_list_head.next_free_block should always exist" |
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.
Using assert
to check for an empty queue is risky because assertions can be disabled in production (e.g., with python -O
). This would suppress the error and likely lead to a more obscure crash later on. The original raise ValueError
is a more robust way to handle this condition.
Additionally, this change removes the assertion assert self.num_free_blocks == 0
, which was a valuable check to ensure the block count is synchronized with the free list's state. It's better to keep this for debugging purposes.
I recommend reverting this part of the change to maintain robustness and the helpful debugging assertion.
if (self.fake_free_list_head.next_free_block
is self.fake_free_list_tail
or self.fake_free_list_head.next_free_block is None):
assert self.num_free_blocks == 0, (
f"num_free_blocks ({self.num_free_blocks}) is out of sync "
"with the free list.")
raise ValueError("No free blocks available")
Gentle nudge @njhill :) |
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
Address leftover comments in #21005
Test Plan
Only comments and asserts are changed, it should be safe as long as CI signals are clean.
Test Result
N/A
(Optional) Documentation Update