support view_from_cpu_tensor on XPU (#33868)

Signed-off-by: Xinyu Chen <xinyu1.chen@intel.com>
This commit is contained in:
Xinyu Chen
2026-02-06 16:34:20 +08:00
committed by GitHub
parent 6d8d34be6d
commit e969a169ef
4 changed files with 13 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ from vllm.utils.platform_utils import (
)
from vllm.utils.torch_utils import (
direct_register_custom_op,
get_cuda_view_from_cpu_tensor,
get_accelerator_view_from_cpu_tensor,
)
logger = init_logger(__name__)
@@ -663,7 +663,7 @@ def maybe_offload_to_cpu(module: torch.nn.Module) -> torch.nn.Module:
else:
# keep the cpu data alive
p._vllm_offloaded_cpu_data = cpu_data
p.data = get_cuda_view_from_cpu_tensor(cpu_data)
p.data = get_accelerator_view_from_cpu_tensor(cpu_data)
_CPU_OFFLOAD_BYTES += p.data.numel() * p.data.element_size()
offloaded_parameters = True