@@ -3,6 +3,7 @@ use crate::compile::benchmark::codegen_backend::CodegenBackend;
3
3
use crate :: compile:: benchmark:: patch:: Patch ;
4
4
use crate :: compile:: benchmark:: profile:: Profile ;
5
5
use crate :: compile:: benchmark:: scenario:: Scenario ;
6
+ use crate :: compile:: benchmark:: target:: Target ;
6
7
use crate :: compile:: execute:: { CargoProcess , Processor } ;
7
8
use crate :: toolchain:: Toolchain ;
8
9
use crate :: utils:: wait_for_future;
@@ -20,6 +21,7 @@ pub mod codegen_backend;
20
21
pub ( crate ) mod patch;
21
22
pub mod profile;
22
23
pub mod scenario;
24
+ pub mod target;
23
25
24
26
fn default_runs ( ) -> usize {
25
27
3
@@ -180,6 +182,7 @@ impl Benchmark {
180
182
cwd : & ' a Path ,
181
183
profile : Profile ,
182
184
backend : CodegenBackend ,
185
+ target : Target ,
183
186
) -> CargoProcess < ' a > {
184
187
let mut cargo_args = self
185
188
. config
@@ -220,10 +223,12 @@ impl Benchmark {
220
223
. collect ( ) ,
221
224
touch_file : self . config . touch_file . clone ( ) ,
222
225
jobserver : None ,
226
+ target,
223
227
}
224
228
}
225
229
226
230
/// Run a specific benchmark under a processor + profiler combination.
231
+ #[ allow( clippy:: too_many_arguments) ]
227
232
pub async fn measure (
228
233
& self ,
229
234
processor : & mut dyn Processor ,
@@ -232,6 +237,7 @@ impl Benchmark {
232
237
backends : & [ CodegenBackend ] ,
233
238
toolchain : & Toolchain ,
234
239
iterations : Option < usize > ,
240
+ targets : & [ Target ] ,
235
241
) -> anyhow:: Result < ( ) > {
236
242
if self . config . disabled {
237
243
eprintln ! ( "Skipping {}: disabled" , self . name) ;
@@ -263,10 +269,15 @@ impl Benchmark {
263
269
}
264
270
265
271
eprintln ! ( "Preparing {}" , self . name) ;
266
- let mut target_dirs: Vec < ( ( CodegenBackend , Profile ) , TempDir ) > = vec ! [ ] ;
272
+ let mut target_dirs: Vec < ( ( CodegenBackend , Profile , Target ) , TempDir ) > = vec ! [ ] ;
267
273
for backend in backends {
268
274
for profile in & profiles {
269
- target_dirs. push ( ( ( * backend, * profile) , self . make_temp_dir ( & self . path ) ?) ) ;
275
+ for target in targets {
276
+ target_dirs. push ( (
277
+ ( * backend, * profile, * target) ,
278
+ self . make_temp_dir ( & self . path ) ?,
279
+ ) ) ;
280
+ }
270
281
}
271
282
}
272
283
@@ -304,15 +315,21 @@ impl Benchmark {
304
315
)
305
316
. context ( "jobserver::new" ) ?;
306
317
let mut threads = Vec :: with_capacity ( target_dirs. len ( ) ) ;
307
- for ( ( backend, profile) , prep_dir) in & target_dirs {
318
+ for ( ( backend, profile, target ) , prep_dir) in & target_dirs {
308
319
let server = server. clone ( ) ;
309
320
let thread = s. spawn :: < _ , anyhow:: Result < ( ) > > ( move || {
310
321
wait_for_future ( async move {
311
322
let server = server. clone ( ) ;
312
- self . mk_cargo_process ( toolchain, prep_dir. path ( ) , * profile, * backend)
313
- . jobserver ( server)
314
- . run_rustc ( false )
315
- . await ?;
323
+ self . mk_cargo_process (
324
+ toolchain,
325
+ prep_dir. path ( ) ,
326
+ * profile,
327
+ * backend,
328
+ * target,
329
+ )
330
+ . jobserver ( server)
331
+ . run_rustc ( false )
332
+ . await ?;
316
333
Ok :: < ( ) , anyhow:: Error > ( ( ) )
317
334
} ) ?;
318
335
Ok ( ( ) )
@@ -343,12 +360,13 @@ impl Benchmark {
343
360
let mut timing_dirs: Vec < ManuallyDrop < TempDir > > = vec ! [ ] ;
344
361
345
362
let benchmark_start = std:: time:: Instant :: now ( ) ;
346
- for ( ( backend, profile) , prep_dir) in & target_dirs {
363
+ for ( ( backend, profile, target ) , prep_dir) in & target_dirs {
347
364
let backend = * backend;
348
365
let profile = * profile;
366
+ let target = * target;
349
367
eprintln ! (
350
- "Running {}: {:?} + {:?} + {:?}" ,
351
- self . name, profile, scenarios, backend
368
+ "Running {}: {:?} + {:?} + {:?} + {:?} " ,
369
+ self . name, profile, scenarios, backend, target ,
352
370
) ;
353
371
354
372
// We want at least two runs for all benchmarks (since we run
@@ -370,7 +388,7 @@ impl Benchmark {
370
388
371
389
// A full non-incremental build.
372
390
if scenarios. contains ( & Scenario :: Full ) {
373
- self . mk_cargo_process ( toolchain, cwd, profile, backend)
391
+ self . mk_cargo_process ( toolchain, cwd, profile, backend, target )
374
392
. processor ( processor, Scenario :: Full , "Full" , None )
375
393
. run_rustc ( true )
376
394
. await ?;
@@ -381,7 +399,7 @@ impl Benchmark {
381
399
// An incremental from scratch (slowest incremental case).
382
400
// This is required for any subsequent incremental builds.
383
401
if scenarios. iter ( ) . any ( |s| s. is_incr ( ) ) {
384
- self . mk_cargo_process ( toolchain, cwd, profile, backend)
402
+ self . mk_cargo_process ( toolchain, cwd, profile, backend, target )
385
403
. incremental ( true )
386
404
. processor ( processor, Scenario :: IncrFull , "IncrFull" , None )
387
405
. run_rustc ( true )
@@ -390,7 +408,7 @@ impl Benchmark {
390
408
391
409
// An incremental build with no changes (fastest incremental case).
392
410
if scenarios. contains ( & Scenario :: IncrUnchanged ) {
393
- self . mk_cargo_process ( toolchain, cwd, profile, backend)
411
+ self . mk_cargo_process ( toolchain, cwd, profile, backend, target )
394
412
. incremental ( true )
395
413
. processor ( processor, Scenario :: IncrUnchanged , "IncrUnchanged" , None )
396
414
. run_rustc ( true )
@@ -405,7 +423,7 @@ impl Benchmark {
405
423
// An incremental build with some changes (realistic
406
424
// incremental case).
407
425
let scenario_str = format ! ( "IncrPatched{}" , i) ;
408
- self . mk_cargo_process ( toolchain, cwd, profile, backend)
426
+ self . mk_cargo_process ( toolchain, cwd, profile, backend, target )
409
427
. incremental ( true )
410
428
. processor (
411
429
processor,
0 commit comments