8000 [Intel GPU] Add synchronize() in torch.utils.benchmark · pytorch/pytorch@ddaace6 · GitHub
[go: up one dir, main page]

Skip to content

Commit ddaace6

Browse files
committed
[Intel GPU] Add synchronize() in torch.utils.benchmark
1 parent 9b06b30 commit ddaace6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torch/utils/benchmark/utils/timer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
def timer() -> float:
1818
torch.cuda.synchronize()
1919
return timeit.default_timer()
20+
elif torch.xpu.is_available():
21+
def timer() -> float:
22+
torch.xpu.synchronize()
23+
return timeit.default_timer()
2024
elif torch._C._get_privateuse1_backend_name() != "privateuseone":
2125
privateuse1_device_handler = getattr(torch, torch._C._get_privateuse1_backend_name(), None) \
2226
if torch._C._get_privateuse1_backend_name() != "cpu" else None

0 commit comments

Comments
 (0)
0