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

Add logger logging for remote fx graph cache get + put #2512

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,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 @@ -356,6 +364,8 @@ def dynamo_timed(
fail_reason,
remote_cache_time_saved,
structured_logging_overhead_s,
to_int_ms(remote_fx_graph_cache_get_time),
to_int_ms(remote_fx_graph_cache_put_time),
)
record_compilation_metrics(metrics)

Expand Down Expand Up @@ -762,6 +772,10 @@ def proxy_args_kwargs(args, kwargs):
)


def to_int_ms(v: Optional[float]) -> Optional[int]:
return None if v is None else int(v * 1000)


@dataclasses.dataclass
class CompilationMetrics:
is_forward: bool = dataclasses.field(default=True, init=False)
Expand Down Expand Up @@ -801,6 +815,8 @@ class CompilationMetrics:
config_inline_inbuilt_nn_modules: Optional[bool]
specialize_float: Optional[bool]
dynamo_config: Optional[str]
remote_fx_graph_cache_get_time_ms: Optional[int]
remote_fx_graph_cache_put_time_ms: Optional[int]


@dataclasses.dataclass
Expand All @@ -813,6 +829,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_ms: Optional[int]
remote_fx_graph_cache_put_time_ms: Optional[int]


DEFAULT_COMPILATION_METRICS_LIMIT = 64
Expand Down
Loading