Skip to content

Commit 4d5fc87

Browse files
committed
Run icount benchmarks once with softfloat and once with hardfloat
These benchmarks are fast to run, so the time cost here is pretty minimal. Running softfloat benchmarks just ensures that we don't e.g. test the performance of `_mm_sqrt_ss` rather than our implementation, and running without softfloat gives us a way to see the effect of arch intrinsics.
1 parent a7c6178 commit 4d5fc87

File tree

2 files changed

+54
-23
lines changed

2 files changed

+54
-23
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -170,29 +170,7 @@ jobs:
170170
- name: Run icount benchmarks
171171
env:
172172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173-
run: |
174-
set -eux
175-
iai_home="iai-home"
176-
# Download the baseline from master
177-
./ci/ci-util.py locate-baseline --download --extract
178-
179-
# Run iai-callgrind benchmarks
180-
cargo bench --no-default-features \
181-
--features unstable,unstable-float,icount \
182-
--bench icount \
183-
-- \
184-
--save-baseline=default \
185-
--home "$(pwd)/$iai_home" \
186-
--regression='ir=5.0' \
187-
--save-summary
188-
# NB: iai-callgrind should exit on error but does not, so we inspect the sumary
189-
# for errors. See https://github.com/iai-callgrind/iai-callgrind/issues/337
190-
./ci/ci-util.py check-regressions "$iai_home"
191-
192-
# Name and tar the new baseline
193-
name="baseline-icount-$(date -u +'%Y%m%d%H%M')-${GITHUB_SHA:0:12}"
194-
echo "BASELINE_NAME=$name" >> "$GITHUB_ENV"
195-
tar cJf "$name.tar.xz" "$iai_home"
173+
run: ./ci/bench-icount.sh
196174

197175
- name: Upload the benchmark baseline
198176
uses: actions/upload-artifact@v4

ci/bench-icount.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
iai_home="iai-home"
6+
7+
# Download the baseline from master
8+
./ci/ci-util.py locate-baseline --download --extract
9+
10+
# Run benchmarks once
11+
function run_icount_benchmarks() {
12+
cargo_args=(
13+
"--bench" "icount"
14+
"--no-default-features"
15+
"--features" "unstable,unstable-float,icount"
16+
)
17+
18+
iai_args=(
19+
"--home" "$(pwd)/$iai_home"
20+
"--regression=ir=5.0"
21+
"--save-summary"
22+
)
23+
24+
# Parse `cargo_arg0 cargo_arg1 -- iai_arg0 iai_arg1` syntax
25+
parsing_iai_args=0
26+
while [ "$#" -gt 0 ]; do
27+
if [ "$parsing_iai_args" == "1" ]; then
28+
iai_args+=("$1")
29+
elif [ "$1" == "--" ]; then
30+
parsing_iai_args=1
31+
else
32+
cargo_args+=("$1")
33+
fi
34+
35+
shift
36+
done
37+
38+
# Run iai-callgrind benchmarks
39+
cargo bench "${cargo_args[@]}" -- "${iai_args[@]}"
40+
41+
# NB: iai-callgrind should exit on error but does not, so we inspect the sumary
42+
# for errors. See https://github.com/iai-callgrind/iai-callgrind/issues/337
43+
./ci/ci-util.py check-regressions --home "$iai_home" || true
44+
}
45+
46+
# Run once with softfloats, once with arch instructions enabled
47+
run_icount_benchmarks --features force-soft-floats -- --save-baseline=softfloat
48+
run_icount_benchmarks -- --save-baseline=hardfloat
49+
50+
# Name and tar the new baseline
51+
name="baseline-icount-$(date -u +'%Y%m%d%H%M')-${GITHUB_SHA:0:12}"
52+
echo "BASELINE_NAME=$name" >>"$GITHUB_ENV"
53+
tar cJf "$name.tar.xz" "$iai_home"

0 commit comments

Comments
 (0)