[XPU] Fix Event init failure w/ blocking (#47868)
Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user