forked from pulp-platform/ara
-
Notifications
You must be signed in to change notification settings - Fork 0
583 lines (555 loc) · 18.1 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
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# Copyright 2021 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51
#
# Author: Matheus Cavalcante <[email protected]>
# Run functional regression checks
name: ci
on: [push, pull_request]
jobs:
#####################
# Toolchain stage #
#####################
tc-llvm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Recover the submodule commit hash
id: recover_hash
run: |
git submodule status toolchain/riscv-llvm | cut -d' ' -f1
echo "tc-llvm-hash=`git submodule status toolchain/riscv-llvm | cut -d' ' -f1`" >> $GITHUB_ENV
- name: Cache the LLVM toolchain
uses: actions/cache@v2
id: tc-llvm-cache
env:
cache-name: cache-llvm
with:
path: install/riscv-llvm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-llvm-hash }}
restore-keys:
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-llvm-hash }}
- name: Download the LLVM toolchain
if: steps.tc-llvm-cache.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/riscv-llvm
- name: Download Newlib
if: steps.tc-llvm-cache.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/newlib
- name: Compile LLVM
if: steps.tc-llvm-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install libmpc-dev
sudo apt-get install -y ninja-build
CC=gcc CXX=g++ make toolchain-llvm
- name: Tar LLVM
run: tar -cvf tc-llvm.tar install/riscv-llvm
- name: Upload LLVM
uses: actions/upload-artifact@v2
with:
name: tc-llvm
path: tc-llvm.tar
tc-gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Recover the submodule commit hash
id: recover_hash
run: |
git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1
echo "tc-gcc-hash=`git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1`" >> $GITHUB_ENV
- name: Cache the GCC toolchain
uses: actions/cache@v2
id: tc-gcc-cache
env:
cache-name: cache-gcc
with:
path: install/riscv-gcc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-gcc-hash }}
restore-keys:
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-gcc-hash }}
- name: Download the GCC toolchain
if: steps.tc-gcc-cache.outputs.cache-hit != 'true'
run: git submodule update --init --recursive -- toolchain/riscv-gnu-toolchain
- name: Compile GCC
if: steps.tc-gcc-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install libmpc-dev
CC=gcc CXX=g++ make toolchain-gcc
- name: Tar GCC
run: tar -cvf tc-gcc.tar install/riscv-gcc
- name: Upload GCC
uses: actions/upload-artifact@v2
with:
name: tc-gcc
path: tc-gcc.tar
tc-isa-sim:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Recover the submodule commit hash
id: recover_hash
run: |
git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1
echo "tc-isa-sim-hash=`git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1`" >> $GITHUB_ENV
- name: Cache Spike
uses: actions/cache@v2
id: tc-isa-sim-cache
env:
cache-name: cache-spike
with:
path: install/riscv-isa-sim
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-isa-sim-hash }}
restore-keys:
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-isa-sim-hash }}
- name: Download Spike
if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true'
run: |
git submodule update --init --recursive -- toolchain/riscv-isa-sim
git submodule foreach --recursive git reset --hard
- name: Compile Spike
if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true'
run: make riscv-isa-sim
- name: Tar Spike
run: tar -cvf tc-isa-sim.tar install/riscv-isa-sim
- name: Upload Spike
uses: actions/upload-artifact@v2
with:
name: tc-isa-sim
path: tc-isa-sim.tar
tc-verilator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Recover the submodule commit hash
id: recover_hash
run: |
git submodule status toolchain/verilator | cut -d' ' -f1
echo "tc-verilator-hash=`git submodule status toolchain/verilator | cut -d' ' -f1`" >> $GITHUB_ENV
- name: Cache Verilator
uses: actions/cache@v2
id: tc-verilator-cache
env:
cache-name: cache-verilator
with:
path: install/verilator
key: ${{ runner.os }}-build-llvm10-${{ env.cache-name }}-${{ env.tc-verilator-hash }}
restore-keys:
${{ runner.os }}-build-llvm10-${{ env.cache-name }}-${{ env.tc-verilator-hash }}
- name: Download Verilator
if: steps.tc-verilator-cache.outputs.cache-hit != 'true'
run: |
git submodule update --init --recursive -- toolchain/verilator
- name: Compile Verilator
if: steps.tc-verilator-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install flex libfl-dev
make verilator
- name: Tar Verilator
run: tar -cvf tc-verilator.tar install/verilator
- name: Upload Verilator
uses: actions/upload-artifact@v2
with:
name: tc-verilator
path: tc-verilator.tar
###################
# Compile stage #
###################
compile-apps:
runs-on: ubuntu-latest
strategy:
matrix:
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
needs: tc-llvm
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Download Spike
run: |
git submodule update --init --recursive -- toolchain/riscv-isa-sim
git submodule foreach --recursive git reset --hard
- name: Download the LLVM toolchain
uses: actions/download-artifact@v2
with:
name: tc-llvm
- name: Untar LLVM
run: tar xvf tc-llvm.tar
- name: Compile applications
run: config=${{ matrix.ara_config }} make -C apps
- name: Upload applications
uses: actions/upload-artifact@v2
with:
name: compile-apps-${{ matrix.ara_config }}
path: apps/bin
compile-riscv-tests:
runs-on: ubuntu-latest
strategy:
matrix:
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
needs: ["tc-llvm", "tc-gcc", "tc-isa-sim"]
steps:
- uses: actions/checkout@v2
- name: Download Spike
run: |
git submodule update --init --recursive -- toolchain/riscv-isa-sim
git submodule foreach --recursive git reset --hard
- name: Get Spike artifacts
uses: actions/download-artifact@v2
with:
name: tc-isa-sim
- name: Untar Spike
run: tar xvf tc-isa-sim.tar
- name: Get LLVM toolchain artifacts
uses: actions/download-artifact@v2
with:
name: tc-llvm
- name: Untar LLVM
run: tar xvf tc-llvm.tar
- name: Get GCC toolchain artifacts
uses: actions/download-artifact@v2
with:
name: tc-gcc
- name: Untar GCC
run: tar xvf tc-gcc.tar
- name: Compile applications
run: config=${{ matrix.ara_config }} make -C apps riscv_tests
- name: Upload applications
uses: actions/upload-artifact@v2
with:
name: compile-riscv-tests-${{ matrix.ara_config }}
path: apps/bin
compile-ara:
runs-on: ubuntu-latest
strategy:
matrix:
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
needs: ["tc-verilator", "tc-isa-sim"]
steps:
- uses: actions/checkout@v2
- name: Download Spike
run: |
git submodule update --init --recursive -- toolchain/riscv-isa-sim
git submodule foreach --recursive git reset --hard
- name: Get Spike artifacts
uses: actions/download-artifact@v2
with:
name: tc-isa-sim
- name: Untar Spike
run: tar xvf tc-isa-sim.tar
- name: Get Verilator artifacts
uses: actions/download-artifact@v2
with:
name: tc-verilator
- name: Untar Verilator
run: tar xvf tc-verilator.tar
- name: Set the Verilator root directory
run: |
echo VERILATOR_ROOT="$GITHUB_WORKSPACE/install/verilator" >> $GITHUB_ENV
VERILATOR_ROOT="$GITHUB_WORKSPACE/install/verilator"
ln -s $VERILATOR_ROOT/share/verilator/include $VERILATOR_ROOT/include
ln -s $VERILATOR_ROOT/share/verilator/bin/verilator_includer $VERILATOR_ROOT/bin/verilator_includer
- name: Download RTL submodules
run: git submodule update --init --recursive hardware
- name: Compile Verilated model of Ara
run: |
sudo apt-get install libelf-dev
make -C hardware apply-patches
config=${{ matrix.ara_config }} make -C hardware verilate
- name: Tar Verilated model of Ara
run: tar -cvf ara.tar hardware/build/verilator hardware/bender
- name: Upload Ara Verilated model
uses: actions/upload-artifact@v2
with:
name: compile-ara-${{ matrix.ara_config }}
path: ara.tar
####################
# Simulate stage #
####################
simulate:
runs-on: ubuntu-latest
strategy:
matrix:
app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, fconv3d]
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
needs: ["compile-ara", "compile-apps"]
steps:
- uses: actions/checkout@v2
- name: Get Spike artifacts
uses: actions/download-artifact@v2
with:
name: tc-isa-sim
- name: Untar Spike
run: tar xvf tc-isa-sim.tar
- name: Get Verilated model of Ara
uses: actions/download-artifact@v2
with:
name: compile-ara-${{ matrix.ara_config }}
- name: Untar Verilated model of Ara
run: tar xvf ara.tar
- name: Get applications
uses: actions/download-artifact@v2
with:
name: compile-apps-${{ matrix.ara_config }}
path: apps/bin
- name: Run test
run: config=${{ matrix.ara_config }} app=${{ matrix.app }} make -C hardware simv
########################
# RISC-V Tests stage #
########################
riscv-tests-simv:
runs-on: ubuntu-latest
strategy:
matrix:
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
needs: ["compile-ara", "compile-riscv-tests"]
steps:
- uses: actions/checkout@v2
- name: Get Spike artifacts
uses: actions/download-artifact@v2
with:
name: tc-isa-sim
- name: Untar Spike
run: tar xvf tc-isa-sim.tar
- name: Get Verilated model of Ara
uses: actions/download-artifact@v2
with:
name: compile-ara-${{ matrix.ara_config }}
- name: Untar Verilated model of Ara
run: tar xvf ara.tar
- name: Get RISC-V tests
uses: actions/download-artifact@v2
with:
name: compile-riscv-tests-${{ matrix.ara_config }}
path: apps/bin
- name: Run tests
run: config=${{ matrix.ara_config }} make -C hardware -j8 riscv_tests_simv
riscv-tests-spike:
runs-on: ubuntu-latest
needs: ["tc-isa-sim", "compile-riscv-tests"]
steps:
- uses: actions/checkout@v2
- name: Get Spike artifacts
uses: actions/download-artifact@v2
with:
name: tc-isa-sim
- name: Untar Spike
run: tar xvf tc-isa-sim.tar
- name: Download the LLVM toolchain
uses: actions/download-artifact@v2
with:
name: tc-llvm
- name: Untar LLVM
run: tar xvf tc-llvm.tar
- name: Download the GCC toolchain
uses: actions/download-artifact@v2
with:
name: tc-gcc
- name: Untar GCC
run: tar xvf tc-gcc.tar
- name: Run tests
run: |
make -C apps/riscv-tests/isa clean
make -C apps riscv_tests_spike
- name: Upload dumps
uses: actions/upload-artifact@v2
with:
name: riscv-tests-spike
path: |
apps/riscv-tests/isa/*.dump
apps/riscv-tests/isa/*.out32
###################
# Linting stage #
###################
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Check license
run: python scripts/licence-checker.py --config scripts/licence-checker.hjson hardware
check-clang-format:
runs-on: ubuntu-latest
needs: ['tc-llvm']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Download the LLVM toolchain
uses: actions/download-artifact@v2
with:
name: tc-llvm
- name: Untar LLVM
run: tar xvf tc-llvm.tar
- name: Run clang-format
run: |
for file in `find apps -type f -name "*.[c|h|cpp|hpp]" | grep -vP "apps/riscv-tests"`; do
./scripts/run-clang-format.py --clang-format-executable install/riscv-llvm/bin/clang-format $file || EXIT_STATUS=$?
done
for file in `find apps/riscv-tests/isa/rv64uv -type f -name "*.[c|h|cpp|hpp]"`; do
./scripts/run-clang-format.py --clang-format-executable install/riscv-llvm/bin/clang-format $file || EXIT_STATUS=$?
done
exit $EXIT_STATUS
check-trailing-whitespaces:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine base commit
run: |
if [[ -n $GITHUB_BASE_REF ]]; then
# Make sure we have the latest version of the target branch
git fetch origin $GITHUB_BASE_REF
echo "base=origin/$GITHUB_BASE_REF" >> $GITHUB_ENV
else
echo "base=HEAD~1" >> $GITHUB_ENV
fi
- name: Check for trailing whitespaces and tabs
run: git diff --check $base HEAD --
#####################
# Benchmark stage #
#####################
benchmark:
runs-on: ubuntu-latest
strategy:
matrix:
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
needs: ["compile-ara", "compile-apps"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Download the LLVM toolchain
uses: actions/download-artifact@v2
with:
name: tc-llvm
- name: Untar LLVM
run: tar xvf tc-llvm.tar
- name: Get Spike artifacts
uses: actions/download-artifact@v2
with:
name: tc-isa-sim
- name: Untar Spike
run: tar xvf tc-isa-sim.tar
- name: Get Verilated model of Ara
uses: actions/download-artifact@v2
with:
name: compile-ara-${{ matrix.ara_config }}
- name: Untar Verilated model of Ara
run: tar xvf ara.tar
- name: Benchmark Ara
run: config=${{ matrix.ara_config }} ./scripts/benchmark.sh
- name: Tar runtime results
run: |
tar -cvf benchmarks-${{ matrix.ara_config }}.tar *.benchmark
- name: Upload runtime results
uses: actions/upload-artifact@v2
with:
name: benchmark-${{ matrix.ara_config }}
path: benchmarks-${{ matrix.ara_config }}.tar
roofline:
runs-on: ubuntu-latest
needs: benchmark
steps:
- uses: actions/checkout@v2
- name: Get benchmark results (2 lanes)
uses: actions/download-artifact@v2
with:
name: benchmark-2_lanes
- name: Get benchmark results (4 lanes)
uses: actions/download-artifact@v2
with:
name: benchmark-4_lanes
- name: Get benchmark results (8 lanes)
uses: actions/download-artifact@v2
with:
name: benchmark-8_lanes
- name: Get benchmark results (16 lanes)
uses: actions/download-artifact@v2
with:
name: benchmark-16_lanes
- name: Untar the results
run: |
tar xvf benchmarks-2_lanes.tar
tar xvf benchmarks-4_lanes.tar
tar xvf benchmarks-8_lanes.tar
tar xvf benchmarks-16_lanes.tar
- name: Install gnuplot
run: |
sudo apt-get update
sudo apt-get install gnuplot
- name: Plot the rooflines
run: gnuplot -c scripts/benchmark.gnuplot
- name: Upload the imatmul roofline
uses: actions/upload-artifact@v2
with:
name: imatmul_roofline
path: imatmul.png
- name: Upload the fmatmul roofline
uses: actions/upload-artifact@v2
with:
name: fmatmul_roofline
path: fmatmul.png
- name: Upload the iconv2d roofline
uses: actions/upload-artifact@v2
with:
name: iconv2d_roofline
path: iconv2d.png
- name: Upload the fconv2d roofline
uses: actions/upload-artifact@v2
with:
name: fconv2d_roofline
path: fconv2d.png
- name: Upload the fconv3d roofline
uses: actions/upload-artifact@v2
with:
name: fconv3d_roofline
path: fconv3d.png
####################
# Clean-up stage #
####################
clean-up:
runs-on: ubuntu-latest
if: always()
needs: ["simulate", "riscv-tests-spike", "riscv-tests-simv"]
steps:
- uses: actions/checkout@v2
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
tc-llvm
tc-gcc
tc-isa-sim
tc-verilator
riscv-tests-spike
clean-up-compile-runs:
runs-on: ubuntu-latest
strategy:
matrix:
ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes]
if: always()
needs: ["simulate", "riscv-tests-spike", "riscv-tests-simv"]
steps:
- uses: actions/checkout@v2
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
compile-ara-${{ matrix.ara_config }}
compile-apps-${{ matrix.ara_config }}
compile-riscv-tests-${{ matrix.ara_config }}
benchmark-${{ matrix.ara_config }}