[MRV2] Buffer util simplifications (#56888)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
Nick Hill
2026-09-15 20:36:51 +00:00
committed by GitHub
parent b6ce714354
commit f2aad6aa70
21 changed files with 125 additions and 112 deletions
+3 -2
View File
@@ -10,6 +10,7 @@
import torch
from vllm.utils.gpu_sync_debug import gpu_sync_allowed
from vllm.utils.torch_utils import async_tensor_h2d
from vllm.triton_utils import triton
from .utils import tensor_cache
@@ -27,8 +28,8 @@ def prepare_chunk_indices(cu_seqlens: torch.Tensor, chunk_size: int) -> torch.Te
chunk_counts = triton.cdiv(prepare_lens(cu_seqlens), chunk_size).tolist()
indices = torch.cat([torch.arange(n) for n in chunk_counts])
chunk_indices = torch.stack([indices.eq(0).cumsum(0) - 1, indices], 1)
return chunk_indices.to(
device=cu_seqlens.device, dtype=cu_seqlens.dtype, non_blocking=True
return async_tensor_h2d(
chunk_indices, device=cu_seqlens.device, dtype=cu_seqlens.dtype
)