-
Notifications
You must be signed in to change notification settings - Fork 46
566 lines (546 loc) · 19 KB
/
ci.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# Copyright 2021 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: ci
on:
push:
pull_request:
schedule:
# Run the CI on the main branch every morning at 01:19 UTC
- cron: '19 1 * * *'
jobs:
################
# Toolchains #
################
tc-gcc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Recover the submodule commit hash
run: |
git rev-parse HEAD:toolchain/riscv-gnu-toolchain
echo "riscv-gnu-toolchain-hash=`git rev-parse HEAD:toolchain/riscv-gnu-toolchain`" >> $GITHUB_ENV
- name: Cache riscv-gnu-toolchain
uses: actions/cache@v4
id: riscv-gnu-toolchain
with:
path: install/riscv-gcc
key: ${{ runner.os }}-riscv-gnu-toolchain-${{ env.riscv-gnu-toolchain-hash }}
- name: Download riscv-gnu-toolchain
if: steps.riscv-gnu-toolchain.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/riscv-gnu-toolchain
- name: Compile riscv-gnu-toolchain
if: steps.riscv-gnu-toolchain.outputs.cache-hit != 'true'
run: |
sudo apt-get install libmpc-dev
make tc-riscv-gcc
- name: Tar riscv-gnu-toolchain
run: tar --posix --use-compress-program zstd -cf riscv-gnu-toolchain.tzst install/riscv-gcc
- name: Upload riscv-gnu-toolchain
uses: actions/upload-artifact@v4
with:
name: riscv-gnu-toolchain
path: riscv-gnu-toolchain.tzst
tc-llvm:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Recover the submodule commit hash
run: |
git rev-parse HEAD:toolchain/llvm-project
echo "llvm-project-hash=`git rev-parse HEAD:toolchain/llvm-project`" >> $GITHUB_ENV
- name: Cache llvm-project
uses: actions/cache@v4
id: llvm-project
with:
path: install/llvm
key: ${{ runner.os }}-llvm-project-${{ env.llvm-project-hash }}
- name: Download llvm-project
if: steps.llvm-project.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/llvm-project
- name: Compile llvm-project
if: steps.llvm-project.outputs.cache-hit != 'true'
run: |
make tc-llvm
- name: Tar llvm-project
run: tar --posix --use-compress-program zstd -cf llvm-project.tzst install/llvm
- name: Upload llvm-project
uses: actions/upload-artifact@v4
with:
name: llvm-project
path: llvm-project.tzst
tc-halide:
runs-on: ubuntu-20.04
needs: tc-llvm
steps:
- uses: actions/checkout@v4
- name: Recover the submodule commit hash
run: |
git rev-parse HEAD:toolchain/halide
echo "halide-hash=`git rev-parse HEAD:toolchain/halide`" >> $GITHUB_ENV
- name: Cache halide
uses: actions/cache@v4
id: halide
with:
path: install/halide
key: ${{ runner.os }}-halide-${{ env.halide-hash }}
- name: Get llvm-project artifacts
if: steps.halide.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: llvm-project
- name: Untar llvm-project
if: steps.halide.outputs.cache-hit != 'true'
run: tar --use-compress-program zstd -xf llvm-project.tzst
- name: Download halide
if: steps.halide.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/halide
- name: Compile halide
if: steps.halide.outputs.cache-hit != 'true'
run: |
make halide
- name: Tar halide
run: tar --posix --use-compress-program zstd -cf halide.tzst install/halide
- name: Upload halide
uses: actions/upload-artifact@v4
with:
name: halide
path: halide.tzst
###########
# Tools #
###########
riscv-isa-sim:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Cache riscv-isa-sim
uses: actions/cache@v4
id: riscv-isa-sim
with:
path: install/riscv-isa-sim
key: ${{ runner.os }}-riscv-isa-sim-${{ hashFiles('toolchain/riscv-isa-sim/**') }}
- name: Download riscv-isa-sim
if: steps.riscv-isa-sim.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/riscv-isa-sim
- name: Compile riscv-isa-sim
if: steps.riscv-isa-sim.outputs.cache-hit != 'true'
run: |
sudo apt install device-tree-compiler
make riscv-isa-sim
- name: Tar riscv-isa-sim
run: tar --posix --use-compress-program zstd -cf riscv-isa-sim.tzst install/riscv-isa-sim
- name: Upload riscv-isa-sim
uses: actions/upload-artifact@v4
with:
name: riscv-isa-sim
path: riscv-isa-sim.tzst
verilator:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Recover the submodule commit hash
run: |
git rev-parse HEAD:toolchain/verilator
echo "tc-verilator-hash=`git rev-parse HEAD:toolchain/verilator`" >> $GITHUB_ENV
- name: Cache Verilator
uses: actions/cache@v4
id: verilator-cache
with:
path: install/verilator
key: ${{ runner.os }}-verilator-llvm-${{ env.tc-verilator-hash }}
- name: Download Verilator
if: steps.verilator-cache.outputs.cache-hit != 'true'
run: |
git submodule update --init --recursive -- toolchain/verilator
- name: Compile Verilator
if: steps.verilator-cache.outputs.cache-hit != 'true'
run: |
sudo apt install libfl-dev
make verilator
- name: Tar verilator
run: tar --posix --use-compress-program zstd -cf verilator.tzst install/verilator
- name: Upload verilator
uses: actions/upload-artifact@v4
with:
name: verilator
path: verilator.tzst
####################
# Build Hardware #
####################
verilator-model:
runs-on: ubuntu-20.04
timeout-minutes: 60
needs: verilator
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Cache Verilator Model
uses: actions/cache@v4
id: verilator-model
with:
path: hardware/verilator_build/Vmempool_tb_verilator
key: ${{ runner.os }}-verilator-model-${{ matrix.mempool_config }}-${{ hashFiles('hardware/**','config/**') }}
- name: Get Verilator artifacts
if: steps.verilator-model.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: verilator
- name: Untar Verilator
if: steps.verilator-model.outputs.cache-hit != 'true'
run: tar --use-compress-program zstd -xf verilator.tzst
- name: Build Model
if: steps.verilator-model.outputs.cache-hit != 'true'
env:
config: ${{ matrix.mempool_config }}
run: |
sudo apt install libelf-dev
ln -s $GITHUB_WORKSPACE/install/verilator/share/verilator/include $GITHUB_WORKSPACE/install/verilator/include
ln -s $GITHUB_WORKSPACE/install/verilator/share/verilator/bin/verilator_includer $GITHUB_WORKSPACE/install/verilator/bin/verilator_includer
make bender
make update-deps
make -C hardware $GITHUB_WORKSPACE/hardware/verilator_build/Vmempool_tb_verilator
- name: Tar Verilator Model
run: tar --posix --use-compress-program zstd -cf verilator-model.tzst hardware/verilator_build/Vmempool_tb_verilator
- name: Upload Verilator Model
uses: actions/upload-artifact@v4
with:
name: verilator-model-${{ matrix.mempool_config }}
path: verilator-model.tzst
######################
# Regenerate files #
######################
check-bootrom:
runs-on: ubuntu-20.04
needs: tc-gcc
steps:
- uses: actions/checkout@v4
- name: Get riscv-gnu-toolchain artifacts
uses: actions/download-artifact@v4
with:
name: riscv-gnu-toolchain
- name: Untar riscv-gnu-toolchain
run: tar --use-compress-program zstd -xf riscv-gnu-toolchain.tzst
- name: Build BootROM
run: |
rm software/runtime/bootrom.img
rm hardware/src/bootrom.sv
make -C software runtime/bootrom.img
make -C hardware src/bootrom.sv
git diff --exit-code
check-control-registers:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Build Control Registers
run: |
git submodule update --init --recursive -- hardware/deps/register_interface
git apply hardware/deps/patches/register_interface.patch
make -C hardware/src/control_registers clean
make -C hardware/src/control_registers all
git diff --ignore-submodules=dirty --exit-code
check-opcodes:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Regenerate opcodes
run: |
make update_opcodes
git diff --exit-code
####################
# Build Software #
####################
build-apps-gcc:
runs-on: ubuntu-20.04
needs: tc-gcc
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Get riscv-gnu-toolchain artifacts
uses: actions/download-artifact@v4
with:
name: riscv-gnu-toolchain
- name: Untar riscv-gnu-toolchain
run: tar --use-compress-program zstd -xf riscv-gnu-toolchain.tzst
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Build Apps
env:
config: ${{ matrix.mempool_config }}
RISCV_WARNINGS: '-Werror'
run: |
COMPILER=gcc make -C software/apps baremetal omp
COMPILER=gcc make -C software/tests baremetal omp
- name: Tar apps-gcc Model
run: tar --posix --use-compress-program zstd -cf apps-gcc.tzst software/bin
- name: Upload apps-gcc
uses: actions/upload-artifact@v4
with:
name: apps-gcc-${{ matrix.mempool_config }}
path: apps-gcc.tzst
build-apps-llvm:
runs-on: ubuntu-20.04
needs: [tc-gcc, tc-llvm]
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Get riscv-gnu-toolchain artifacts
uses: actions/download-artifact@v4
with:
name: riscv-gnu-toolchain
- name: Untar riscv-gnu-toolchain
run: tar --use-compress-program zstd -xf riscv-gnu-toolchain.tzst
- name: Get llvm-project artifacts
uses: actions/download-artifact@v4
with:
name: llvm-project
- name: Untar llvm-project
run: tar --use-compress-program zstd -xf llvm-project.tzst
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Build Apps
env:
config: ${{ matrix.mempool_config }}
RISCV_WARNINGS: '-Werror'
run: |
COMPILER=llvm make -C software/apps/baremetal all_llvm
COMPILER=llvm make -C software/tests baremetal
- name: Tar apps-llvm Model
run: tar --posix --use-compress-program zstd -cf apps-llvm.tzst software/bin
- name: Upload apps-llvm
uses: actions/upload-artifact@v4
with:
name: apps-llvm-${{ matrix.mempool_config }}
path: apps-llvm.tzst
build-apps-halide:
runs-on: ubuntu-20.04
needs: [tc-gcc, tc-llvm, tc-halide]
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Get riscv-gnu-toolchain artifacts
uses: actions/download-artifact@v4
with:
name: riscv-gnu-toolchain
- name: Untar riscv-gnu-toolchain
run: tar --use-compress-program zstd -xf riscv-gnu-toolchain.tzst
- name: Get llvm-project artifacts
uses: actions/download-artifact@v4
with:
name: llvm-project
- name: Untar llvm-project
run: tar --use-compress-program zstd -xf llvm-project.tzst
- name: Get halide artifacts
uses: actions/download-artifact@v4
with:
name: halide
- name: Untar halide
run: tar --use-compress-program zstd -xf halide.tzst
- name: Build Apps
env:
config: ${{ matrix.mempool_config }}
RISCV_WARNINGS: '-Werror'
run: |
COMPILER=llvm make -C software/apps/halide all
- name: Tar apps-halide Model
run: tar --posix --use-compress-program zstd -cf apps-halide.tzst software/bin
- name: Upload apps-halide
uses: actions/upload-artifact@v4
with:
name: apps-halide-${{ matrix.mempool_config }}
path: apps-halide.tzst
##################
# Run Software #
##################
run-apps-gcc:
runs-on: ubuntu-20.04
timeout-minutes: 20
needs: [build-apps-gcc, riscv-isa-sim, verilator-model]
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Get apps-gcc artifacts
uses: actions/download-artifact@v4
with:
name: apps-gcc-${{ matrix.mempool_config }}
- name: Untar apps-gcc
run: tar --use-compress-program zstd -xf apps-gcc.tzst
- name: Get riscv-isa-sim artifacts
uses: actions/download-artifact@v4
with:
name: riscv-isa-sim
- name: Untar riscv-isa-sim
run: tar --use-compress-program zstd -xf riscv-isa-sim.tzst
- name: Get verilator-model artifacts
uses: actions/download-artifact@v4
with:
name: verilator-model-${{ matrix.mempool_config }}
- name: Untar verilator-model
run: tar --use-compress-program zstd -xf verilator-model.tzst
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Run GCC Apps
env:
config: ${{ matrix.mempool_config }}
run: |
cd hardware
# Don't regenerate previously build artifacts
app=apps/baremetal/tests make -o $GITHUB_WORKSPACE/hardware/verilator_build/Vmempool_tb_verilator verilate
make trace
run-apps-llvm:
runs-on: ubuntu-20.04
timeout-minutes: 20
needs: [build-apps-llvm, riscv-isa-sim, verilator-model]
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Get apps-llvm artifacts
uses: actions/download-artifact@v4
with:
name: apps-llvm-${{ matrix.mempool_config }}
- name: Untar apps-llvm
run: tar --use-compress-program zstd -xf apps-llvm.tzst
- name: Get riscv-isa-sim artifacts
uses: actions/download-artifact@v4
with:
name: riscv-isa-sim
- name: Untar riscv-isa-sim
run: tar --use-compress-program zstd -xf riscv-isa-sim.tzst
- name: Get verilator-model artifacts
uses: actions/download-artifact@v4
with:
name: verilator-model-${{ matrix.mempool_config }}
- name: Untar verilator-model
run: tar --use-compress-program zstd -xf verilator-model.tzst
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Run LLVM Apps
env:
config: ${{ matrix.mempool_config }}
run: |
cd hardware
# Don't regenerate previously build artifacts
app=apps/baremetal/tests make -o $GITHUB_WORKSPACE/hardware/verilator_build/Vmempool_tb_verilator verilate
make trace
run-apps-halide:
runs-on: ubuntu-20.04
timeout-minutes: 20
needs: [build-apps-halide, riscv-isa-sim, verilator-model]
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- uses: actions/checkout@v4
- name: Get apps-halide artifacts
uses: actions/download-artifact@v4
with:
name: apps-halide-${{ matrix.mempool_config }}
- name: Untar apps-halide
run: tar --use-compress-program zstd -xf apps-halide.tzst
- name: Get riscv-isa-sim artifacts
uses: actions/download-artifact@v4
with:
name: riscv-isa-sim
- name: Untar riscv-isa-sim
run: tar --use-compress-program zstd -xf riscv-isa-sim.tzst
- name: Get verilator-model artifacts
uses: actions/download-artifact@v4
with:
name: verilator-model-${{ matrix.mempool_config }}
- name: Untar verilator-model
run: tar --use-compress-program zstd -xf verilator-model.tzst
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Run Halide Apps
env:
config: ${{ matrix.mempool_config }}
run: |
cd hardware
# Don't regenerate previously build artifacts
app=apps/halide/2d_convolution make -o $GITHUB_WORKSPACE/hardware/verilator_build/Vmempool_tb_verilator verilate
make trace
unit-test:
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [tc-gcc, riscv-isa-sim, verilator-model]
steps:
- uses: actions/checkout@v4
- name: Get riscv-gnu-toolchain artifacts
uses: actions/download-artifact@v4
with:
name: riscv-gnu-toolchain
- name: Untar riscv-gnu-toolchain
run: tar --use-compress-program zstd -xf riscv-gnu-toolchain.tzst
- name: Get riscv-isa-sim artifacts
uses: actions/download-artifact@v4
with:
name: riscv-isa-sim
- name: Untar riscv-isa-sim
run: tar --use-compress-program zstd -xf riscv-isa-sim.tzst
- name: Get verilator-model artifacts
uses: actions/download-artifact@v4
with:
name: verilator-model-minpool
- name: Untar verilator-model
run: tar --use-compress-program zstd -xf verilator-model.tzst
- name: Execute tests
run: |
# Don't regenerate previously build artifacts
sudo apt install device-tree-compiler
make update_opcodes
touch $GITHUB_WORKSPACE/software/runtime/encoding.h
touch $GITHUB_WORKSPACE/hardware/src/bootrom.sv
touch $GITHUB_WORKSPACE/hardware/deps/snitch/src/riscv_instr.sv
touch $GITHUB_WORKSPACE/hardware/verilator_build/Vmempool_tb_verilator.mk
touch $GITHUB_WORKSPACE/hardware/verilator_build/Vmempool_tb_verilator
make riscv-tests
##############
# Clean-up #
##############
clean-up:
runs-on: ubuntu-20.04
if: always()
needs: [tc-gcc, tc-llvm, riscv-isa-sim, verilator, tc-halide, verilator-model,
build-apps-llvm, build-apps-gcc, build-apps-halide, unit-test, run-apps-gcc,
run-apps-llvm, run-apps-halide]
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
riscv-gnu-toolchain
llvm-project
halide
riscv-isa-sim
verilator
clean-up-compile-runs:
runs-on: ubuntu-20.04
if: always()
needs: [tc-gcc, tc-llvm, riscv-isa-sim, verilator, tc-halide, verilator-model,
build-apps-llvm, build-apps-gcc, build-apps-halide, unit-test, run-apps-gcc,
run-apps-llvm, run-apps-halide]
strategy:
matrix:
mempool_config: [minpool, mempool]
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
verilator-model-${{ matrix.mempool_config }}
apps-gcc-${{ matrix.mempool_config }}
apps-llvm-${{ matrix.mempool_config }}
apps-halide-${{ matrix.mempool_config }}