[Core][MM] Use non-blocking CPU-GPU copy of multimodal data#28141
Merged
ywang96 merged 2 commits intovllm-project:mainfrom Nov 6, 2025
Merged
[Core][MM] Use non-blocking CPU-GPU copy of multimodal data#28141ywang96 merged 2 commits intovllm-project:mainfrom
ywang96 merged 2 commits intovllm-project:mainfrom
Conversation
Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a performance optimization by enabling non-blocking CPU-to-GPU copies for multimodal data. The change correctly adds non_blocking=True to the torch.Tensor.to() call within group_mm_kwargs_by_modality, which prevents unnecessary CPU-GPU synchronization when using pinned memory. This is a valuable improvement that aligns the behavior of the new data path with the legacy one. The code change is correct and the performance gains are demonstrated by the provided profiler results. The pull request is well-justified and ready for merging.
ywang96
approved these changes
Nov 6, 2025
ZhengHongming888
pushed a commit
to ZhengHongming888/vllm
that referenced
this pull request
Nov 8, 2025
…ject#28141) Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>
devpatelio
pushed a commit
to SumanthRH/vllm
that referenced
this pull request
Nov 29, 2025
…ject#28141) Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
On
maingroup_mm_kwargs_by_modalitycurrently causes unnecessary CPU/GPU sync. This PR makes the copy non blocking to prevent this. Looks like this was missed in #25654 /cc @DarkLight1337Test Plan
Test Result
Before:

After: