convperf #296
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
concurrency: | |
# A PR number if a pull request and otherwise the commit hash. This cancels | |
# queued and in-progress runs for the same PR (presubmit) or commit | |
# (postsubmit). The workflow name is prepended to avoid conflicts between | |
# different workflows. | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
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@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.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@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | |
- name: "Running convperf for CPU" | |
run: | | |
mkdir ${RESULTS_DIR} | |
./build_tools/github_actions/docker_run.sh \ | |
gcr.io/iree-oss/convperf@sha256:8e242ad71896a791c9be53b0906b7c8e96a2d3bad3f7431622cc797a6f89ba0f \ | |
./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/" |