-
Notifications
You must be signed in to change notification settings - Fork 409
feat: Add basic benchmarking #2213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6862bb6
bench
Ethan-000 43ccd5f
Merge branch 'master' into e/bench
Ethan-000 4437856
.
Ethan-000 18dfcb8
.
Ethan-000 aac5c98
.
Ethan-000 0ec2a64
.
Ethan-000 701d150
.
Ethan-000 efa7074
.
Ethan-000 1851b7b
.
Ethan-000 3c5d08b
.
Ethan-000 7708250
.
Ethan-000 1a891f7
.
Ethan-000 87c392e
.
Ethan-000 2afe256
.
Ethan-000 d542476
.
Ethan-000 3a059c1
.
Ethan-000 8edef39
/
Ethan-000 38a0206
remove prove
Ethan-000 07f0306
.
Ethan-000 809339e
.
Ethan-000 205083d
Merge branch 'master' into e/bench
Ethan-000 f11c107
.
Ethan-000 e709e61
.
Ethan-000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This script should be run on the main branch, after running the iai benchmarks on the target branch. | ||
|
|
||
| # If the main branch has a better iai performance, exits in error. It ignores L2 differences, since they seem hard to stabilize across runs. | ||
| cargo bench --bench iai --manifest-path pr/Cargo.toml | tee /dev/tty | awk '/((L1)|(Ins)|(RAM)|(Est))+.*\(\+[1-9]+[0-9]*\..*%\)/{f=1} END{exit f}' | ||
|
|
||
| # copied from https://github.com/paradigmxyz/reth/blob/main/.github/scripts/compare_iai.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # Adapted from https://github.com/paradigmxyz/reth/blob/main/.github/workflows/bench.yml | ||
| name: Bench | ||
|
|
||
| on: | ||
| pull_request: | ||
| merge_group: | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| benchmark: | ||
| name: Bench selected tests | ||
| runs-on: ubuntu-latest | ||
| # Only run benchmarks in merge groups | ||
| if: github.event_name != 'pull_request' | ||
| steps: | ||
| - name: Checkout Noir repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Collect locked barretenberg rev | ||
| run: | | ||
| echo "BB_REV=$(jq -r .nodes.barretenberg.locked.rev ./flake.lock)" >> $GITHUB_ENV | ||
| echo "BB_REV is ${{ env.BB_REV }}" | ||
|
|
||
| - name: Checkout barretenberg | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: AztecProtocol/barretenberg | ||
| path: barretenberg | ||
| ref: ${{ env.BB_REV }} | ||
|
|
||
| - name: Setup Linux environment | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install libomp-dev cmake ninja-build | ||
| echo "PRESET=default" >> $GITHUB_ENV | ||
|
|
||
| - name: Build and install barretenberg | ||
| working-directory: barretenberg/cpp | ||
| run: | | ||
| cmake --preset ${{ env.PRESET }} -DTESTING=OFF -DBENCHMARKS=OFF -DCMAKE_BUILD_TYPE=RelWithAssert -DDISABLE_ASM=ON -DDISABLE_ADX=ON | ||
| cmake --build --preset ${{ env.PRESET }} | ||
| sudo cmake --install build | ||
|
|
||
| - name: Checkout master sources | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| ref: master | ||
| path: master | ||
|
|
||
| - name: Checkout PR sources | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| clean: false | ||
| path: pr | ||
|
|
||
| - name: Setup toolchain | ||
| uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: 1.66.0 | ||
|
|
||
| - name: Install Valgrind | ||
| run: | | ||
| sudo apt install valgrind | ||
|
|
||
| - name: Set master baseline | ||
| run: cargo bench --bench iai --manifest-path master/Cargo.toml | ||
|
|
||
| - name: Compare PR benchmark | ||
| shell: 'script -q -e -c "bash {0}"' # required to workaround /dev/tty not being available | ||
| run: | | ||
| ./pr/.github/scripts/compare_iai.sh | ||
|
|
||
| # Checks that benchmarks not run in CI compile | ||
| bench-check: | ||
| name: check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Noir repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Collect locked barretenberg rev | ||
| run: | | ||
| echo "BB_REV=$(jq -r .nodes.barretenberg.locked.rev ./flake.lock)" >> $GITHUB_ENV | ||
| echo "BB_REV is ${{ env.BB_REV }}" | ||
|
|
||
| - name: Checkout barretenberg | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: AztecProtocol/barretenberg | ||
| path: barretenberg | ||
| ref: ${{ env.BB_REV }} | ||
|
|
||
| - name: Setup Linux environment | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install libomp-dev cmake ninja-build | ||
| echo "PRESET=default" >> $GITHUB_ENV | ||
|
|
||
| - name: Build and install barretenberg | ||
| working-directory: barretenberg/cpp | ||
| run: | | ||
| cmake --preset ${{ env.PRESET }} -DTESTING=OFF -DBENCHMARKS=OFF -DCMAKE_BUILD_TYPE=RelWithAssert -DDISABLE_ASM=ON -DDISABLE_ADX=ON | ||
| cmake --build --preset ${{ env.PRESET }} | ||
| sudo cmake --install build | ||
|
|
||
| - name: Checkout Noir repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup toolchain | ||
| uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: 1.66.0 | ||
|
|
||
| - name: Check if benchmarks build | ||
| run: cargo check --workspace --benches | ||
|
|
||
| bench-success: | ||
| if: always() | ||
| name: bench success | ||
| needs: bench-check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Decide whether the needed jobs succeeded or failed | ||
| uses: re-actors/alls-green@release/v1 | ||
| with: | ||
| jobs: ${{ toJSON(needs) }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.