From e76037834ab6c854a3393047ddefbd036e34b522 Mon Sep 17 00:00:00 2001 From: Ahmed Gheith Date: Tue, 12 Nov 2024 07:10:32 -0800 Subject: [PATCH] Log REMOTE_CACHE_VERSION (#2538) Summary: X-link: https://github.com/pytorch/pytorch/pull/140174 title Reviewed By: ezyang Differential Revision: D65667421 --- userbenchmark/dynamo/dynamobench/_dynamo/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/userbenchmark/dynamo/dynamobench/_dynamo/utils.py b/userbenchmark/dynamo/dynamobench/_dynamo/utils.py index 6e3549b6a..6c3e73c8a 100644 --- a/userbenchmark/dynamo/dynamobench/_dynamo/utils.py +++ b/userbenchmark/dynamo/dynamobench/_dynamo/utils.py @@ -412,6 +412,18 @@ def dynamo_timed( structured_logging_overhead_s = ( torch._logging.get_structured_logging_overhead() ) + + # REMOTE_CACHE_VERSION is fbcode specific + # TODO: move REMOTE_CACHE_VERSION to the OSS side + remote_cache_version: Optional[int] = None + try: + from torch._environment import is_fbcode + if is_fbcode(): + from torch._inductor.fb.remote_cache import REMOTE_CACHE_VERSION + remote_cache_version = REMOTE_CACHE_VERSION + except Exception: + pass + metrics = CompilationMetrics( compile_id=compile_id, inductor_compile_time_s=inductor_compile_time, @@ -419,6 +431,7 @@ def dynamo_timed( fail_type=fail_type, fail_reason=fail_reason, remote_cache_time_saved_s=remote_cache_time_saved, + remote_cache_version=remote_cache_version, structured_logging_overhead_s=structured_logging_overhead_s, is_forward=False, # is_forward num_triton_bundles=codecache_metrics.get( @@ -898,6 +911,7 @@ class CompilationMetrics: # a compiled frame has_guarded_code: Optional[bool] = None remote_cache_time_saved_s: Optional[float] = None + remote_cache_version: Optional[int] = None structured_logging_overhead_s: Optional[float] = None config_suppress_errors: Optional[bool] = None config_inline_inbuilt_nn_modules: Optional[bool] = None