Skip to content

Commit c19f824

Browse files
xmfanfacebook-github-bot
authored andcommitted
update compile time benchmarks to dump compile times to stdout and csv (#145447)
Summary: ```python # inductor.csv dev,name,batch_size,accuracy,calls_captured,unique_graphs,graph_breaks,unique_graph_breaks,autograd_captures,autograd_compiles,cudagraph_skips,compilation_latency cuda,cait_m36_384,8,pass,2510,1,0,0,0,0,0,87.705186 ``` ```python loading model: 0it [01:27, ?it/s] cuda eval cait_m36_384 Compilation time (from dynamo_timed): 87.705186276 # <---------------- pass TIMING: _recursive_pre_grad_passes:0.11023 pad_mm_benchmark:0.50341 _recursive_joint_graph_passes:3.88557 _recursive_post_grad_passes:6.71182 async_compile.wait:4.16914 code_gen:17.57586 inductor_compile:42.55769 backend_compile:72.47122 entire_frame_compile:87.70519 gc:0.00112 total_wall_time:87.70519 STATS: call_* op count: 2510 | FakeTensorMode.__torch_dispatch__:101743 | FakeTensor.__torch_dispatch__:12959 | ProxyTorchDispatchMode.__torch_dispatch__:41079 Dynamo produced 1 graphs covering 2510 ops with 0 graph breaks (0 unique) ``` X-link: pytorch/pytorch#145447 Approved by: https://github.com/ezyang Reviewed By: izaitsevfb Differential Revision: D68570811 fbshipit-source-id: c7101c08a3435fa3567bce505f73eda86d056d63
1 parent 412a0f3 commit c19f824

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

userbenchmark/dynamo/dynamobench/common.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ def output_signpost(data, args, suite, error=None):
538538

539539
from torch._dynamo.utils import calculate_time_spent, compilation_time_metrics
540540

541+
wall_time_by_phase = calculate_time_spent()
542+
541543
open_source_signpost(
542544
subsystem="dynamo_benchmark",
543545
name=event_name,
@@ -550,7 +552,7 @@ def output_signpost(data, args, suite, error=None):
550552
# NB: Externally, compilation_metrics colloquially refers to
551553
# the coarse-grained phase timings, even though internally
552554
# they are called something else
553-
"compilation_metrics": calculate_time_spent(),
555+
"compilation_metrics": wall_time_by_phase,
554556
"agg_compilation_metrics": {
555557
k: sum(v) for k, v in compilation_time_metrics.items()
556558
},
@@ -563,6 +565,8 @@ def output_signpost(data, args, suite, error=None):
563565
),
564566
)
565567

568+
return wall_time_by_phase["total_wall_time"]
569+
566570

567571
def nothing(f):
568572
return f
@@ -2917,13 +2921,17 @@ def record_status(accuracy_status, dynamo_start_stats):
29172921
headers.append(k)
29182922
fields.append(v)
29192923

2920-
write_outputs(output_filename, headers, fields)
2921-
2922-
output_signpost(
2924+
total_wall_time = output_signpost(
29232925
dict(zip(o_headers, o_fields)),
29242926
self.args,
29252927
self.suite_name,
29262928
)
2929+
headers.append("compilation_latency")
2930+
fields.append(total_wall_time)
2931+
write_outputs(output_filename, headers, fields)
2932+
2933+
if self.args.print_compilation_time:
2934+
print(f"Compilation time (from dynamo_timed): {total_wall_time}")
29272935

29282936
return accuracy_status
29292937

0 commit comments

Comments
 (0)