mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 04:56:25 +03:00
Make it clearer what exactly is being benchmarked
This commit is contained in:
+25
-17
@@ -39,7 +39,26 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) {
|
||||
let rustc_clif = &compiler.rustc;
|
||||
let rustflags = &compiler.rustflags.join("\x1f");
|
||||
let manifest_path = SIMPLE_RAYTRACER_REPO.source_dir().to_path(dirs).join("Cargo.toml");
|
||||
let target_dir = dirs.build_dir.join("simple_raytracer");
|
||||
let target_dir = dirs.build_dir.join("simple-raytracer_target");
|
||||
|
||||
let raytracer_cg_llvm = dirs
|
||||
.build_dir
|
||||
.join(get_file_name(&compiler.rustc, "raytracer_cg_llvm", "bin"))
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_owned();
|
||||
let raytracer_cg_clif = dirs
|
||||
.build_dir
|
||||
.join(get_file_name(&compiler.rustc, "raytracer_cg_clif", "bin"))
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_owned();
|
||||
let raytracer_cg_clif_opt = dirs
|
||||
.build_dir
|
||||
.join(get_file_name(&compiler.rustc, "raytracer_cg_clif_opt", "bin"))
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_owned();
|
||||
|
||||
let clean_cmd = format!(
|
||||
"RUSTC=rustc cargo clean --manifest-path {manifest_path} --target-dir {target_dir}",
|
||||
@@ -47,19 +66,19 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) {
|
||||
target_dir = target_dir.display(),
|
||||
);
|
||||
let llvm_build_cmd = format!(
|
||||
"RUSTC=rustc cargo build --manifest-path {manifest_path} --target-dir {target_dir} && (rm build/raytracer_cg_llvm || true) && ln build/simple_raytracer/debug/main build/raytracer_cg_llvm",
|
||||
"RUSTC=rustc cargo build --manifest-path {manifest_path} --target-dir {target_dir} && (rm {raytracer_cg_llvm} || true) && ln {target_dir}/debug/main {raytracer_cg_llvm}",
|
||||
manifest_path = manifest_path.display(),
|
||||
target_dir = target_dir.display(),
|
||||
);
|
||||
let clif_build_cmd = format!(
|
||||
"RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} && (rm build/raytracer_cg_clif || true) && ln build/simple_raytracer/debug/main build/raytracer_cg_clif",
|
||||
"RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} && (rm {raytracer_cg_clif} || true) && ln {target_dir}/debug/main {raytracer_cg_clif}",
|
||||
cargo_clif = cargo_clif.display(),
|
||||
rustc_clif = rustc_clif.display(),
|
||||
manifest_path = manifest_path.display(),
|
||||
target_dir = target_dir.display(),
|
||||
);
|
||||
let clif_build_opt_cmd = format!(
|
||||
"RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} --release && (rm build/raytracer_cg_clif_opt || true) && ln build/simple_raytracer/release/main build/raytracer_cg_clif_opt",
|
||||
"RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" CARGO_BUILD_INCREMENTAL=true {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} --release && (rm {raytracer_cg_clif_opt} || true) && ln {target_dir}/release/main {raytracer_cg_clif_opt}",
|
||||
cargo_clif = cargo_clif.display(),
|
||||
rustc_clif = rustc_clif.display(),
|
||||
manifest_path = manifest_path.display(),
|
||||
@@ -92,24 +111,13 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) {
|
||||
|
||||
let bench_run_markdown = dirs.build_dir.join("bench_run.md");
|
||||
|
||||
let raytracer_cg_llvm =
|
||||
Path::new(".").join(get_file_name(&compiler.rustc, "raytracer_cg_llvm", "bin"));
|
||||
let raytracer_cg_clif =
|
||||
Path::new(".").join(get_file_name(&compiler.rustc, "raytracer_cg_clif", "bin"));
|
||||
let raytracer_cg_clif_opt =
|
||||
Path::new(".").join(get_file_name(&compiler.rustc, "raytracer_cg_clif_opt", "bin"));
|
||||
let mut bench_run = hyperfine_command(
|
||||
let bench_run = hyperfine_command(
|
||||
0,
|
||||
bench_runs,
|
||||
None,
|
||||
&[
|
||||
("", raytracer_cg_llvm.to_str().unwrap()),
|
||||
("", raytracer_cg_clif.to_str().unwrap()),
|
||||
("", raytracer_cg_clif_opt.to_str().unwrap()),
|
||||
],
|
||||
&[("", &raytracer_cg_llvm), ("", &raytracer_cg_clif), ("", &raytracer_cg_clif_opt)],
|
||||
&bench_run_markdown,
|
||||
);
|
||||
bench_run.current_dir(&dirs.build_dir);
|
||||
spawn_and_wait(bench_run);
|
||||
|
||||
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
|
||||
|
||||
@@ -22,6 +22,11 @@ pub(crate) fn build_backend(
|
||||
rustflags.push("-Zallow-features=rustc_private,f16,f128".to_owned());
|
||||
rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags);
|
||||
|
||||
// Use incr comp despite release mode unless incremental builds are explicitly disabled
|
||||
if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() {
|
||||
cmd.env("CARGO_BUILD_INCREMENTAL", "true");
|
||||
}
|
||||
|
||||
if env::var("CG_CLIF_EXPENSIVE_CHECKS").is_ok() {
|
||||
// Enabling debug assertions implicitly enables the clif ir verifier
|
||||
cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
|
||||
|
||||
@@ -234,6 +234,10 @@ fn build_clif_sysroot_for_triple(
|
||||
if compiler.triple.contains("apple") {
|
||||
build_cmd.env("CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO", "packed");
|
||||
}
|
||||
// Use incr comp despite release mode unless incremental builds are explicitly disabled
|
||||
if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() {
|
||||
build_cmd.env("CARGO_BUILD_INCREMENTAL", "true");
|
||||
}
|
||||
spawn_and_wait(build_cmd);
|
||||
|
||||
for entry in fs::read_dir(build_dir.join("deps")).unwrap() {
|
||||
|
||||
@@ -59,11 +59,6 @@ fn main() {
|
||||
}
|
||||
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
|
||||
|
||||
// Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled
|
||||
if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() {
|
||||
env::set_var("CARGO_BUILD_INCREMENTAL", "true");
|
||||
}
|
||||
|
||||
let mut args = env::args().skip(1);
|
||||
let command = match args.next().as_deref() {
|
||||
Some("prepare") => Command::Prepare,
|
||||
@@ -79,7 +74,7 @@ fn main() {
|
||||
}
|
||||
};
|
||||
|
||||
let mut out_dir = PathBuf::from(".");
|
||||
let mut out_dir = std::env::current_dir().unwrap();
|
||||
let mut download_dir = None;
|
||||
let mut sysroot_kind = SysrootKind::Clif;
|
||||
let mut use_unstable_features = true;
|
||||
|
||||
Reference in New Issue
Block a user