diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 7f649981..00000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Benchmark - -on: [push, pull_request_target, workflow_dispatch] - -jobs: - benchmark: - name: Performance regression check - if: contains(toJSON(github.event.head_commit.message), 'Merge pull request ') == false - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Test changed files - id: changed-files - uses: tj-actions/changed-files@v44 - with: - files: | - src/riscv.c - src/decode.c - src/emulate.c - src/rv32_template.c - src/rv32_constopt.c - - name: install-dependencies - if: ${{ steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch'}} - run: | - sudo pip3 install numpy - shell: bash - - name: default build - if: ${{ steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch'}} - run: make - - name: Run benchmark - if: ${{ steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch'}} - run: | - tests/bench-aggregator.py - - name: Store benchmark results - if: ${{ steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch'}} - uses: benchmark-action/github-action-benchmark@v1 - with: - name: Benchmarks - tool: 'customBiggerIsBetter' - output-file-path: benchmark_output.json - github-token: ${{ secrets.RV32EMU_BENCH_TOKEN }} - gh-repository: 'github.com/sysprog21/rv32emu-bench' - gh-pages-branch: 'master' - auto-push: true - comment-always: true - benchmark-data-dir-path: . diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9fbb2676..9f85c5fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,8 +1,51 @@ name: CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: + benchmark: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Test changed files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + files: | + src/riscv.c + src/decode.c + src/emulate.c + src/rv32_template.c + src/rv32_constopt.c + - name: install-dependencies + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch'}} + run: | + sudo pip3 install numpy --break-system-packages + shell: bash + - name: default build + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch'}} + run: make ENABLE_SDL=0 + - name: Run benchmark + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch'}} + run: | + tests/bench-aggregator.py + - name: Store benchmark results + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch'}} + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Benchmarks + tool: 'customBiggerIsBetter' + output-file-path: benchmark_output.json + github-token: ${{ secrets.RV32EMU_BENCH_TOKEN }} + gh-repository: 'github.com/sysprog21/rv32emu-bench' + gh-pages-branch: 'master' + auto-push: true + comment-always: true + benchmark-data-dir-path: . detect-code-related-file-changes: runs-on: ubuntu-22.04 outputs: diff --git a/build/coremark.elf b/build/coremark.elf index 2a4e7da2..1da8631a 100644 Binary files a/build/coremark.elf and b/build/coremark.elf differ diff --git a/build/dhrystone.elf b/build/dhrystone.elf old mode 100644 new mode 100755 index 60974fc1..356ff0eb Binary files a/build/dhrystone.elf and b/build/dhrystone.elf differ diff --git a/tests/coremark.py b/tests/coremark.py index c34c6115..c6902acb 100755 --- a/tests/coremark.py +++ b/tests/coremark.py @@ -6,6 +6,7 @@ import json iter = 10 +coremark_param = "0x0 0x0 0x66 30000 7 1 2000" res = [] file_exist = os.path.exists('build/rv32emu') if not file_exist: @@ -13,7 +14,7 @@ exit(1) print("Start Test CoreMark benchmark") comp_proc = subprocess.check_output( - 'build/rv32emu build/coremark.elf', shell=True).decode("utf-8") + "build/rv32emu build/coremark.elf {}".format(coremark_param), shell=True).decode("utf-8") if not comp_proc or comp_proc.find("Error") != -1: print("Test Error") exit(1) @@ -23,7 +24,7 @@ for i in range(iter): print("Running CoreMark benchmark - Run #{}".format(i + 1)) comp_proc = subprocess.check_output( - 'build/rv32emu build/coremark.elf', shell=True).decode("utf-8") + "build/rv32emu build/coremark.elf {}".format(coremark_param), shell=True).decode("utf-8") if not comp_proc: print("Fail\n") exit(1)