forked from kuznia-rdzeni/coreblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
287 lines (251 loc) · 8.72 KB
/
benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: Core Benchmarks
on:
push:
branches:
- master
pull_request:
types: [ synchronize, labeled ]
branches:
- master
workflow_dispatch:
jobs:
synthesis:
strategy:
matrix:
config: [basic, full]
name: Run synthesis benchmarks
if: >
github.ref == 'refs/heads/master' ||
(
github.event_name == 'pull_request' &&
(
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'benchmark')) ||
(github.event.action == 'labeled' && github.event.label.name == 'benchmark')
)
)
runs-on: ubuntu-latest
timeout-minutes: 40
container: ghcr.io/kuznia-rdzeni/amaranth-synth:ecp5-2023.11.19_v
steps:
- uses: actions/checkout@v4
- name: Set ownership (Github Actions workaround)
run: |
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
- name: Synthesize
run: |
. venv/bin/activate
PYTHONHASHSEED=0 ./scripts/synthesize.py --verbose --strip-debug --config ${{ matrix.config }}
- name: Print synthesis information
run: cat ./build/top.tim
- name: Collect Benchmark information
run: |
. venv/bin/activate
./scripts/parse_benchmark_info.py -o synth-benchmark-${{ matrix.config }}.json
cat ./synth-benchmark-${{ matrix.config }}.json
- uses: actions/upload-artifact@v4
with:
name: synth_benchmark_results-${{ matrix.config }}
path: synth-benchmark-${{ matrix.config }}.json
build-perf-benchmarks:
name: Build performance benchmarks
runs-on: ubuntu-latest
if: >
github.ref == 'refs/heads/master' ||
(
github.event_name == 'pull_request' &&
(
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'benchmark')) ||
(github.event.action == 'labeled' && github.event.label.name == 'benchmark')
)
)
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2024.03.12
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build embench
run: cd test/external/embench && make
- uses: actions/upload-artifact@v4
with:
name: "embench"
path: |
test/external/embench/build
run-perf-benchmarks:
name: Run performance benchmarks
runs-on: ubuntu-latest
timeout-minutes: 30
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-2023.11.19_v
needs: build-perf-benchmarks
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set ownership (Github Actions workaround)
run: |
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
- name: Generate Verilog
run: |
. venv/bin/activate
PYTHONHASHSEED=0 TRANSACTRON_VERBOSE=1 ./scripts/gen_verilog.py --verbose --config full
- uses: actions/download-artifact@v4
with:
name: "embench"
path: test/external/embench/build
- name: Run benchmarks
run: |
. venv/bin/activate
scripts/run_benchmarks.py -o perf_benchmark.json --summary perf.md
cat perf.md >> $GITHUB_STEP_SUMMARY
- uses: actions/upload-artifact@v4
with:
name: perf_benchmark_results
path: perf_benchmark.json
pr-summary:
name: Create benchmark summary for a pull request
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [run-perf-benchmarks, synthesis]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set ownership (Github Actions workaround)
run: |
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
- name: Get baseline benchmarks results
uses: actions/cache@v4
env:
cache-name: benchmark-results
with:
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.event.pull_request.base.sha }}
path: |
perf_benchmark.json
synth-benchmark-basic.json
synth-benchmark-full.json
- uses: actions/download-artifact@v4
with:
name: perf_benchmark_results
path: artifacts
- uses: actions/download-artifact@v4
with:
name: synth_benchmark_results-basic
path: artifacts
- uses: actions/download-artifact@v4
with:
name: synth_benchmark_results-full
path: artifacts
- name: Save PR number
run: |
mkdir -p ./summary
echo ${{ github.event.number }} > ./summary/pr_number
- name: Create comment
id: createComment
run: |
. venv/bin/activate
{
echo "## Benchmarks summary"
echo "### Performance benchmarks"
ci/print_benchmark_summary.py --precision 3 artifacts/perf_benchmark.json perf_benchmark.json
echo
echo "You can view all the metrics [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."
echo "### Synthesis benchmarks (basic)"
ci/print_benchmark_summary.py --precision 0 artifacts/synth-benchmark-basic.json synth-benchmark-basic.json
echo
echo "### Synthesis benchmarks (full)"
ci/print_benchmark_summary.py --precision 0 artifacts/synth-benchmark-full.json synth-benchmark-full.json
echo
} >> summary/comment.md
- uses: actions/upload-artifact@v4
with:
name: benchmark-summary
path: summary
publish-benchmarks:
name: Publish benchmarks
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [run-perf-benchmarks, synthesis]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: perf_benchmark_results
path: .
- uses: actions/download-artifact@v4
with:
name: synth_benchmark_results-basic
path: .
- uses: actions/download-artifact@v4
with:
name: synth_benchmark_results-full
path: .
- name: Put results in a cache
uses: actions/cache@v4
env:
cache-name: benchmark-results
with:
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.sha }}
path: |
perf_benchmark.json
synth-benchmark-basic.json
synth-benchmark-full.json
- name: Store benchmark result (IPC)
uses: benchmark-action/github-action-benchmark@v1
with:
name: Performance (IPC)
tool: 'customBiggerIsBetter'
output-file-path: './perf_benchmark.json'
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
benchmark-data-dir-path: "dev/benchmark"
- name: Store synthesis benchmark result (basic)
uses: benchmark-action/github-action-benchmark@v1
with:
name: Fmax and LCs (basic)
tool: 'customBiggerIsBetter'
output-file-path: './synth-benchmark-basic.json'
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
benchmark-data-dir-path: "dev/benchmark"
- name: Store synthesis benchmark result (full)
uses: benchmark-action/github-action-benchmark@v1
with:
name: Fmax and LCs (full)
tool: 'customBiggerIsBetter'
output-file-path: './synth-benchmark-full.json'
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
benchmark-data-dir-path: "dev/benchmark"