Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/scripts/compare_iai.sh
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
132 changes: 132 additions & 0 deletions .github/workflows/bench.yml
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
Comment thread
kevaundray marked this conversation as resolved.
Outdated
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) }}
Loading