Skip to content

Commit

Permalink
Add logger logging for remote fx graph cache get + put (#2512)
Browse files Browse the repository at this point in the history
Summary:

X-link: pytorch/pytorch#138164

Capture the timing for the remote fx graph cache get and put operations and add them to the logger logging.

Reviewed By: oulgen

Differential Revision: D64484025
  • Loading branch information
masnesral authored and facebook-github-bot committed Oct 17, 2024
1 parent 58f3b1f commit 3a90458
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,18 @@ def dynamo_timed(
remote_cache_time_saved = frame_phase_timing[
compile_id
].get("remote_cache_time_saved", None)
remote_fx_graph_cache_get_time = frame_phase_timing[
compile_id
].get("remote_fx_graph_cache_get", None)
remote_fx_graph_cache_put_time = frame_phase_timing[
compile_id
].get("remote_fx_graph_cache_put", None)
else:
inductor_compile_time = None
code_gen_time = None
remote_cache_time_saved = None
remote_fx_graph_cache_get_time = None
remote_fx_graph_cache_put_time = None
structured_logging_overhead_s = (
torch._logging.get_structured_logging_overhead()
)
Expand All @@ -366,6 +374,8 @@ def dynamo_timed(
fail_reason,
remote_cache_time_saved,
structured_logging_overhead_s,
remote_fx_graph_cache_get_time,
remote_fx_graph_cache_put_time,
)
record_compilation_metrics(metrics)

Expand Down Expand Up @@ -810,6 +820,8 @@ class CompilationMetrics:
config_inline_inbuilt_nn_modules: Optional[bool]
specialize_float: Optional[bool]
dynamo_config: Optional[str]
remote_fx_graph_cache_get_time_s: Optional[float]
remote_fx_graph_cache_put_time_s: Optional[float]


@dataclasses.dataclass
Expand All @@ -821,6 +833,8 @@ class BwdCompilationMetrics:
fail_reason: Optional[str]
remote_cache_time_saved_s: Optional[float]
structured_logging_overhead_s: Optional[float]
remote_fx_graph_cache_get_time_s: Optional[float]
remote_fx_graph_cache_put_time_s: Optional[float]


DEFAULT_COMPILATION_METRICS_LIMIT = 64
Expand Down

0 comments on commit 3a90458

Please sign in to comment.