[XPU] Fix Event init failure w/ blocking (#47868)

Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
This commit is contained in:
liuzhenwei
2026-07-07 22:54:03 +08:00
committed by GitHub
parent beb4327c46
commit bdaf27519f
+7 -1
View File
@@ -49,7 +49,13 @@ def _torch_cuda_wrapper():
torch.cuda.current_stream = partial(torch.xpu.current_stream)
torch.cuda.stream = partial(torch.xpu.stream)
torch.cuda.set_stream = partial(torch.xpu.set_stream)
torch.cuda.Event = partial(torch.xpu.Event)
# torch.xpu.Event does not accept the ``blocking`` kwarg that
# torch.cuda.Event supports, so drop it here.
def _xpu_event(*args, blocking=None, **kwargs):
return torch.xpu.Event(*args, **kwargs)
torch.cuda.Event = _xpu_event
if supports_xpu_graph():
torch.cuda.graph = partial(torch.xpu.graph)
torch.cuda.CUDAGraph = torch.xpu.XPUGraph