Skip to content

Commit 0301a6b

Browse files
nurmukhametovaneshlya
authored andcommitted
Add auxiliary scripts for benchmarking
- build_benchmarks.sh: Automated build script for ISPC benchmarks for specified targets between two ISPC revisions - create_benchmark_comparison_table.py: Python tool to parse benchmark JSON results and generate comparison tables in ASCII/CSV/Markdown - run_all_benchmark_comparisons.sh: Batch runner that executes benchmark comparisons for all target pairs in the current directory - run_and_compare_benchmarks.sh: Core comparison script that runs benchmarks and uses Google Benchmark's compare.py tool to analyze performance differences
1 parent 9e79e6b commit 0301a6b

File tree

4 files changed

+685
-0
lines changed

4 files changed

+685
-0
lines changed

scripts/build_benchmarks.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/bash
2+
# Copyright (c) 2025, Intel Corporation
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
5+
set -euo pipefail
6+
7+
DEFAULT_TARGETS="avx512skx-x4 avx512skx-x8 avx512skx-x16 avx512skx-x32 avx512skx-x64 avx512icl-x4 avx512icl-x8 avx512icl-x16 avx512icl-x32 avx512icl-x64"
8+
9+
show_usage() {
10+
cat <<EOF
11+
Usage: $0 [BASE_SHA] [PEAK_SHA] [BUILD_TARGETS]
12+
13+
Build ISPC benchmarks for performance comparison between two commits.
14+
15+
ARGUMENTS:
16+
BASE_SHA Base commit SHA for comparison (default: HEAD^)
17+
PEAK_SHA Peak commit SHA for comparison (default: HEAD)
18+
BUILD_TARGETS Space-separated list of ISPC targets (default: all AVX-512 targets)
19+
20+
DEFAULT TARGETS:
21+
$DEFAULT_TARGETS
22+
23+
EXAMPLES:
24+
$0 # Compare HEAD^ vs HEAD with default targets
25+
$0 abc123 def456 # Compare specific commits with default targets
26+
$0 HEAD~5 HEAD "avx2-i32x8 avx512skx-x16" # Compare commits with custom targets
27+
28+
The script will:
29+
1. Check out PEAK_SHA and build benchmarks for each target
30+
2. Check out BASE_SHA and build benchmarks for each target
31+
3. Create separate build directories for each target/version combination
32+
33+
Build directories will be named: {target}-peak and {target}-base
34+
EOF
35+
}
36+
37+
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
38+
show_usage
39+
exit 0
40+
fi
41+
42+
BASE_SHA="${1:-HEAD^}"
43+
PEAK_SHA="${2:-HEAD}"
44+
BUILD_TARGETS="${3:-$DEFAULT_TARGETS}"
45+
46+
echo "Building benchmarks for ISPC with base SHA: $BASE_SHA and peak SHA: $PEAK_SHA"
47+
echo "Targets: $BUILD_TARGETS"
48+
49+
# Convert space-separated targets to array
50+
IFS=' ' read -ra TARGET_ARRAY <<< "$BUILD_TARGETS"
51+
52+
# Build peak version for each target
53+
echo "Checking out peak SHA: $PEAK_SHA"
54+
git checkout "$PEAK_SHA"
55+
56+
for target in "${TARGET_ARRAY[@]}"; do
57+
echo "Building peak version for target: $target"
58+
BUILD_DIR="${target}-peak"
59+
LOG_FILE="${target}-peak.build.log"
60+
61+
rm -rf "$BUILD_DIR"
62+
63+
cmake ../ -G Ninja \
64+
-DISPC_SLIM_BINARY=ON \
65+
-DISPC_INCLUDE_EXAMPLES=OFF \
66+
-DISPC_INCLUDE_RT=OFF \
67+
-DISPC_INCLUDE_UTILS=OFF \
68+
-DISPC_INCLUDE_TESTS=OFF \
69+
-DISPC_INCLUDE_BENCHMARKS=ON \
70+
-DARM_ENABLED=OFF \
71+
-B "$BUILD_DIR" \
72+
-DBENCHMARKS_ISPC_FLAGS="-O3 -woff" \
73+
-DBENCHMARKS_ISPC_TARGETS="$target"
74+
75+
echo ""
76+
echo "Build phase:"
77+
echo "============"
78+
79+
cmake --build "$BUILD_DIR"
80+
done
81+
82+
# Build base version for each target
83+
echo "Checking out base SHA: $BASE_SHA"
84+
git checkout "$BASE_SHA"
85+
86+
for target in "${TARGET_ARRAY[@]}"; do
87+
echo "Building base version for target: $target"
88+
BUILD_DIR="${target}-base"
89+
90+
rm -rf "$BUILD_DIR"
91+
92+
cmake ../ -G Ninja \
93+
-DISPC_SLIM_BINARY=ON \
94+
-DISPC_INCLUDE_EXAMPLES=OFF \
95+
-DISPC_INCLUDE_RT=OFF \
96+
-DISPC_INCLUDE_UTILS=OFF \
97+
-DISPC_INCLUDE_TESTS=OFF \
98+
-DISPC_INCLUDE_BENCHMARKS=ON \
99+
-DARM_ENABLED=OFF \
100+
-B "$BUILD_DIR" \
101+
-DBENCHMARKS_ISPC_FLAGS="-O3 -woff" \
102+
-DBENCHMARKS_ISPC_TARGETS="$target"
103+
104+
echo ""
105+
echo "Build phase:"
106+
echo "============"
107+
108+
cmake --build "$BUILD_DIR"
109+
done
110+
111+
echo "Build completed for all targets: $BUILD_TARGETS"

0 commit comments

Comments
 (0)