@@ -29,7 +29,6 @@ pub struct ParseConfig {
2929 pub verbose : bool ,
3030 pub plain_text : bool ,
3131 pub export : bool ,
32- pub inductor_provenance : bool ,
3332}
3433
3534impl Default for ParseConfig {
@@ -42,7 +41,6 @@ impl Default for ParseConfig {
4241 verbose : false ,
4342 plain_text : false ,
4443 export : false ,
45- inductor_provenance : false ,
4644 }
4745 }
4846}
@@ -793,7 +791,10 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
793791 num_breaks : breaks. failures . len ( ) ,
794792 has_chromium_events : !chromium_events. is_empty ( ) ,
795793 qps : TEMPLATE_QUERY_PARAM_SCRIPT ,
796- has_inductor_provenance : config. inductor_provenance ,
794+ has_inductor_provenance : output. iter ( ) . any ( |( path, _) | {
795+ path. to_string_lossy ( )
796+ . contains ( "inductor_provenance_tracking_node_mappings" )
797+ } ) ,
797798 directory_names : directory_names. clone ( ) ,
798799 } ;
799800 output. push ( (
@@ -822,57 +823,54 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
822823 return Err ( anyhow ! ( "Some log entries did not have compile id" ) ) ;
823824 }
824825
825- if config. inductor_provenance {
826- // Helper function to get file content for a specific directory name
827- fn get_file_content (
828- output : & [ ( PathBuf , String ) ] ,
829- filename_pattern : & str ,
830- directory_name : & str ,
831- ) -> String {
832- // get the last file that include the filename_pattern in the output
833- output
834- . iter ( )
835- . rev ( )
836- . find ( |( path, _) | {
837- path. to_string_lossy ( )
838- . contains ( & format ! ( "{}/{}" , directory_name, filename_pattern) )
839- } )
840- . map ( |( _, content) | content. clone ( ) )
841- . unwrap_or_default ( )
842- }
826+ // Helper function to get file content for a specific directory name
827+ fn get_file_content (
828+ output : & [ ( PathBuf , String ) ] ,
829+ filename_pattern : & str ,
830+ directory_name : & str ,
831+ ) -> String {
832+ // get the last file that include the filename_pattern in the output
833+ output
834+ . iter ( )
835+ . rev ( )
836+ . find ( |( path, _) | {
837+ path. to_string_lossy ( )
838+ . contains ( & format ! ( "{}/{}" , directory_name, filename_pattern) )
839+ } )
840+ . map ( |( _, content) | content. clone ( ) )
841+ . unwrap_or_default ( )
842+ }
843843
844- // Generate HTML for each directory name
845- for directory_name in & directory_names {
846- let pre_grad_graph_content =
847- get_file_content ( & output, "inductor_pre_grad_graph" , directory_name) ;
848- let post_grad_graph_content =
849- get_file_content ( & output, "inductor_post_grad_graph" , directory_name) ;
850- let output_code_content =
851- get_file_content ( & output, "inductor_output_code" , directory_name) ;
852- let aot_code_content =
853- get_file_content ( & output, "inductor_aot_wrapper_code" , directory_name) ;
854- let node_mappings_content = get_file_content (
855- & output,
856- "inductor_provenance_tracking_node_mappings" ,
857- directory_name,
858- ) ;
844+ // Generate Inductor Provenance Tracking HTML for each directory name
845+ for directory_name in & directory_names {
846+ let pre_grad_graph_content =
847+ get_file_content ( & output, "inductor_pre_grad_graph" , directory_name) ;
848+ let post_grad_graph_content =
849+ get_file_content ( & output, "inductor_post_grad_graph" , directory_name) ;
850+ let output_code_content = get_file_content ( & output, "inductor_output_code" , directory_name) ;
851+ let aot_code_content =
852+ get_file_content ( & output, "inductor_aot_wrapper_code" , directory_name) ;
853+ let node_mappings_content = get_file_content (
854+ & output,
855+ "inductor_provenance_tracking_node_mappings" ,
856+ directory_name,
857+ ) ;
859858
860- output. push ( (
861- PathBuf :: from ( format ! ( "provenance_tracking_{}.html" , directory_name) ) ,
862- tt. render (
863- "provenance_tracking.html" ,
864- & ProvenanceContext {
865- css : PROVENANCE_CSS ,
866- js : PROVENANCE_JS ,
867- pre_grad_graph_content,
868- post_grad_graph_content,
869- output_code_content,
870- aot_code_content,
871- node_mappings_content,
872- } ,
873- ) ?,
874- ) ) ;
875- }
859+ output. push ( (
860+ PathBuf :: from ( format ! ( "provenance_tracking_{}.html" , directory_name) ) ,
861+ tt. render (
862+ "provenance_tracking.html" ,
863+ & ProvenanceContext {
864+ css : PROVENANCE_CSS ,
865+ js : PROVENANCE_JS ,
866+ pre_grad_graph_content,
867+ post_grad_graph_content,
868+ output_code_content,
869+ aot_code_content,
870+ node_mappings_content,
871+ } ,
872+ ) ?,
873+ ) ) ;
876874 }
877875
878876 Ok ( output)
0 commit comments