Skip to content

More performance improvements #2044

More performance improvements

More performance improvements #2044

Workflow file for this run

name: Benchmark Check
on:
merge_group:
push:
branches: [main, "release-*"]
pull_request:
branches: [main, "release-*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# this is needed to gain access via OIDC to the S3 bucket for caching
permissions:
id-token: write
contents: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_BUILD_LOCKED: 1
RISC0_TOOLCHAIN_VERSION: v2024-04-22.0
jobs:
bench:
runs-on:
labels: [self-hosted, prod, bench, "${{ matrix.os }}", "${{ matrix.device }}"]
strategy:
fail-fast: false
matrix:
os: [Linux, macOS]
feature: [prove]
device: [cpu]
include:
- os: Linux
feature: cuda
device: nvidia_rtx_3090_ti
- os: macOS
feature: metal
device: apple_m2_pro
env:
FEATURE: ${{ matrix.feature }}
DISABLE_S3: ${{ matrix.device == 'nvidia_rtx_3090_ti' }}
S3_BENCH_PATH: s3://risc0-ci-cache/public/bench/${{ github.base_ref || github.ref_name }}/fib/${{ matrix.os }}-${{ matrix.device }}
steps:
- uses: actions/checkout@v4
- if: matrix.feature == 'cuda'
uses: ./.github/actions/cuda
- uses: ./.github/actions/rustup
- uses: ./.github/actions/sccache
with:
key: ${{ matrix.os }}-${{ matrix.feature }}
disable_s3: ${{ env.DISABLE_S3 }}
- id: aws-creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::083632199359:role/gha_oidc_risc0_cache_public_access
- name: Download previous benchmark data
run: aws s3 cp $S3_BENCH_PATH/external.json ./cache/external.json
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION
- name: Run benchmarks
run: cargo bench --bench fib -F $FEATURE
- name: Analyze benchmark results
uses: risc0/github-action-benchmark@v1.19.3
with:
name: "${{ matrix.os }}-${{ matrix.device }}"
tool: 'customBiggerIsBetter'
output-file-path: target/hotbench/fib/benchmark.json
external-data-json-path: ./cache/external.json
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '120%'
comment-on-alert: true
fail-on-alert: true
summary-always: true
- name: Save current benchmark data
if: github.event_name == 'push'
run: aws s3 cp ./cache/external.json $S3_BENCH_PATH/external.json
# see: https://github.com/orgs/community/discussions/26822
bench-status-check:
if: always()
needs:
- bench
runs-on: ubuntu-latest
steps:
- name: Check all job status
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
# see https://stackoverflow.com/a/67532120/4907315
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1