[Bugfix] Fix Stream usage in CPU model runner and OneDNN kernel check (#25046)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
Li, Jiang
2025-09-17 05:54:02 -07:00
committed by GitHub
parent 252ada5559
commit 9fccd04e30
3 changed files with 14 additions and 1 deletions
+8
View File
@@ -145,12 +145,20 @@ def _torch_cuda_wrapper():
self.record = lambda: None
self.synchronize = lambda: None
class _StreamPlaceholder:
def __init__(self, *args, **kwargs) -> None:
pass
cuda_event = torch.cuda.Event
cuda_stream = torch.cuda.Stream
try:
torch.cuda.Event = _EventPlaceholder
torch.cuda.Stream = _StreamPlaceholder
yield
finally:
torch.cuda.Event = cuda_event
torch.cuda.Stream = cuda_stream
@contextmanager