[Perf][4/n] Eliminate various GPU<->CPU syncs (#42347)
Signed-off-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
@@ -101,6 +101,7 @@ from vllm.utils.collection_utils import is_list_of
|
||||
from vllm.utils.math_utils import round_up
|
||||
from vllm.v1.worker.encoder_cudagraph_defs import EncoderCudaGraphReplayBuffers
|
||||
|
||||
from ...utils.torch_utils import async_tensor_h2d
|
||||
from .interfaces import (
|
||||
MultiModalEmbeddings,
|
||||
SupportsEagle,
|
||||
@@ -2157,7 +2158,9 @@ class Qwen3VLForConditionalGeneration(
|
||||
grid_thw_list = grid_thw.tolist()
|
||||
image_embeds_out = []
|
||||
for emb, size in zip(image_embeds_split, grid_thw_list):
|
||||
positions = compute_mrope_for_media(size, merge_size).to(emb.device)
|
||||
positions = compute_mrope_for_media(size, merge_size).to(
|
||||
emb.device, non_blocking=True
|
||||
)
|
||||
positions = torch.cat(
|
||||
[
|
||||
positions,
|
||||
@@ -2388,7 +2391,7 @@ class Qwen3VLForConditionalGeneration(
|
||||
input_tokens=unpruned_token_ids,
|
||||
mm_features=[mm_feature],
|
||||
)[0]
|
||||
.to(device)
|
||||
.to(device, non_blocking=True)
|
||||
.permute(1, 0)
|
||||
)
|
||||
full_is_video_embed = unpruned_token_ids_tensor == embed_token_id
|
||||
@@ -2636,7 +2639,7 @@ class Qwen3VLForConditionalGeneration(
|
||||
)
|
||||
|
||||
# Tensors
|
||||
input_ids_t = torch.as_tensor(input_ids, device=device, dtype=torch.long)
|
||||
input_ids_t = async_tensor_h2d(input_ids, device=device, dtype=torch.long)
|
||||
|
||||
mm_embeddings_out = []
|
||||
mm_embeddings_pos = []
|
||||
|
||||
Reference in New Issue
Block a user