@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / dd39baf717
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[XPU] Fix xpu model runner call torch.cuda APIs (#25011)

Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>

Kunshang Ji committed Sep 17, 2025 at 14:45 UTC dd39baf7175c5e79faef071c67bb318eadb7752f
1 file changed +5 -1
vllm/v1/worker/xpu_model_runner.py
+5 -1
@@ -45,8 +45,12 @@ def _torch_cuda_wrapper():
45 self.synchronize = lambda: None
46
47 try:
48 - # replace cuda Event with xpu Event, this should work by default
48 + # replace cuda APIs with xpu APIs, this should work by default
49 torch.cuda.Event = torch.xpu.Event
50 + torch.cuda.Stream = torch.xpu.Stream
51 + torch.cuda.default_stream = torch.xpu.current_stream
52 + torch.cuda.current_stream = torch.xpu.current_stream
53 + torch.cuda.stream = torch.xpu.stream
54 yield
55 finally:
56 # if anything goes wrong, just patch it with a placeholder