| # Copyright 2022 The IREE Authors |
| # |
| # Licensed under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| # |
| # Workflow for running `convperf` (https://github.com/nod-ai/convperf). |
| # `convperf` benchmarks convolution workloads on IREE and other backends such |
| # as `libsxmm`, etc. |
| # |
| # The workflow runs benchmarks on CPU and uploads results to the |
| # `convperf-benchmark-artifacts` GC bucket. |
| |
| name: convperf |
| |
| on: |
| schedule: |
| - cron: '0 16 * * *' |
| workflow_dispatch: |
| |
| env: |
| GCS_DIR: gs://iree-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }} |
| |
| jobs: |
| setup: |
| runs-on: ubuntu-20.04 |
| env: |
| # The commit being checked out is the merge commit for the PR. Its first |
| # parent will be the tip of main. |
| BASE_REF: HEAD^ |
| PR_TITLE: ${{ github.event.pull_request.title }} |
| PR_BODY: ${{ github.event.pull_request.body }} |
| IREE_SHA: ${{ github.sha }} |
| outputs: |
| artifact-upload-dir: ${{ steps.iree.outputs.artifact-upload-dir }} |
| should-run: ${{ steps.configure.outputs.should-run }} |
| runner-env: ${{ steps.configure.outputs.runner-env }} |
| runner-group: ${{ steps.configure.outputs.runner-group }} |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| with: |
| # We need the parent commit to do a diff |
| fetch-depth: 2 |
| - name: "Configuring CI options" |
| id: configure |
| run: | |
| # Just informative logging. There should only be two commits in the |
| # history here, but limiting the depth helps when copying from a local |
| # repo instead of using checkout, e.g. with |
| # https://github.com/nektos/act where there will be more. |
| git log --oneline --graph --max-count=3 |
| ./build_tools/github_actions/configure_ci.py |
| - name: "Calculating version info" |
| id: iree |
| run: | |
| export GCS_ARTIFACT_DIR="$(date +'%Y-%m-%d').sha_${IREE_SHA}.timestamp_$(date +'%s')" |
| echo "artifact-upload-dir=${GCS_ARTIFACT_DIR}" >> $GITHUB_OUTPUT |
| |
| build_and_benchmark_cpu: |
| needs: setup |
| if: needs.setup.outputs.should-run == 'true' |
| runs-on: |
| - self-hosted # must come first |
| - runner-group=${{ needs.setup.outputs.runner-group }} |
| - environment=${{ needs.setup.outputs.runner-env }} |
| - cpu |
| - os-family=Linux |
| env: |
| IREE_SHA: ${{ github.sha }} |
| BUILD_DIR: convperf-build |
| RESULTS_DIR: convperf-results |
| GCS_UPLOAD_PARENT_DIR: "gs://convperf-benchmark-artifacts/cpu" |
| GCS_UPLOAD_DIR_NAME: ${{ needs.setup.outputs.artifact-upload-dir }} |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| - name: "Running convperf for CPU" |
| run: | |
| mkdir ${RESULTS_DIR} |
| ./build_tools/github_actions/docker_run.sh \ |
| gcr.io/iree-oss/convperf@sha256:8a32b97be7c8817aa12bf669fce4dd1f20d0b01b7aa6f4dbb618e27541d1231d \ |
| ./build_tools/benchmarks/convperf/build_and_run_convperf.sh "${BUILD_DIR}" "${RESULTS_DIR}" "${IREE_SHA}" |
| - name: "Uploading results" |
| run: | |
| gcloud storage cp "${RESULTS_DIR}/**" "${GCS_UPLOAD_PARENT_DIR}/${GCS_UPLOAD_DIR_NAME}/" |
| gcloud storage cp "${RESULTS_DIR}/**" "${GCS_UPLOAD_PARENT_DIR}/latest/" |