Skip to content

Commit de120bd

Browse files
Add TACLe and Patmos benchmarks to CI (#2)
1 parent d12e0af commit de120bd

23 files changed

+445
-109
lines changed

.github/workflows/l2-cache-ci.yml

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
name: L2 CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
schedule:
9+
- cron: '00 1 * * MON'
10+
11+
env:
12+
MISC_PATH: misc/
13+
BENCH_PATH: bench/
14+
TOOLS_PATH: local/
15+
L2_PATH: l2-cache/
16+
T_CREST_PATH: t-crest/
17+
SOC_COMM_PATH: soc-comm/
18+
PATMOS_PATH: patmos/
19+
ARTIFACTS_PATH: artifacts/
20+
TACLE_PATH: tacle/
21+
PATMOS_BENCH_JOBS: 6
22+
23+
jobs:
24+
scala-test:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout L2-cache
29+
uses: actions/checkout@v3
30+
with:
31+
path: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
32+
33+
- name: Checkout soc-comm
34+
uses: actions/checkout@v3
35+
with:
36+
repository: t-crest/soc-comm
37+
path: ${{ env.T_CREST_PATH }}${{ env.SOC_COMM_PATH }}
38+
39+
- name: Checkout patmos
40+
uses: actions/checkout@v3
41+
with:
42+
repository: t-crest/patmos
43+
path: ${{ env.T_CREST_PATH }}${{ env.PATMOS_PATH }}
44+
45+
# Chisel test is only compatible with older versions of verilator
46+
- name: Setup verilator
47+
uses: v0xnihili/install-verilator-action@main
48+
with:
49+
version: "v4.100"
50+
51+
- name: Verify verilator
52+
run: verilator --version
53+
54+
- name: Setup Scala
55+
uses: olafurpg/setup-scala@v14
56+
57+
- name: Run sbt tests
58+
working-directory: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
59+
run: sbt test
60+
61+
build-tools:
62+
runs-on: ubuntu-latest
63+
needs: [scala-test]
64+
65+
steps:
66+
- name: Install prerequisites
67+
run: |
68+
sudo apt update
69+
sudo apt install openjdk-11-jdk cmake make subversion libelf-dev graphviz \
70+
libboost-dev libboost-program-options-dev chrpath liblpsolve55-dev gtkwave \
71+
gtkterm scala libfl2 expect verilator
72+
73+
- name: Setup Scala
74+
uses: olafurpg/setup-scala@v14
75+
76+
- name: Checkout L2 cache
77+
uses: actions/checkout@v3
78+
with:
79+
path: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
80+
81+
- name: Checkout patmos-misc
82+
uses: actions/checkout@v3
83+
with:
84+
repository: t-crest/patmos-misc
85+
path: ${{ env.T_CREST_PATH }}${{ env.MISC_PATH }}
86+
87+
- name: Add path
88+
working-directory: t-crest/
89+
run: echo "$PWD/${{ env.TOOLS_PATH }}bin" >> $GITHUB_PATH
90+
91+
- name: Setup tools
92+
working-directory: ${{ env.T_CREST_PATH }}
93+
run: ${{ env.MISC_PATH }}build.sh -q simulator llvm2 argo soc-comm poseidon patmos bench
94+
95+
# TODO: Better add an l2 config file in patmos
96+
- name: Build patmos emulator with L2 cache
97+
working-directory: ${{ env.T_CREST_PATH }}
98+
run: |
99+
cd ${{ env.PATMOS_PATH }}
100+
sed -i '17i\<L2Cache size="64k" ways="8" bytesPerBlock="64" repl="plru" />' hardware/config/altde2-115.xml
101+
cat hardware/config/altde2-115.xml
102+
make emulator
103+
104+
- name: Re-build bench with increased timeout
105+
working-directory: ${{ env.T_CREST_PATH }}
106+
run: |
107+
sed -i '328c\ set_tests_properties(${name}_hw PROPERTIES TIMEOUT 18000)' ${{ env.BENCH_PATH }}cmake/patmos-clang-toolchain.cmake
108+
cd ${{ env.BENCH_PATH }}build
109+
make
110+
111+
- name: Package tools
112+
run: |
113+
mkdir ${{ env.ARTIFACTS_PATH }}
114+
cd ${{ env.ARTIFACTS_PATH }}
115+
tar -cvf tools.tar ../${{ env.T_CREST_PATH }}${{ env.TOOLS_PATH }} ../${{ env.T_CREST_PATH }}${{ env.MISC_PATH }} ../${{ env.T_CREST_PATH }}${{ env.BENCH_PATH }}
116+
117+
- name: Upload tools
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: patmos-tools
121+
path: ${{ env.ARTIFACTS_PATH }}
122+
123+
tacle-bench-app:
124+
runs-on: ubuntu-latest
125+
needs: [ build-tools ]
126+
127+
steps:
128+
- name: Download tools
129+
uses: actions/download-artifact@v4
130+
with:
131+
name: patmos-tools
132+
path: ${{ env.ARTIFACTS_PATH }}
133+
134+
- name: Unpack tools
135+
run: |
136+
tar -xvf ${{ env.ARTIFACTS_PATH }}tools.tar
137+
echo "$PWD/${{ env.T_CREST_PATH }}${{ env.TOOLS_PATH }}bin" >> $GITHUB_PATH
138+
139+
- name: Checkout TACLe benchmark repository
140+
uses: actions/checkout@v3
141+
with:
142+
repository: tacle/tacle-bench
143+
path: ${{ env.T_CREST_PATH }}${{ env.TACLE_PATH }}
144+
145+
- name: Checkout L2 cache
146+
uses: actions/checkout@v3
147+
with:
148+
path: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
149+
150+
- name: Run TACLe benchmarks
151+
working-directory: ${{ env.T_CREST_PATH }}
152+
run: |
153+
cp -v ${{ env.L2_PATH }}scripts/tacle_test.sh ${{ env.TACLE_PATH }}bench/app/
154+
cd ${{ env.TACLE_PATH }}bench/app/
155+
sudo chmod -v +x ./tacle_test.sh && ./tacle_test.sh
156+
157+
tacle-bench-kernel:
158+
runs-on: ubuntu-latest
159+
needs: [ build-tools ]
160+
161+
steps:
162+
- name: Download tools
163+
uses: actions/download-artifact@v4
164+
with:
165+
name: patmos-tools
166+
path: ${{ env.ARTIFACTS_PATH }}
167+
168+
- name: Unpack tools
169+
run: |
170+
tar -xvf ${{ env.ARTIFACTS_PATH }}tools.tar
171+
echo "$PWD/${{ env.T_CREST_PATH }}${{ env.TOOLS_PATH }}bin" >> $GITHUB_PATH
172+
173+
- name: Checkout TACLe benchmark repository
174+
uses: actions/checkout@v3
175+
with:
176+
repository: tacle/tacle-bench
177+
path: ${{ env.T_CREST_PATH }}${{ env.TACLE_PATH }}
178+
179+
- name: Checkout L2 cache
180+
uses: actions/checkout@v3
181+
with:
182+
path: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
183+
184+
- name: Run TACLe benchmarks
185+
working-directory: ${{ env.T_CREST_PATH }}
186+
run: |
187+
cp -v ${{ env.L2_PATH }}scripts/tacle_test.sh ${{ env.TACLE_PATH }}bench/kernel/
188+
cd ${{ env.TACLE_PATH }}bench/kernel/
189+
sudo chmod -v +x ./tacle_test.sh && ./tacle_test.sh --skip pm/ --skip isqrt/
190+
191+
tacle-bench-sequential:
192+
runs-on: ubuntu-latest
193+
needs: [ build-tools ]
194+
195+
steps:
196+
- name: Download tools
197+
uses: actions/download-artifact@v4
198+
with:
199+
name: patmos-tools
200+
path: ${{ env.ARTIFACTS_PATH }}
201+
202+
- name: Unpack tools
203+
run: |
204+
tar -xvf ${{ env.ARTIFACTS_PATH }}tools.tar
205+
echo "$PWD/${{ env.T_CREST_PATH }}${{ env.TOOLS_PATH }}bin" >> $GITHUB_PATH
206+
207+
- name: Checkout TACLe benchmark repository
208+
uses: actions/checkout@v3
209+
with:
210+
repository: tacle/tacle-bench
211+
path: ${{ env.T_CREST_PATH }}${{ env.TACLE_PATH }}
212+
213+
- name: Checkout L2 cache
214+
uses: actions/checkout@v3
215+
with:
216+
path: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
217+
218+
- name: Run TACLe benchmarks
219+
working-directory: ${{ env.T_CREST_PATH }}
220+
run: |
221+
cp -v ${{ env.L2_PATH }}scripts/tacle_test.sh ${{ env.TACLE_PATH }}bench/sequential/
222+
cd ${{ env.TACLE_PATH }}bench/sequential/
223+
sudo chmod -v +x ./tacle_test.sh && ./tacle_test.sh --skip ammunition/ --skip rijndael_dec/ --skip rijndael_enc/
224+
225+
tacle-bench-test:
226+
runs-on: ubuntu-latest
227+
needs: [ build-tools ]
228+
229+
steps:
230+
- name: Download tools
231+
uses: actions/download-artifact@v4
232+
with:
233+
name: patmos-tools
234+
path: ${{ env.ARTIFACTS_PATH }}
235+
236+
- name: Unpack tools
237+
run: |
238+
tar -xvf ${{ env.ARTIFACTS_PATH }}tools.tar
239+
echo "$PWD/${{ env.T_CREST_PATH }}${{ env.TOOLS_PATH }}bin" >> $GITHUB_PATH
240+
241+
- name: Checkout TACLe benchmark repository
242+
uses: actions/checkout@v3
243+
with:
244+
repository: tacle/tacle-bench
245+
path: ${{ env.T_CREST_PATH }}${{ env.TACLE_PATH }}
246+
247+
- name: Checkout L2 cache
248+
uses: actions/checkout@v3
249+
with:
250+
path: ${{ env.T_CREST_PATH }}${{ env.L2_PATH }}
251+
252+
- name: Run TACLe benchmarks
253+
working-directory: ${{ env.T_CREST_PATH }}
254+
run: |
255+
cp -v ${{ env.L2_PATH }}scripts/tacle_test.sh ${{ env.TACLE_PATH }}bench/test/
256+
cd ${{ env.TACLE_PATH }}bench/test/
257+
sudo chmod -v +x ./tacle_test.sh && ./tacle_test.sh
258+
259+
patmos-bench:
260+
runs-on: ubuntu-latest
261+
needs: [ build-tools ]
262+
263+
steps:
264+
- name: Download tools
265+
uses: actions/download-artifact@v4
266+
with:
267+
name: patmos-tools
268+
path: ${{ env.ARTIFACTS_PATH }}
269+
270+
- name: Unpack tools
271+
run: |
272+
tar -xvf ${{ env.ARTIFACTS_PATH }}tools.tar
273+
echo "$PWD/${{ env.T_CREST_PATH }}${{ env.TOOLS_PATH }}bin" >> $GITHUB_PATH
274+
275+
- name: Patmos benchmarks
276+
run: |
277+
cd ${{ env.T_CREST_PATH }}${{ env.BENCH_PATH }}build
278+
ctest -j${{ env.PATMOS_BENCH_JOBS }}

.github/workflows/scala.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

Patmos.fst

9.26 MB
Binary file not shown.

Patmos.fst.hier

526 KB
Binary file not shown.

scripts/tacle_test.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
3+
# This script should be copied to the TACLe bench repo directory of a specific benchmark type.
4+
# E.g. this script can be copied to the kernel benchmarks directory of the TACLe benchmark suite, and it will execute
5+
# all the benchmarks in there. This script is used for the L2 cache CI.
6+
7+
set +e
8+
9+
COMPILER=patmos-clang
10+
COMPILER_OPTIONS="-Wall -Wno-unknown-pragmas -Werror -O2"
11+
EXEC=patemu
12+
13+
PASS=0
14+
FAIL_COMP=0
15+
FAIL_EXEC=0
16+
17+
SKIP_DIRS=()
18+
19+
while [[ $# -gt 0 ]]; do
20+
case "$1" in
21+
--skip)
22+
if [[ -z "$2" ]]; then
23+
echo "Error: --skip requires an argument."
24+
exit 1
25+
fi
26+
SKIP_DIRS+=("$2")
27+
shift 2
28+
;;
29+
*)
30+
echo "Unknown argument: $1"
31+
exit 1
32+
;;
33+
esac
34+
done
35+
36+
should_skip() {
37+
local dir="$1"
38+
for skip in "${SKIP_DIRS[@]}"; do
39+
[[ "$dir" == "$skip" ]] && return 0
40+
done
41+
return 1
42+
}
43+
44+
for BENCH in */ ; do
45+
if should_skip "$BENCH"; then
46+
echo "Skipping $BENCH"
47+
continue
48+
fi
49+
50+
printf "Checking %s\n" "$BENCH"
51+
cd "$BENCH" || continue
52+
53+
rm -f a.out *.o
54+
55+
$COMPILER $COMPILER_OPTIONS *.c
56+
COMPILE_STATUS=$?
57+
58+
if [[ -f a.out ]]; then
59+
time $EXEC ./a.out
60+
RETURNVALUE=$?
61+
62+
if (( RETURNVALUE == 0 )); then
63+
printf "passed.\n"
64+
((PASS++))
65+
else
66+
printf "failed (wrong return value %d).\n" "$RETURNVALUE"
67+
((FAIL_EXEC++))
68+
fi
69+
70+
else
71+
printf "failed (compile error or warnings, status %d).\n" "$COMPILE_STATUS"
72+
((FAIL_COMP++))
73+
fi
74+
75+
cd ..
76+
done
77+
78+
echo "PASS: $PASS, FAIL_COMP: $FAIL_COMP, FAIL_EXEC: $FAIL_EXEC"
79+
80+
if (( FAIL_EXEC > 0 || FAIL_COMP > 0)); then
81+
exit 1
82+
fi

0 commit comments

Comments
 (0)