@@ -3,6 +3,7 @@ use crate::compile::benchmark::codegen_backend::CodegenBackend;
33use crate :: compile:: benchmark:: patch:: Patch ;
44use crate :: compile:: benchmark:: profile:: Profile ;
55use crate :: compile:: benchmark:: scenario:: Scenario ;
6+ use crate :: compile:: benchmark:: compiler_target:: CompilerTarget ;
67use crate :: compile:: execute:: { CargoProcess , Processor } ;
78use crate :: toolchain:: Toolchain ;
89use crate :: utils:: wait_for_future;
@@ -20,6 +21,7 @@ pub mod codegen_backend;
2021pub ( crate ) mod patch;
2122pub mod profile;
2223pub mod scenario;
24+ pub mod compiler_target;
2325
2426fn default_runs ( ) -> usize {
2527 3
@@ -180,6 +182,7 @@ impl Benchmark {
180182 cwd : & ' a Path ,
181183 profile : Profile ,
182184 backend : CodegenBackend ,
185+ compiler_target : & ' a CompilerTarget ,
183186 ) -> CargoProcess < ' a > {
184187 let mut cargo_args = self
185188 . config
@@ -220,6 +223,7 @@ impl Benchmark {
220223 . collect ( ) ,
221224 touch_file : self . config . touch_file . clone ( ) ,
222225 jobserver : None ,
226+ compiler_target,
223227 }
224228 }
225229
@@ -232,6 +236,7 @@ impl Benchmark {
232236 backends : & [ CodegenBackend ] ,
233237 toolchain : & Toolchain ,
234238 iterations : Option < usize > ,
239+ compiler_targets : & [ CompilerTarget ]
235240 ) -> anyhow:: Result < ( ) > {
236241 if self . config . disabled {
237242 eprintln ! ( "Skipping {}: disabled" , self . name) ;
@@ -263,10 +268,12 @@ impl Benchmark {
263268 }
264269
265270 eprintln ! ( "Preparing {}" , self . name) ;
266- let mut target_dirs: Vec < ( ( CodegenBackend , Profile ) , TempDir ) > = vec ! [ ] ;
271+ let mut target_dirs: Vec < ( ( CodegenBackend , Profile , & CompilerTarget ) , TempDir ) > = vec ! [ ] ;
267272 for backend in backends {
268273 for profile in & profiles {
269- target_dirs. push ( ( ( * backend, * profile) , self . make_temp_dir ( & self . path ) ?) ) ;
274+ for compiler_target in compiler_targets {
275+ target_dirs. push ( ( ( * backend, * profile, & compiler_target) , self . make_temp_dir ( & self . path ) ?) ) ;
276+ }
270277 }
271278 }
272279
@@ -304,12 +311,12 @@ impl Benchmark {
304311 )
305312 . context ( "jobserver::new" ) ?;
306313 let mut threads = Vec :: with_capacity ( target_dirs. len ( ) ) ;
307- for ( ( backend, profile) , prep_dir) in & target_dirs {
314+ for ( ( backend, profile, compiler_target ) , prep_dir) in & target_dirs {
308315 let server = server. clone ( ) ;
309316 let thread = s. spawn :: < _ , anyhow:: Result < ( ) > > ( move || {
310317 wait_for_future ( async move {
311318 let server = server. clone ( ) ;
312- self . mk_cargo_process ( toolchain, prep_dir. path ( ) , * profile, * backend)
319+ self . mk_cargo_process ( toolchain, prep_dir. path ( ) , * profile, * backend, compiler_target )
313320 . jobserver ( server)
314321 . run_rustc ( false )
315322 . await ?;
@@ -343,12 +350,13 @@ impl Benchmark {
343350 let mut timing_dirs: Vec < ManuallyDrop < TempDir > > = vec ! [ ] ;
344351
345352 let benchmark_start = std:: time:: Instant :: now ( ) ;
346- for ( ( backend, profile) , prep_dir) in & target_dirs {
353+ for ( ( backend, profile, compiler_target ) , prep_dir) in & target_dirs {
347354 let backend = * backend;
348355 let profile = * profile;
356+ let compiler_target = * compiler_target;
349357 eprintln ! (
350- "Running {}: {:?} + {:?} + {:?}" ,
351- self . name, profile, scenarios, backend
358+ "Running {}: {:?} + {:?} + {:?} + {:?} " ,
359+ self . name, profile, scenarios, backend, compiler_target ,
352360 ) ;
353361
354362 // We want at least two runs for all benchmarks (since we run
@@ -370,7 +378,7 @@ impl Benchmark {
370378
371379 // A full non-incremental build.
372380 if scenarios. contains ( & Scenario :: Full ) {
373- self . mk_cargo_process ( toolchain, cwd, profile, backend)
381+ self . mk_cargo_process ( toolchain, cwd, profile, backend, & compiler_target )
374382 . processor ( processor, Scenario :: Full , "Full" , None )
375383 . run_rustc ( true )
376384 . await ?;
@@ -381,7 +389,7 @@ impl Benchmark {
381389 // An incremental from scratch (slowest incremental case).
382390 // This is required for any subsequent incremental builds.
383391 if scenarios. iter ( ) . any ( |s| s. is_incr ( ) ) {
384- self . mk_cargo_process ( toolchain, cwd, profile, backend)
392+ self . mk_cargo_process ( toolchain, cwd, profile, backend, & compiler_target )
385393 . incremental ( true )
386394 . processor ( processor, Scenario :: IncrFull , "IncrFull" , None )
387395 . run_rustc ( true )
@@ -390,7 +398,7 @@ impl Benchmark {
390398
391399 // An incremental build with no changes (fastest incremental case).
392400 if scenarios. contains ( & Scenario :: IncrUnchanged ) {
393- self . mk_cargo_process ( toolchain, cwd, profile, backend)
401+ self . mk_cargo_process ( toolchain, cwd, profile, backend, & compiler_target )
394402 . incremental ( true )
395403 . processor ( processor, Scenario :: IncrUnchanged , "IncrUnchanged" , None )
396404 . run_rustc ( true )
@@ -405,7 +413,7 @@ impl Benchmark {
405413 // An incremental build with some changes (realistic
406414 // incremental case).
407415 let scenario_str = format ! ( "IncrPatched{}" , i) ;
408- self . mk_cargo_process ( toolchain, cwd, profile, backend)
416+ self . mk_cargo_process ( toolchain, cwd, profile, backend, & compiler_target )
409417 . incremental ( true )
410418 . processor (
411419 processor,
0 commit comments