@@ -412,13 +412,26 @@ def dynamo_timed(
412
412
structured_logging_overhead_s = (
413
413
torch ._logging .get_structured_logging_overhead ()
414
414
)
415
+
416
+ # REMOTE_CACHE_VERSION is fbcode specific
417
+ # TODO: move REMOTE_CACHE_VERSION to the OSS side
418
+ remote_cache_version : Optional [int ] = None
419
+ try :
420
+ from torch ._environment import is_fbcode
421
+ if is_fbcode ():
422
+ from torch ._inductor .fb .remote_cache import REMOTE_CACHE_VERSION
423
+ remote_cache_version = REMOTE_CACHE_VERSION
424
+ except Exception :
425
+ pass
426
+
415
427
metrics = CompilationMetrics (
416
428
compile_id = compile_id ,
417
429
inductor_compile_time_s = inductor_compile_time ,
418
430
code_gen_time_s = code_gen_time ,
419
431
fail_type = fail_type ,
420
432
fail_reason = fail_reason ,
421
433
remote_cache_time_saved_s = remote_cache_time_saved ,
434
+ remote_cache_version = remote_cache_version ,
422
435
structured_logging_overhead_s = structured_logging_overhead_s ,
423
436
is_forward = False , # is_forward
424
437
num_triton_bundles = codecache_metrics .get (
@@ -898,6 +911,7 @@ class CompilationMetrics:
898
911
# a compiled frame
899
912
has_guarded_code : Optional [bool ] = None
900
913
remote_cache_time_saved_s : Optional [float ] = None
914
+ remote_cache_version : Optional [int ] = None
901
915
structured_logging_overhead_s : Optional [float ] = None
902
916
config_suppress_errors : Optional [bool ] = None
903
917
config_inline_inbuilt_nn_modules : Optional [bool ] = None
0 commit comments