Skip to content

Test runtime benchmarks on CI #1475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Build collector
run: cargo build -p collector

- name: Check benchmarks
- name: Check compile benchmarks
run: sh -x -c "ci/check-compile-benchmarks.sh"
env:
JEMALLOC_OVERRIDE: /usr/lib/x86_64-linux-gnu/libjemalloc.so
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
- name: Build collector
run: cargo build -p collector

- name: Check benchmarks
- name: Check profiling
run: sh -x -c "ci/check-profiling.sh"

database-check:
Expand Down
16 changes: 11 additions & 5 deletions ci/check-runtime-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ bash -c "while true; do sleep 30; echo \$(date) - running ...; done" &
PING_LOOP_PID=$!
trap 'kill $PING_LOOP_PID' ERR 1 2 3 6

# Check if the runtime benchmarks can be compiled.
# Once we can actually run the benchmarks on CI, we will also execute them here.
# Currently it is not possible because of `perf` permission issues when gathering perf. counters.
cd collector/runtime-benchmarks
cargo check
# Install a toolchain.
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
bindir=`cargo run -p collector --bin collector install_next`

# Do some benchmarking.
RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
cargo run -p collector --bin collector -- \
bench_runtime_local $bindir/rustc \
--cargo $bindir/cargo \
--iterations 1 \
--id Test

kill $PING_LOOP_PID
exit 0
9 changes: 8 additions & 1 deletion collector/src/bin/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,16 @@ fn main_result() -> anyhow::Result<i32> {

match args.command {
Commands::BenchRuntimeLocal { local, iterations } => {
bench_runtime(
let toolchain = get_local_toolchain(
&[Profile::Opt],
&local.rustc,
None,
local.cargo.as_deref(),
local.id.as_deref(),
"",
)?;
bench_runtime(
toolchain,
BenchmarkFilter::new(local.exclude, local.include),
runtime_benchmark_dir,
iterations,
Expand Down
7 changes: 2 additions & 5 deletions collector/src/runtime/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod benchmark;

use crate::benchmark::profile::Profile;
use crate::toolchain::get_local_toolchain;
use crate::toolchain::LocalToolchain;
use benchlib::comm::messages::{BenchmarkMessage, BenchmarkResult, BenchmarkStats};
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
Expand All @@ -14,13 +13,11 @@ pub use benchmark::BenchmarkFilter;
/// to a Cargo crate. All binaries built by that crate will are expected to be runtime benchmark
/// groups that leverage `benchlib`.
pub fn bench_runtime(
rustc: &str,
id: Option<&str>,
toolchain: LocalToolchain,
filter: BenchmarkFilter,
benchmark_dir: PathBuf,
iterations: u32,
) -> anyhow::Result<()> {
let toolchain = get_local_toolchain(&[Profile::Opt], rustc, None, None, id, "")?;
let suite = benchmark::discover_benchmarks(&toolchain, &benchmark_dir)?;

let total_benchmark_count = suite.total_benchmark_count();
Expand Down