Skip to content
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

[Core][Optimization] change python dict to pytorch tensor for blocks to swap #4659

Merged
merged 22 commits into from
May 8, 2024

Conversation

youkaichao
Copy link
Member

Continue after #4607 .

csrc/cache_kernels.cu Outdated Show resolved Hide resolved
assert (num_lookahead_slots == 0
), "BlockSpaceManagerV1 does not support lookahead allocation"

# CPU block -> GPU block.
# dict is efficient in lookup `if cpu_block in mapping`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a better approach if we do list(mapping.items()) in the worker layer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the mapping semantics are better represented by dict[int, int], which is why I ask

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cadedaniel This is basically for performance. List append/extend is faster than Dict insert/update.

@simon-mo simon-mo merged commit 20cfcde into vllm-project:main May 8, 2024
53 of 55 checks passed
@youkaichao youkaichao deleted the blocks_to_swap_out branch May 8, 2024 19:14
z103cb pushed a commit to z103cb/opendatahub_vllm that referenced this pull request May 9, 2024
robertgshaw2-neuralmagic pushed a commit to neuralmagic/nm-vllm that referenced this pull request May 19, 2024
dtrifiro pushed a commit to dtrifiro/vllm that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants