Skip to content

Commit d65049e

Browse files
committed
Add CI workflow for benchmarking Cranelift backend
1 parent 288c8af commit d65049e

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

.github/workflows/ci.yml

+34-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ jobs:
9090
- name: Run unit tests
9191
run: cargo test --all
9292

93-
9493
test_benchmarks:
9594
strategy:
9695
matrix:
@@ -149,6 +148,40 @@ jobs:
149148
PROFILES: ${{ matrix.PROFILES }}
150149
SHELL: "/bin/bash"
151150

151+
test_backends:
152+
name: Test codegen backend benchmarks
153+
runs-on: ubuntu-latest
154+
steps:
155+
- name: Checkout the source code
156+
uses: actions/checkout@v2
157+
with:
158+
fetch-depth: 1
159+
160+
- name: Install latest beta
161+
uses: actions-rs/toolchain@v1
162+
with:
163+
toolchain: beta
164+
override: true
165+
166+
- name: Configure environment
167+
run: |
168+
sudo apt-get update
169+
sudo apt-get install -y linux-tools-common linux-tools-generic linux-tools-`uname -r`
170+
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
171+
172+
- uses: Swatinem/rust-cache@v2
173+
174+
- name: Build collector
175+
run: cargo build -p collector
176+
177+
- name: Check compile benchmarks
178+
run: sh -x -c "ci/check-compile-benchmarks.sh"
179+
env:
180+
BENCH_INCLUDE_EXCLUDE_OPTS: "--include helloworld"
181+
PROFILES: Debug,Opt
182+
BACKENDS: Cranelift
183+
SHELL: "/bin/bash"
184+
152185
test_runtime_benchmarks:
153186
name: Test runtime benchmarks
154187
runs-on: ubuntu-latest

ci/check-compile-benchmarks.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ bash -c "while true; do sleep 30; echo \$(date) - running ...; done" &
66
PING_LOOP_PID=$!
77
trap 'kill $PING_LOOP_PID' ERR 1 2 3 6
88

9+
BACKENDS=${BACKENDS:-Llvm}
10+
911
# Install a toolchain.
1012
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
11-
bindir=`cargo run -p collector --bin collector install_next`
13+
bindir=`cargo run -p collector --bin collector install_next --backends ${BACKENDS}`
1214

1315
# Do some benchmarking.
1416
RUST_BACKTRACE=1 \
@@ -21,6 +23,7 @@ RUST_BACKTRACE=1 \
2123
--profiles $PROFILES \
2224
--cargo $bindir/cargo \
2325
--scenarios All \
26+
--backends $BACKENDS \
2427
--rustdoc $bindir/rustdoc \
2528
$BENCH_INCLUDE_EXCLUDE_OPTS
2629

0 commit comments

Comments
 (0)