name: Benchmarks
on:
  workflow_dispatch:
    inputs:
      tags:
        description: "Test scenario tags"

jobs:
  bench_elgamal:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench elgamal
        run: cargo bench --verbose --bench elgamal

  bench_poseidon:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench poseidon
        run: cargo bench --verbose --bench poseidon

  bench_einsum_accum_matmul:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench einsum accum matmul
        run: cargo bench --verbose --bench accum_einsum_matmul

  bench_accum_matmul_relu:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench accum matmul relu
        run: cargo bench --verbose --bench accum_matmul_relu

  bench_accum_matmul_relu_overflow:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench accum matmul relu
        run: cargo bench --verbose --bench accum_matmul_relu_overflow

  bench_relu:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench relu
        run: cargo bench --verbose --bench relu

  bench_accum_dot:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench accum dot
        run: cargo bench --verbose --bench accum_dot

  bench_accum_conv:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench accum conv
        run: cargo bench --verbose --bench accum_conv

  bench_accum_sumpool:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench accum sumpool
        run: cargo bench --verbose --bench accum_sumpool

  bench_pairwise_add:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench pairwise add
        run: cargo bench --verbose --bench pairwise_add

  bench_accum_sum:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench accum sum
        run: cargo bench --verbose --bench accum_sum

  bench_pairwise_pow:
    runs-on: self-hosted
    needs: [bench_poseidon]
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2023-06-27
          override: true
          components: rustfmt, clippy
      - name: Bench pairwise pow
        run: cargo bench --verbose --bench pairwise_pow
