-
Notifications
You must be signed in to change notification settings - Fork 37
447 lines (379 loc) · 16.4 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
name: CI
on: [push, pull_request]
env:
BUILD_TYPE: Release
jobs:
build:
strategy:
matrix:
config:
- {name: "Linux", os: ubuntu-latest, cmakegen: "", llvm: "linux-gnu-ubuntu-20.04", llvm-ext: ".tar.xz", tc: "linux-ubuntu14", tc-ext: ".tar.gz", unpack: "tar xf"}
#- {name: "Windows", os: windows-latest, cmakegen: "-G \"Unix Makefiles\" -DCMAKE_MAKE_PROGRAM=make", llvm: "", llvm-ext: "", tc: "w64-mingw32", tc-ext: ".zip", unpack: "unzip"}
#- {name: "Mac", os: macos-10.15, cmakegen: "", llvm: "apple-darwin", llvm-ext: ".tar.xz", tc: "apple-darwin", tc-ext: ".tar.gz", unpack: "tar xf"}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}_build
steps:
- uses: actions/checkout@v4
- name: Requirements (Linux)
if: matrix.config.name == 'Linux'
run: |
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-program-options-dev
- name: Requirements (Windows)
if: matrix.config.name == 'Windows'
working-directory: ${{runner.workspace}}
shell: bash
run: |
choco install boost-msvc-14.2
choco install wget unzip
choco install llvm --version=11.0.0 --allow-downgrade
choco install make
ln -s "/c/Program Files/LLVM" llvm-lib
- name: Requirements (Mac)
if: matrix.config.name == 'Mac'
run: |
brew install boost coreutils
- name: Requirements (Linux/Mac)
if: matrix.config.name == 'Linux' || matrix.config.name == 'Mac'
working-directory: ${{runner.workspace}}
shell: bash
run: |
LLVM_NAME="clang+llvm-11.0.0-x86_64-${{ matrix.config.llvm }}"
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/$LLVM_NAME${{ matrix.config.llvm-ext }}
${{ matrix.config.unpack }} $LLVM_NAME${{ matrix.config.llvm-ext }}
mv $LLVM_NAME llvm-lib
- name: Requirements
shell: bash
working-directory: ${{runner.workspace}}
run: |
TC_NAME="riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-${{ matrix.config.tc }}"
wget https://static.dev.sifive.com/dev-tools/$TC_NAME${{ matrix.config.tc-ext }}
${{ matrix.config.unpack }} $TC_NAME${{ matrix.config.tc-ext }}
mv $TC_NAME riscv-tc
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
export LLVM_DIR=${{runner.workspace}}/llvm-lib
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=../install
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE
- name: Install
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target install
- name: Create Test Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv/build
cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv/build64
cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv_cpp/build
cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv_cpp/build64
cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv_dhry/build
- name: Setup tests
working-directory: ${{runner.workspace}}/install/examples
shell: bash
run: |
cd SW/riscv/build
cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf ${{matrix.config.cmakegen}}
cmake --build . --config $BUILD_TYPE
cd -
cd SW/riscv/build64
cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf -DRISCV_ARCH=rv64gc -DRISCV_ABI=lp64d ${{matrix.config.cmakegen}}
cmake --build . --config $BUILD_TYPE
cd -
cd SW/riscv_cpp/build
cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf ${{matrix.config.cmakegen}}
cmake --build . --config $BUILD_TYPE
cd -
cd SW/riscv_cpp/build64
cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf -DRISCV_ARCH=rv64gc -DRISCV_ABI=lp64d ${{matrix.config.cmakegen}}
cmake --build . --config $BUILD_TYPE
cd -
cd SW/riscv_dhry/build
cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf ${{matrix.config.cmakegen}}
cmake --build . --config $BUILD_TYPE
- name: Compress Compiled System
run: tar -C ${{runner.workspace}} -cvf ${{runner.workspace}}/etiss.tar install
- name: Upload Compiled System
uses: actions/upload-artifact@v4
with:
name: etiss-${{matrix.config.name}}.tar
path: ${{runner.workspace}}/etiss.tar
test:
strategy:
matrix:
config:
- {name: "Linux", os: ubuntu-latest, cmakegen: "", llvm: "linux-gnu-ubuntu-20.04", llvm-ext: ".tar.xz", tc: "linux-ubuntu14", tc-ext: ".tar.gz", unpack: "tar xf"}
#- {name: "Windows", os: windows-latest, cmakegen: "-G \"MinGW Makefiles\"", llvm: "", llvm-ext: "", tc: "w64-mingw32", tc-ext: ".zip", unpack: "unzip"}
#- {name: "Mac", os: macos-10.15, cmakegen: "", llvm: "apple-darwin", llvm-ext: ".tar.xz", tc: "apple-darwin", tc-ext: ".tar.gz", unpack: "tar xf"}
needs: build
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}_test
steps:
- name: Fetch Compiled System
uses: actions/download-artifact@v4
with:
name: etiss-${{matrix.config.name}}.tar
path: ${{runner.workspace}}
- name: Unpack Compiled System
working-directory: ${{runner.workspace}}
run: tar -xf etiss.tar
- name: Requirements (Linux)
if: matrix.config.name == 'Linux'
run: |
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-program-options-dev
# - name: Requirements (Windows)
# if: matrix.config.name == 'Windows'
# working-directory: ${{runner.workspace}}
# shell: bash
# run: |
# choco install boost-msvc-14.2
# choco install wget unzip
# choco install llvm --version=11.0.0 --allow-downgrade
# choco install make
# ln -s "/c/Program Files/LLVM" llvm-lib
- name: Requirements (Mac)
if: matrix.config.name == 'Mac'
run: |
brew install boost coreutils
- name: Test (Linux/Mac)
working-directory: ${{runner.workspace}}/install/bin
if: matrix.config.name == 'Linux'
shell: bash
run: |
./run_helper.sh ../examples/SW/riscv/build/riscv_example.elf noloop
./run_helper.sh ../examples/SW/riscv/build/riscv_example.elf gcc noloop
./run_helper.sh ../examples/SW/riscv/build/riscv_example.elf llvm noloop
./run_helper.sh ../examples/SW/riscv_cpp/build/riscv_example.elf noloop
./run_helper.sh ../examples/SW/riscv_cpp/build/riscv_example.elf gcc noloop
./run_helper.sh ../examples/SW/riscv_cpp/build/riscv_example.elf llvm noloop
./run_helper.sh ../examples/SW/riscv/build64/riscv_example.elf noloop
./run_helper.sh ../examples/SW/riscv_cpp/build64/riscv_example.elf noloop
# - name: Test (Windows)
# working-directory: ${{runner.workspace}}/install/examples/bare_etiss_processor/build
# if: matrix.config.name == 'Windows'
# shell: bash
# run: |
# PATH=$PATH:/d/a/etiss/install/lib/
# cd $BUILD_TYPE
# ./main.exe --vp.elf_file=../../../SW/riscv/build/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv/memsegs.ini -pLogger
# ./main.exe --vp.elf_file=../../../SW/riscv/build/riscv_example.elf --jit.type=LLVMJIT --etiss.loglevel=4 -i../../../SW/riscv/memsegs.ini -pLogger
# ./main.exe --vp.elf_file=../../../SW/riscv_cpp/build/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv_cpp/memsegs.ini -pLogger
# ./main.exe --vp.elf_file=../../../SW/riscv_cpp/build/riscv_example.elf --jit.type=LLVMJIT --etiss.loglevel=4 -i../../../SW/riscv_cpp/memsegs.ini -pLogger
# ./main.exe --vp.elf_file=../../../SW/riscv/build64/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv/memsegs.ini -pLogger
# ./main.exe --vp.elf_file=../../../SW/riscv_cpp/build64/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv_cpp/memsegs.ini -pLogger
benchmark:
strategy:
matrix:
run-no: [1, 2, 3, 4, 5]
jit-engine: ["tcc", "gcc", "llvm"]
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'pull_request'
needs: build
runs-on: ubuntu-latest
steps:
- name: Fetch Compiled System
uses: actions/download-artifact@v4
with:
name: etiss-Linux.tar
path: ${{runner.workspace}}
- name: Unpack Compiled System
working-directory: ${{runner.workspace}}
run: tar -xf etiss.tar
- name: Requirements (Linux)
run: |
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-program-options-dev
- name: create directory to store results
working-directory: ${{runner.workspace}}
run: mkdir ${{runner.workspace}}/results
- name: Run Benchmarks
working-directory: ${{runner.workspace}}/install/bin
run: |
./run_helper.sh ../examples/SW/riscv_dhry/build/riscv_example ${{matrix.jit-engine}} noloop --vp.stats_file_path=${{runner.workspace}}/results/run.json
mv ${{runner.workspace}}/results/run.json ${{runner.workspace}}/results/run_${{matrix.jit-engine}}_${{matrix.run-no}}.json
- name: Save Benchmark Results
uses: actions/upload-artifact@v4
with:
name: run_${{matrix.jit-engine}}_${{matrix.run-no}}.json
path: ${{runner.workspace}}/results/run_${{matrix.jit-engine}}_${{matrix.run-no}}.json
compare_mips:
needs: benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch results
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare files
run: |
rm -rf benchmark_results_new
mkdir benchmark_results_new
find artifacts -type f -name '*.json' -exec mv {} benchmark_results_new \;
find artifacts -type f -name '*.tar' -exec mv {} . \;
- name: install dependencies
run: pip install -r script/requirements.txt
- name: get old benchmark results
uses: actions/checkout@v4
with:
ref: benchmark_results
path: benchmark_results_old
- name: creating a directory results_ for storing wiki text, issue text and the graph
run: |
ls benchmark_results_new
rm -rf results_
mkdir results_
- name: Run comparison (Push)
if: ${{github.event_name == 'push'}}
run: python3 script/compare.py benchmark_results_new/run_*.json -o benchmark_results_old/stats_file.json -i results_/issue.md -w results_/wiki.md -gr results_/performance_metrics.svg -g ${{ github.sha }} -r $GITHUB_REPOSITORY
- name: Run comparison (PR)
if: ${{github.event_name == 'pull_request'}}
run: python3 script/compare.py benchmark_results_new/run_*.json -o benchmark_results_old/stats_file.json -i results_/issue.md -w results_/wiki.md -gr results_/performance_metrics.svg -g ${{ github.event.pull_request.head.sha }} -r $GITHUB_REPOSITORY
- name: Deploy results to git
if: ${{github.event_name == 'push'}}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./benchmark_results_old
publish_branch: benchmark_results
enable_jekyll: true
- name: uploading benchmark_results
uses: actions/upload-artifact@v4
with:
name: stats_file.json
path: benchmark_results_old/stats_file.json
- name: uploading image
uses: actions/upload-artifact@v4
with:
name: performance_metrics.svg
path: results_/performance_metrics.svg
- name: Upload comment text
uses: actions/upload-artifact@v4
with:
name: issue.md
path: results_/issue.md
- name: Upload wiki text
uses: actions/upload-artifact@v4
with:
name: wiki.md
path: results_/wiki.md
# display-push:
# needs: compare_mips
# runs-on: ubuntu-latest
# if: ${{github.event_name == 'push'}}
#
# steps:
# - name: Get comment text
# uses: actions/download-artifact@v4
# with:
# name: issue.md
#
# - name: Load comment body
# id: get-comment-body
# run: |
# body=$(cat issue.md)
# body="${body//'%'/'%25'}"
# body="${body//$'\n'/'%0A'}"
# body="${body//$'\r'/'%0D'}"
# echo ::set-output name=body::$body
# - name: Find Comment
# uses: peter-evans/find-comment@v1
# id: fc
# with:
# issue-number: 19
#
# body-includes: This comment was created automatically, please do not change!
#
# - name: Create comment
# if: ${{ steps.fc.outputs.comment-id == 0 }}
# uses: peter-evans/create-or-update-comment@v1
# with:
# issue-number: 19
# edit-mode: replace
# body: ${{ steps.get-comment-body.outputs.body }}
#
# - name: Update comment
# if: ${{ steps.fc.outputs.comment-id != 0 }}
# uses: peter-evans/create-or-update-comment@v1
# with:
# comment-id: ${{ steps.fc.outputs.comment-id }}
# edit-mode: replace
# body: ${{ steps.get-comment-body.outputs.body }}
display-pr:
needs: compare_mips
runs-on: ubuntu-latest
if: ${{github.event_name == 'pull_request'}}
steps:
- name: Get comment text
uses: actions/download-artifact@v4
with:
name: issue.md
- name: Load comment body
id: get-comment-body
run: |
body=$(cat issue.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{github.event.number}}
body-includes: This comment was created automatically, please do not change!
- name: Create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{github.event.number}}
edit-mode: replace
body: ${{ steps.get-comment-body.outputs.body }}
- name: Update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.get-comment-body.outputs.body }}
display-wiki:
needs: compare_mips
runs-on: ubuntu-latest
if: ${{github.event_name == 'push'}}
steps:
- name: Get comment text
uses: actions/download-artifact@v4
with:
name: wiki.md
- name: Get performance_metrics.svg
uses: actions/download-artifact@v4
with:
name: performance_metrics.svg
- name: Update wiki
run: |
echo "Cloning wiki repo https://github.com/$GITHUB_REPOSITORY.wiki.git"
git clone "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.wiki.git" "wiki"
cd wiki
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
rm -rf ./performance_metrics.svg
cp ../wiki.md ./Performance_Metrics.md
cp ../performance_metrics.svg ./performance_metrics.svg
git add Performance_Metrics.md performance_metrics.svg
git commit -m "update perf"
git push
delete-artifact:
if: always()
needs: [display-wiki, display-pr, test]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete Artifact
uses: geekyeggo/delete-artifact@v2
with:
name: "*"
useGlob: true