diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index dfc9362a6..89d6d2486 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -32,40 +32,13 @@ jobs: archflags: "-mcpu=cortex-a55 -march=armv8.2-a" cflags: "-static -DFORCE_AARCH64" bench_extra_args: -w exec-on-a55 - runs-on: self-hosted-${{ matrix.target.system }} - defaults: - run: - shell: nix develop .#ci -c bash -e {0} - permissions: - contents: write - if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main') - steps: - - uses: actions/checkout@v4 - - name: Setup nix - uses: ./.github/actions/setup-nix - with: - devShell: ci - script: | - ARCH=$(uname -m) - cat >> $GITHUB_STEP_SUMMARY <<-EOF - ## Setup - Architecture: $ARCH - - $(uname -a) - - $(nix --version) - - $(astyle --version) - - $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "") - - $(bash --version | grep -m1 "") - - ## CPU Info - $(cat /proc/cpuinfo) - EOF - - name: Run benchmark - uses: ./.github/actions/bench - with: - name: ${{ matrix.target.name }} - cflags: ${{ matrix.target.cflags }} - archflags: ${{ matrix.target.archflags }} - perf: ${{ matrix.target.bench_pmu }} - store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }} - bench_extra_args: ${{ matrix.target.bench_extra_args }} - gh_token: ${{ secrets.GITHUB_TOKEN }} + uses: ./.github/workflows/bench_core_reusable.yml + with: + runner: self-hosted-${{ matrix.target.system }} + name: ${{ matrix.target.name }} + cflags: ${{ matrix.target.cflags }} + archflags: ${{ matrix.target.archflags }} + perf: ${{ matrix.target.bench_pmu }} + store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }} + bench_extra_args: ${{ matrix.target.bench_extra_args }} + gh_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/bench_core_reusable.yml b/.github/workflows/bench_core_reusable.yml new file mode 100644 index 000000000..7f73f53ef --- /dev/null +++ b/.github/workflows/bench_core_reusable.yml @@ -0,0 +1,80 @@ +name: bench-core-reusable +on: + workflow_call: + inputs: + runner: + type: string + description: Name of the runner to use + name: + type: string + description: Name for the benchmarking run + required: true + perf: + description: Method of obtaining PMU metrics + required: true + default: 'PERF' + type: choice + options: + - NO + - PERF + - PMU + - M1 + cflags: + type: string + description: CFLAGS to pass to compilation + default: '' + archflags: + type: string + description: ARCHFLAGS to pass to compilation + default: '' + bench_extra_args: + type: string + description: Further arguments to be appended to command line for `bench` script + default: '' + store_results: + type: string + description: Whether to push results to GH pages + default: 'false' + gh_token: + type: string + description: GitHub access token + required: true +jobs: + bench: + name: Bench ${{ inputs.name }} + runs-on: ${{ inputs.runner }} + defaults: + run: + shell: nix develop .#ci -c bash -e {0} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Setup nix + uses: ./.github/actions/setup-nix + with: + devShell: ci + script: | + ARCH=$(uname -m) + cat >> $GITHUB_STEP_SUMMARY <<-EOF + ## Setup + Architecture: $ARCH + - $(uname -a) + - $(nix --version) + - $(astyle --version) + - $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "") + - $(bash --version | grep -m1 "") + + ## CPU Info + $(cat /proc/cpuinfo) + EOF + - name: Run benchmark + uses: ./.github/actions/bench + with: + name: ${{ inputs.name }} + cflags: ${{ inputs.cflags }} + archflags: ${{ inputs.archflags }} + perf: ${{ inputs.perf }} + store_results: ${{ inputs.store_results }} + bench_extra_args: ${{ inputs.bench_extra_args }} + gh_token: ${{ secrets.AWS_GITHUB_TOKEN }} diff --git a/.github/workflows/bench_ec2_reusable.yml b/.github/workflows/bench_ec2_reusable.yml index 1be2955a2..5c3b1bb4e 100644 --- a/.github/workflows/bench_ec2_reusable.yml +++ b/.github/workflows/bench_ec2_reusable.yml @@ -73,37 +73,16 @@ jobs: bench: name: Bench ${{ inputs.name }} needs: start-ec2-runner # required to start the main job when the runner is ready - runs-on: ${{ needs.start-ec2-runner.outputs.label }} # run the job on the newly created runner - steps: - - uses: actions/checkout@v4 - - name: Setup nix - uses: ./.github/actions/setup-nix - with: - devShell: ci - script: | - ARCH=$(uname -m) - cat >> $GITHUB_STEP_SUMMARY <<-EOF - ## Setup - Architecture: $ARCH - - $(uname -a) - - $(nix --version) - - $(astyle --version) - - $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "") - - $(bash --version | grep -m1 "") - - ## CPU Info - $(cat /proc/cpuinfo) - EOF - - name: Run benchmark - uses: ./.github/actions/bench - with: - name: ${{ inputs.name }} - cflags: ${{ inputs.cflags }} - archflags: ${{ inputs.archflags }} - perf: PERF - store_results: ${{ inputs.store_results }} - bench_extra_args: ${{ inputs.bench_extra_args }} - gh_token: ${{ secrets.AWS_GITHUB_TOKEN }} + uses: ./.github/workflows/bench_core_reusable.yml + with: + runner: ${{ needs.start-ec2-runner.outputs.label }} + name: ${{ inputs.name }} + cflags: ${{ inputs.cflags }} + archflags: ${{ inputs.archflags }} + perf: PERF + store_results: ${{ inputs.store_results }} + bench_extra_args: ${{ inputs.bench_extra_args }} + gh_token: ${{ secrets.AWS_GITHUB_TOKEN }} stop-ec2-runner: name: Stop ${{ github.event.inputs.name }} (${{ github.event.inputs.ec2_instance_type }}) permissions: