Skip to content

Commit dbfbb29

Browse files
committed
Move LLVM simple-raytracer build to ./y.rs bench
cc #1290
1 parent 8686383 commit dbfbb29

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

build_system/bench.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::Path;
55
use super::path::{Dirs, RelPath};
66
use super::prepare::GitRepo;
77
use super::rustc_info::{get_file_name, get_wrapper_file_name};
8-
use super::utils::{hyperfine_command, is_ci, spawn_and_wait, CargoProject};
8+
use super::utils::{hyperfine_command, is_ci, spawn_and_wait, CargoProject, Compiler};
99

1010
pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1111
"ebobby",
@@ -14,6 +14,10 @@ pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1414
"<none>",
1515
);
1616

17+
// Use a separate target dir for the initial LLVM build to reduce unnecessary recompiles
18+
pub(crate) static SIMPLE_RAYTRACER_LLVM: CargoProject =
19+
CargoProject::new(&SIMPLE_RAYTRACER_REPO.source_dir(), "simple_raytracer_llvm");
20+
1721
pub(crate) static SIMPLE_RAYTRACER: CargoProject =
1822
CargoProject::new(&SIMPLE_RAYTRACER_REPO.source_dir(), "simple_raytracer");
1923

@@ -28,6 +32,20 @@ fn benchmark_simple_raytracer(dirs: &Dirs) {
2832
std::process::exit(1);
2933
}
3034

35+
eprintln!("[LLVM BUILD] simple-raytracer");
36+
let host_compiler = Compiler::host();
37+
let build_cmd = SIMPLE_RAYTRACER_LLVM.build(&host_compiler, dirs);
38+
spawn_and_wait(build_cmd);
39+
fs::copy(
40+
SIMPLE_RAYTRACER_LLVM
41+
.target_dir(dirs)
42+
.join(&host_compiler.triple)
43+
.join("debug")
44+
.join(get_file_name("main", "bin")),
45+
RelPath::BUILD.to_path(dirs).join(get_file_name("raytracer_cg_llvm", "bin")),
46+
)
47+
.unwrap();
48+
3149
let run_runs = env::var("RUN_RUNS")
3250
.unwrap_or(if is_ci() { "2" } else { "10" }.to_string())
3351
.parse()

build_system/prepare.rs

+2-16
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use crate::build_system::rustc_info::get_default_sysroot;
77

88
use super::build_sysroot::{BUILD_SYSROOT, ORIG_BUILD_SYSROOT, SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
99
use super::path::{Dirs, RelPath};
10-
use super::rustc_info::{get_file_name, get_rustc_version};
11-
use super::utils::{copy_dir_recursively, retry_spawn_and_wait, spawn_and_wait, Compiler};
10+
use super::rustc_info::get_rustc_version;
11+
use super::utils::{copy_dir_recursively, retry_spawn_and_wait, spawn_and_wait};
1212

1313
pub(crate) fn prepare(dirs: &Dirs) {
1414
if RelPath::DOWNLOAD.to_path(dirs).exists() {
@@ -23,20 +23,6 @@ pub(crate) fn prepare(dirs: &Dirs) {
2323
super::tests::REGEX_REPO.fetch(dirs);
2424
super::tests::PORTABLE_SIMD_REPO.fetch(dirs);
2525
super::bench::SIMPLE_RAYTRACER_REPO.fetch(dirs);
26-
27-
eprintln!("[LLVM BUILD] simple-raytracer");
28-
let host_compiler = Compiler::host();
29-
let build_cmd = super::bench::SIMPLE_RAYTRACER.build(&host_compiler, dirs);
30-
spawn_and_wait(build_cmd);
31-
fs::copy(
32-
super::bench::SIMPLE_RAYTRACER
33-
.target_dir(dirs)
34-
.join(&host_compiler.triple)
35-
.join("debug")
36-
.join(get_file_name("main", "bin")),
37-
RelPath::BUILD.to_path(dirs).join(get_file_name("raytracer_cg_llvm", "bin")),
38-
)
39-
.unwrap();
4026
}
4127

4228
fn prepare_sysroot(dirs: &Dirs) {

0 commit comments

Comments
 (0)