Skip to content

[Misc] Move GPUModelRunner.prepare_kernel_block_sizes to utils#35400

Merged
DarkLight1337 merged 2 commits intovllm-project:mainfrom
NickLucche:refactor-kernel-block-size
Feb 27, 2026
Merged

[Misc] Move GPUModelRunner.prepare_kernel_block_sizes to utils#35400
DarkLight1337 merged 2 commits intovllm-project:mainfrom
NickLucche:refactor-kernel-block-size

Conversation

@NickLucche
Copy link
Copy Markdown
Collaborator

As per title, move this method into utils.
I have use for grabbing kernel_block_sizes from kv_cache_config (without having to iterate all physical tensors) outside of the model runner.
This way we can have a centralized function for calculating block sizes from backends.
Furthermore we should strive to keep the runner code as lean as possible, moving this method which doesn't actually use any of the state of the class just makes sense imo.

Signed-off-by: NickLucche <nlucches@redhat.com>
@NickLucche
Copy link
Copy Markdown
Collaborator Author

cc @LucasWilkinson @MatthewBonanni

@mergify mergify bot added the v1 label Feb 26, 2026
@NickLucche NickLucche added the ready-run-all-tests Trigger CI with all tests for wide-ranging PRs label Feb 26, 2026
Copy link
Copy Markdown
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 pull request refactors the prepare_kernel_block_sizes and select_common_block_size methods from GPUModelRunner into the vllm.v1.worker.utils module. This is a good change that improves code organization by centralizing utility functions that do not depend on the runner's state. The implementation correctly moves the logic and updates the call sites and tests accordingly. The changes are clean and I don't see any issues.

@NickLucche NickLucche added ready ONLY add when PR is ready to merge/full CI is needed and removed ready-run-all-tests Trigger CI with all tests for wide-ranging PRs labels Feb 26, 2026
@NickLucche
Copy link
Copy Markdown
Collaborator Author

@DarkLight1337 not sure if i'll be able to get a clean run given the state of CI

Copy link
Copy Markdown
Collaborator

@MatthewBonanni MatthewBonanni 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, thanks for doing this!

@DarkLight1337 DarkLight1337 merged commit cabdaa7 into vllm-project:main Feb 27, 2026
51 checks passed
antonovsergey93 pushed a commit to antonovsergey93/vllm that referenced this pull request Feb 27, 2026
Copilot AI pushed a commit to machov/vllm that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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