Add mmperf #1
Workflow file for this run
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 2023 The OpenXLA 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 | |
# | |
# Runs mmperf. | |
name: Comparative Benchmarks | |
on: | |
# Will only run when manually triggered. | |
workflow_dispatch: | |
pull_request: | |
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). | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
GCS_DIR: gs://openxla-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }} | |
jobs: | |
setup: | |
runs-on: ubuntu-22.04 | |
outputs: | |
runner-group: ${{ steps.configure.outputs.runner-group }} | |
benchmark-gcs-dir: ${{ steps.configure.outputs.benchmark-gcs-dir }} | |
steps: | |
- name: "Checking out PR repository" | |
uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 | |
- name: "Configuring CI options" | |
id: configure | |
env: | |
RUNNER_GROUP: ${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }} | |
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 | |
# Workflow jobs can't access `env` in `runs-on`, so we need to make | |
# `runner-group` a job output variable. | |
echo "runner-group=${RUNNER_GROUP}" > "${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: | |
BUILD_DIR: mmperf-build-cpu | |
RESULTS_DIR: mmperf-results-cpu | |
GCS_UPLOAD_PARENT_DIR: "gs://mmperf-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: "Building mmperf for CPU" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
gcr.io/iree-oss/openxla-benchmark/mmperf@sha256:218b49b68224129b23d914dcddd5b08384eb1414a72b4230e969496eb4c8858b \ | |
./microbenchmarks/mmperf/build_mmperf.sh "cpu" "${BUILD_DIR}" | |
- name: "Running mmperf on CPU" | |
run: | | |
mkdir ${RESULTS_DIR} | |
./build_tools/github_actions/docker_run.sh \ | |
gcr.io/iree-oss/openxla-benchmark/mmperf@sha256:218b49b68224129b23d914dcddd5b08384eb1414a72b4230e969496eb4c8858b \ | |
./microbenchmarks/mmperf/run_mmperf.sh "${BUILD_DIR}" "${RESULTS_DIR}" | |
- name: "Uploading results" | |
run: | | |
gcloud storage cp "${RESULTS_DIR}/latest/**" "${GCS_UPLOAD_PARENT_DIR}/${GCS_UPLOAD_DIR_NAME}/" | |
gcloud storage cp "${RESULTS_DIR}/latest/matmul.png" "${GCS_UPLOAD_PARENT_DIR}/matmul.png" | |
build_cuda: | |
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: | |
BUILD_DIR: mmperf-build-cuda | |
outputs: | |
build-dir: ${{ env.BUILD_DIR }} | |
build-dir-archive: ${{ steps.archive.outputs.build-dir-archive }} | |
build-dir-gcs-artifact: ${{ steps.upload.outputs.build-dir-gcs-artifact }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | |
- name: "Building mmperf for CUDA" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
gcr.io/iree-oss/openxla-benchmark/mmperf@sha256:218b49b68224129b23d914dcddd5b08384eb1414a72b4230e969496eb4c8858b \ | |
./microbenchmarks/mmperf/build_mmperf.sh "cuda" "${BUILD_DIR}" | |
- name: "Removing unused files" | |
run: | | |
find "${BUILD_DIR}" -type f -name "*.a" -o -type f -name "*.o" \ | |
-print \ | |
-delete | |
- name: "Creating build dir archive" | |
id: archive | |
env: | |
BUILD_DIR_ARCHIVE: ${{ env.BUILD_DIR }}.tar.zst | |
run: | | |
tar -I 'zstd -T0' \ | |
-cf ${BUILD_DIR_ARCHIVE} ${BUILD_DIR} | |
echo "build-dir-archive=${BUILD_DIR_ARCHIVE}" >> "${GITHUB_OUTPUT}" | |
- name: "Uploading build dir archive" | |
id: upload | |
env: | |
BUILD_DIR_ARCHIVE: ${{ steps.archive.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.build-dir-archive }} | |
run: | | |
gcloud storage cp "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR_GCS_ARTIFACT}" | |
echo "build-dir-gcs-artifact=${BUILD_DIR_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" | |
benchmark_cuda: | |
needs: [setup, build_cuda] | |
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 }} | |
- machine-type=a2-highgpu-1g | |
- os-family=Linux | |
env: | |
RESULTS_DIR: mmperf-results-cuda | |
GCS_UPLOAD_PARENT_DIR: "gs://mmperf-benchmark-artifacts/cuda" | |
GCS_UPLOAD_DIR_NAME: ${{ needs.setup.outputs.artifact-upload-dir }} | |
BUILD_DIR: ${{ needs.build_cuda.outputs.build-dir }} | |
BUILD_DIR_ARCHIVE: ${{ needs.build_cuda.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_cuda.outputs.build-dir-gcs-artifact }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${BUILD_DIR_ARCHIVE}" | |
- name: "Running mmperf on CUDA" | |
run: | | |
mkdir ${RESULTS_DIR} | |
./build_tools/github_actions/docker_run.sh \ | |
--gpus all \ | |
gcr.io/iree-oss/openxla-benchmark/mmperf@sha256:218b49b68224129b23d914dcddd5b08384eb1414a72b4230e969496eb4c8858b \ | |
./microbenchmarks/mmperf/run_mmperf.sh "${BUILD_DIR}" "${RESULTS_DIR}" | |
- name: "Uploading results" | |
run: | | |
export GCS_DIR_NAME="$(date +'%Y-%m-%d').$(date +'%s')" | |
gcloud storage cp "${RESULTS_DIR}/latest/**" "${GCS_UPLOAD_PARENT_DIR}/${GCS_UPLOAD_DIR_NAME}/" | |
gcloud storage cp "${RESULTS_DIR}/latest/matmul.png" "${GCS_UPLOAD_PARENT_DIR}/matmul.png" |