8000 Compare device name of profiler dynamically (#150396) · pytorch/pytorch@0da8127 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0da8127

Browse files
elpis-furiosapytorchmergebot
authored andcommitted
Compare device name of profiler dynamically (#150396)
Compare self.use_device of torch.autograd.profiler.profiler with _get_privateuse1_backend_name(), since privateuse1 backend can be renamed. Pull Request resolved: #150396 Approved by: https://github.com/sraikund16
1 parent c65de03 commit 0da8127

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch/autograd/profiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def _device_memory_usage(mem_record):
629629
)
630630
max_evt_id = max(max_evt_id, fe.id)
631631
if fe.device_type == DeviceType.CPU and not fe.is_async:
632-
if self.use_device == "privateuseone":
632+
if self.use_device == _get_privateuse1_backend_name():
633633
privateuse1_time = kineto_event.privateuse1_elapsed_us()
634634
if privateuse1_time > 0:
635635
fe.append_kernel(fe.name, fe.device_index, privateuse1_time)

0 commit comments

Comments
 (0)
0