Skip to content

Commit 49a296c

Browse files
committed
ebmc: benchmarking in CI
This runs the HWMCC 2008 competition benchmarks in CI, using the results by abc as expected outcome.
1 parent 362a6f7 commit 49a296c

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,40 @@ jobs:
106106
run: make -C regression/verilog test-z3
107107
- name: Print ccache stats
108108
run: ccache -s
109+
- name: Upload the ebmc binary
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: ebmc-binary
113+
retention-days: 5
114+
path: src/ebmc/ebmc
115+
116+
# This job takes approximately 10 minutes
117+
benchmarking:
118+
runs-on: ubuntu-20.04
119+
needs: check-ubuntu-20_04-make-clang
120+
steps:
121+
- uses: actions/checkout@v4
122+
with:
123+
submodules: recursive
124+
- name: Fetch dependencies
125+
env:
126+
# This is needed in addition to -yq to prevent apt-get from asking for
127+
# user input
128+
DEBIAN_FRONTEND: noninteractive
129+
run: |
130+
sudo apt-get update
131+
sudo apt-get install --no-install-recommends z3
132+
- name: Confirm z3 solver is available and log the version installed
133+
run: z3 --version
134+
- name: Get the ebmc binary
135+
uses: actions/download-artifact@v4
136+
with:
137+
name: ebmc-binary
138+
path: ebmc
139+
- name: Try the ebmc binary
140+
run: chmod a+x ./ebmc/ebmc ; ./ebmc/ebmc --version
141+
- name: HWMCC08 benchmarks
142+
run: PATH=$PATH:$PWD/ebmc benchmarking/hwmcc08.sh
109143

110144
# This job takes approximately 15 minutes
111145
check-centos8-make-gcc:

benchmarking/hwmcc08.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/sh
2+
3+
if [ ! -e aiger/. ] ; then
4+
echo Downloading and building the AIGER tools
5+
git clone https://github.com/arminbiere/aiger
6+
(cd aiger ; ./configure.sh ; make aigtosmv )
7+
fi
8+
9+
if [ ! -e hwmcc08/. ] ; then
10+
echo Downloading HWMCC08 benchmark archive
11+
wget -q http://fmv.jku.at/hwmcc/hwmcc08public.tar.bz2
12+
bunzip2 hwmcc08public.tar.bz2
13+
tar xf hwmcc08public.tar
14+
rm hwmcc08public.tar
15+
fi
16+
17+
if [ ! -e hwmcc08public-smv/. ] ; then
18+
echo Converting AIGER to SMV
19+
mkdir hwmcc08public-smv
20+
(cd hwmcc08; for FILE in *.aig ; do
21+
SMV=`echo "$FILE" | sed s/.aig/.smv/`
22+
../aiger/aigtosmv -b "$FILE" "../hwmcc08public-smv/$SMV"
23+
done)
24+
fi
25+
26+
# expected answers
27+
# from the abc result column in https://fmv.jku.at/hwmcc08/hwmcc08results.csv
28+
29+
if [ ! -e hwmcc08results.csv ] ; then
30+
echo Downloading HWMCC08 result table
31+
wget -q https://fmv.jku.at/hwmcc08/hwmcc08results.csv
32+
fi
33+
34+
echo Running ebmc on the HWMCC08 benchmarks
35+
36+
(# ignore first three lines of hwmcc08results.csv
37+
read -r line
38+
read -r line
39+
read -r line
40+
# now process the lines
41+
while read -r line; do
42+
BENCHMARK=` echo "$line" | cut -d ',' -f 1 | tr -d '"'`
43+
if [ ! -e "hwmcc08public-smv/${BENCHMARK}.smv" ] ; then
44+
echo benchmark $BENCHMARK not found
45+
else
46+
RESULT=` echo "$line" | cut -d ',' -f 3 | tr -d '"'`
47+
if [ "$RESULT" = "uns" ] ; then
48+
ebmc --bound 2 "hwmcc08public-smv/${BENCHMARK}.smv" > ebmc.out
49+
if [ $0 = 2 ] ; then
50+
echo $BENCHMARK: got unexpected couterexample
51+
exit 1
52+
else
53+
echo $BENCHMARK: ok "(UNSAT)"
54+
fi
55+
fi
56+
if [ "$RESULT" = "sat" ] ; then
57+
LENGTH=` echo "$line" | cut -d ',' -f 2`
58+
if [ "$LENGTH" = "\"*\"" ] ; then
59+
echo $BENCHMARK: no counterexample length
60+
else
61+
ebmc --bound $LENGTH "hwmcc08public-smv/${BENCHMARK}.smv" > ebmc.out
62+
if [ $0 = 2 ] ; then
63+
echo $BENCHMARK: failed to find couterexample at bound $LENGTH
64+
exit 1
65+
else
66+
echo $BENCHMARK: ok "(SAT)"
67+
fi
68+
fi
69+
fi
70+
fi
71+
done ) < hwmcc08results.csv

0 commit comments

Comments
 (0)