1
Fork 0

Merge commit '1eded3619d' into sync_cg_clif-2023-07-22

This commit is contained in:
bjorn3 2023-07-22 13:32:34 +00:00
commit 36708123c1
30 changed files with 668 additions and 170 deletions

View file

@ -1,4 +1,5 @@
use std::env;
use std::io::Write;
use std::path::Path;
use super::path::{Dirs, RelPath};
@ -30,6 +31,12 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
let bench_runs = env::var("BENCH_RUNS").unwrap_or_else(|_| "10".to_string()).parse().unwrap();
let mut gha_step_summary = if let Ok(file) = std::env::var("GITHUB_STEP_SUMMARY") {
Some(std::fs::OpenOptions::new().append(true).open(file).unwrap())
} else {
None
};
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
let cargo_clif = RelPath::DIST
.to_path(dirs)
@ -60,36 +67,64 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
target_dir = target_dir.display(),
);
let bench_compile_markdown = RelPath::DIST.to_path(dirs).join("bench_compile.md");
let bench_compile = hyperfine_command(
1,
bench_runs,
Some(&clean_cmd),
&[&llvm_build_cmd, &clif_build_cmd, &clif_build_opt_cmd],
&[
("cargo build", &llvm_build_cmd),
("cargo-clif build", &clif_build_cmd),
("cargo-clif build --release", &clif_build_opt_cmd),
],
&bench_compile_markdown,
);
spawn_and_wait(bench_compile);
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
gha_step_summary.write_all(b"## Compile ebobby/simple-raytracer\n\n").unwrap();
gha_step_summary.write_all(&std::fs::read(bench_compile_markdown).unwrap()).unwrap();
gha_step_summary.write_all(b"\n").unwrap();
}
eprintln!("[BENCH RUN] ebobby/simple-raytracer");
let bench_run_markdown = RelPath::DIST.to_path(dirs).join("bench_run.md");
let raytracer_cg_llvm = Path::new(".").join(get_file_name(
&bootstrap_host_compiler.rustc,
"raytracer_cg_llvm",
"bin",
));
let raytracer_cg_clif = Path::new(".").join(get_file_name(
&bootstrap_host_compiler.rustc,
"raytracer_cg_clif",
"bin",
));
let raytracer_cg_clif_opt = Path::new(".").join(get_file_name(
&bootstrap_host_compiler.rustc,
"raytracer_cg_clif_opt",
"bin",
));
let mut bench_run = hyperfine_command(
0,
bench_runs,
None,
&[
Path::new(".")
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_llvm", "bin"))
.to_str()
.unwrap(),
Path::new(".")
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif", "bin"))
.to_str()
.unwrap(),
Path::new(".")
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif_opt", "bin"))
.to_str()
.unwrap(),
("", raytracer_cg_llvm.to_str().unwrap()),
("", raytracer_cg_clif.to_str().unwrap()),
("", raytracer_cg_clif_opt.to_str().unwrap()),
],
&bench_run_markdown,
);
bench_run.current_dir(RelPath::BUILD.to_path(dirs));
spawn_and_wait(bench_run);
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
gha_step_summary.write_all(b"## Run ebobby/simple-raytracer\n\n").unwrap();
gha_step_summary.write_all(&std::fs::read(bench_run_markdown).unwrap()).unwrap();
gha_step_summary.write_all(b"\n").unwrap();
}
}