@@ -1315,6 +1315,7 @@ class CompilationMetrics:
13151315    config_inline_inbuilt_nn_modules : Optional [bool ] =  None 
13161316    specialize_float : Optional [bool ] =  None 
13171317    dynamo_config : Optional [str ] =  None 
1318+     compiler_config : Optional [str ] =  None 
13181319    is_forward : Optional [bool ] =  None 
13191320    num_triton_bundles : Optional [int ] =  None 
13201321    remote_fx_graph_cache_get_time_ms : Optional [int ] =  None 
@@ -1555,6 +1556,30 @@ def clean_for_json(d: dict[str, Any]) -> dict[str, Any]:
15551556    return  json .dumps (config_dict , sort_keys = True )
15561557
15571558
1559+ def  _compiler_config_for_logging () ->  Optional [str ]:
1560+     def  clean_for_json (d : dict [str , Any ]) ->  dict [str , Any ]:
1561+         blocklist  =  {
1562+             "TYPE_CHECKING" ,
1563+         }
1564+ 
1565+         return  {
1566+             key : sorted (value ) if  isinstance (value , set ) else  value 
1567+             for  key , value  in  d .items ()
1568+             if  key  not  in   blocklist 
1569+         }
1570+ 
1571+     if  not  torch .compiler .config :
1572+         return  None 
1573+ 
1574+     try :
1575+         compiler_config_copy  =  torch .compiler .config .get_config_copy ()  # type: ignore[attr-defined] 
1576+     except  (TypeError , AttributeError ):
1577+         return  "Compiler Config cannot be pickled" 
1578+ 
1579+     config_dict  =  clean_for_json (compiler_config_copy )
1580+     return  json .dumps (config_dict , sort_keys = True )
1581+ 
1582+ 
15581583def  _scrubbed_inductor_config_for_logging () ->  Optional [str ]:
15591584    """ 
15601585    Method to parse and scrub uninteresting configs from inductor config 
@@ -1642,6 +1667,7 @@ def record_compilation_metrics(
16421667        "config_suppress_errors" : config .suppress_errors ,
16431668        "config_inline_inbuilt_nn_modules" : config .inline_inbuilt_nn_modules ,
16441669        "inductor_config" : _scrubbed_inductor_config_for_logging (),
1670+         "compiler_config" : _compiler_config_for_logging (),
16451671        "cuda_version" : torch .version .cuda ,
16461672        "triton_version" : triton .__version__  if  has_triton () else  "" ,
16471673        "remote_cache_version" : remote_cache_version ,
0 commit comments