mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-17 15:15:42 +08:00
[XPU] Fix xpu model runner call torch.cuda APIs (#25011)
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
parent
43a62c51be
commit
dd39baf717
@ -45,8 +45,12 @@ def _torch_cuda_wrapper():
|
|||||||
self.synchronize = lambda: None
|
self.synchronize = lambda: None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# replace cuda Event with xpu Event, this should work by default
|
# replace cuda APIs with xpu APIs, this should work by default
|
||||||
torch.cuda.Event = torch.xpu.Event
|
torch.cuda.Event = torch.xpu.Event
|
||||||
|
torch.cuda.Stream = torch.xpu.Stream
|
||||||
|
torch.cuda.default_stream = torch.xpu.current_stream
|
||||||
|
torch.cuda.current_stream = torch.xpu.current_stream
|
||||||
|
torch.cuda.stream = torch.xpu.stream
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
# if anything goes wrong, just patch it with a placeholder
|
# if anything goes wrong, just patch it with a placeholder
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user