Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[benchmarks] Fix processing of PyTorch profiler events. #7930

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions benchmarks/experiment_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,11 +637,11 @@ def _collect_cuda_cpu_metrics(self, pytorch_profile: Optional[profile],
if evt.device_type == DeviceType.CPU:
# In legacy profiler, kernel info is stored in cpu events
if evt.is_legacy:
total_cuda_time += evt.self_cuda_time_total
total_cuda_time += evt.self_device_time_total
elif evt.device_type == DeviceType.CUDA:
# In kineto profiler, there're events with the correct device type
# (e.g. CUDA)
total_cuda_time += evt.self_cuda_time_total
total_cuda_time += evt.self_device_time_total

metrics["total_cpu_time_s"] = us_to_s(total_cpu_time)
metrics["total_cuda_time_s"] = us_to_s(total_cuda_time)
Expand All @@ -661,9 +661,9 @@ def is_aten_op(op_name):

extract_prof_info = lambda event: {
"self_cpu_time_s": us_to_s(event.self_cpu_time_total),
"self_cuda_time_s": us_to_s(event.self_cuda_time_total),
"self_cuda_time_s": us_to_s(event.self_device_time_total),
"total_cpu_time_s": us_to_s(event.cpu_time_total),
"total_cuda_time_s": us_to_s(event.cuda_time_total),
"total_cuda_time_s": us_to_s(event.device_time_total),
"num_of_calls": event.count
}

Expand Down
Loading