Skip to content

Commit a2e3aaa

Browse files
authored
Merge pull request #460 from henrybear327/ci/fix_benchmark_pipeline
Fix benchmark CI pipeline
2 parents 9f5c057 + 0e13f01 commit a2e3aaa

File tree

5 files changed

+47
-53
lines changed

5 files changed

+47
-53
lines changed

.github/workflows/benchmark.yml

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

.github/workflows/main.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,51 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
6+
benchmark:
7+
runs-on: ubuntu-24.04
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Test changed files
11+
id: changed-files
12+
uses: tj-actions/changed-files@v44
13+
with:
14+
files: |
15+
src/riscv.c
16+
src/decode.c
17+
src/emulate.c
18+
src/rv32_template.c
19+
src/rv32_constopt.c
20+
- name: install-dependencies
21+
if: ${{ steps.changed-files.outputs.any_changed == 'true' ||
22+
github.event_name == 'workflow_dispatch'}}
23+
run: |
24+
sudo pip3 install numpy --break-system-packages
25+
shell: bash
26+
- name: default build
27+
if: ${{ steps.changed-files.outputs.any_changed == 'true' ||
28+
github.event_name == 'workflow_dispatch'}}
29+
run: make ENABLE_SDL=0
30+
- name: Run benchmark
31+
if: ${{ steps.changed-files.outputs.any_changed == 'true' ||
32+
github.event_name == 'workflow_dispatch'}}
33+
run: |
34+
tests/bench-aggregator.py
35+
- name: Store benchmark results
36+
if: ${{ steps.changed-files.outputs.any_changed == 'true' ||
37+
github.event_name == 'workflow_dispatch'}}
38+
uses: benchmark-action/github-action-benchmark@v1
39+
with:
40+
name: Benchmarks
41+
tool: 'customBiggerIsBetter'
42+
output-file-path: benchmark_output.json
43+
github-token: ${{ secrets.RV32EMU_BENCH_TOKEN }}
44+
gh-repository: 'github.com/sysprog21/rv32emu-bench'
45+
gh-pages-branch: 'master'
46+
auto-push: true
47+
comment-always: true
48+
benchmark-data-dir-path: .
649
detect-code-related-file-changes:
750
runs-on: ubuntu-22.04
851
outputs:

build/coremark.elf

128 KB
Binary file not shown.

build/dhrystone.elf

100644100755
55.2 KB
Binary file not shown.

tests/coremark.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
import json
77

88
iter = 10
9+
coremark_param = "0x0 0x0 0x66 30000 7 1 2000"
910
res = []
1011
file_exist = os.path.exists('build/rv32emu')
1112
if not file_exist:
1213
print("Please compile before running test")
1314
exit(1)
1415
print("Start Test CoreMark benchmark")
1516
comp_proc = subprocess.check_output(
16-
'build/rv32emu build/coremark.elf', shell=True).decode("utf-8")
17+
"build/rv32emu build/coremark.elf {}".format(coremark_param), shell=True).decode("utf-8")
1718
if not comp_proc or comp_proc.find("Error") != -1:
1819
print("Test Error")
1920
exit(1)
@@ -23,7 +24,7 @@
2324
for i in range(iter):
2425
print("Running CoreMark benchmark - Run #{}".format(i + 1))
2526
comp_proc = subprocess.check_output(
26-
'build/rv32emu build/coremark.elf', shell=True).decode("utf-8")
27+
"build/rv32emu build/coremark.elf {}".format(coremark_param), shell=True).decode("utf-8")
2728
if not comp_proc:
2829
print("Fail\n")
2930
exit(1)

0 commit comments

Comments
 (0)