@@ -12,7 +12,9 @@ use crate::environment::{Environment, EnvironmentBuilder};
1212use crate :: exec:: { cmd, Bootstrap } ;
1313use crate :: tests:: run_tests;
1414use crate :: timer:: Timer ;
15- use crate :: training:: { gather_bolt_profiles, gather_llvm_profiles, gather_rustc_profiles} ;
15+ use crate :: training:: {
16+ gather_bolt_profiles, gather_llvm_profiles, gather_rustc_profiles, llvm_benchmarks,
17+ } ;
1618use crate :: utils:: io:: { copy_directory, move_directory, reset_directory} ;
1719use crate :: utils:: {
1820 clear_llvm_files, format_env_variables, print_binary_sizes, print_free_disk_space,
@@ -270,9 +272,9 @@ fn execute_pipeline(
270272 log:: info!( "Optimizing {llvm_lib} with BOLT" ) ;
271273
272274 // Instrument it and gather profiles
273- let profile = with_bolt_instrumented ( & llvm_lib, || {
275+ let profile = with_bolt_instrumented ( & llvm_lib, |llvm_profile_dir | {
274276 stage. section ( "Gather profiles" , |_| {
275- gather_bolt_profiles ( env, "LLVM" , llvm_benchmarks ( env) )
277+ gather_bolt_profiles ( env, "LLVM" , llvm_benchmarks ( env) , llvm_profile_dir )
276278 } )
277279 } ) ?;
278280 print_free_disk_space ( ) ?;
@@ -291,34 +293,34 @@ fn execute_pipeline(
291293 None
292294 } ;
293295
294- let rustc_bolt_profile = if env. supports_bolt ( ) {
295- // Stage 4: Build BOLT instrumented rustc
296- timer. section ( "Stage 4 (Rustc BOLT)" , |stage| {
297- // Find the path to the `librustc_driver.so` file
298- let rustc_lib = io:: find_file_in_dir (
299- & env. build_artifacts ( ) . join ( "stage2" ) . join ( "lib" ) ,
300- "librustc_driver" ,
301- ".so" ,
302- ) ?;
303-
304- log:: info!( "Optimizing {rustc_lib} with BOLT" ) ;
305-
306- // Instrument it and gather profiles
307- let profile = with_bolt_instrumented ( & rustc_lib, || {
308- stage. section ( "Gather profiles" , |_| {
309- gather_bolt_profiles ( env, "rustc" , rustc_benchmarks ( env) )
310- } )
311- } ) ?;
312- print_free_disk_space ( ) ?;
313-
314- // Now optimize the library with BOLT.
315- bolt_optimize ( & rustc_lib, & profile) . context ( "Could not optimize rustc with BOLT" ) ?;
316-
317- Ok ( Some ( profile) )
318- } ) ?
319- } else {
320- None
321- } ;
296+ // let rustc_bolt_profile = if env.use_bolt () {
297+ // // Stage 4: Build BOLT instrumented rustc
298+ // timer.section("Stage 4 (Rustc BOLT)", |stage| {
299+ // // Find the path to the `librustc_driver.so` file
300+ // let rustc_lib = io::find_file_in_dir(
301+ // &env.build_artifacts().join("stage2").join("lib"),
302+ // "librustc_driver",
303+ // ".so",
304+ // )?;
305+ //
306+ // log::info!("Optimizing {rustc_lib} with BOLT");
307+ //
308+ // // Instrument it and gather profiles
309+ // let profile = with_bolt_instrumented(&rustc_lib, || {
310+ // stage.section("Gather profiles", |_| {
311+ // gather_bolt_profiles(env, "rustc", rustc_benchmarks(env))
312+ // })
313+ // })?;
314+ // print_free_disk_space()?;
315+ //
316+ // // Now optimize the library with BOLT.
317+ // bolt_optimize(&rustc_lib, &profile).context("Could not optimize rustc with BOLT")?;
318+ //
319+ // Ok(Some(profile))
320+ // })?
321+ // } else {
322+ // None
323+ // };
322324
323325 let mut dist = Bootstrap :: dist ( env, & dist_args)
324326 . llvm_pgo_optimize ( & llvm_pgo_profile)
@@ -328,9 +330,9 @@ fn execute_pipeline(
328330 if let Some ( llvm_bolt_profile) = llvm_bolt_profile {
329331 dist = dist. with_bolt_profile ( llvm_bolt_profile) ;
330332 }
331- if let Some ( rustc_bolt_profile) = rustc_bolt_profile {
332- dist = dist. with_bolt_profile ( rustc_bolt_profile) ;
333- }
333+ // if let Some(rustc_bolt_profile) = rustc_bolt_profile {
334+ // dist = dist.with_bolt_profile(rustc_bolt_profile);
335+ // }
334336
335337 // Final stage: Assemble the dist artifacts
336338 // The previous PGO optimized rustc build and PGO optimized LLVM builds should be reused.
0 commit comments