forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (167 loc) · 7.39 KB
/
run_mmperf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# 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 `mmperf` (https://github.com/mmperf/mmperf).
# `mmperf` benchmarks matrix-multiply workloads on IREE and other backends such
# as RUY, TVM, Halide, CuBLAS, etc.
#
# The workflow runs benchmarks on CPU and GPU and uploads results to the
# `mmperf-benchmark-artifacts` GC bucket.
name: mmperf
on:
schedule:
- cron: '0 13 * * *'
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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.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: 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0
- name: "Building mmperf for CPU"
run: |
./build_tools/github_actions/docker_run.sh \
gcr.io/iree-oss/mmperf@sha256:f32657e5b9e9bf54614209517f9c895f4fb2280d1a7c1a3a9b7fb702327db8c6 \
./build_tools/benchmarks/mmperf/build_mmperf.sh "${BUILD_DIR}" "cpu" "${IREE_SHA}"
- name: "Running mmperf on CPU"
run: |
mkdir ${RESULTS_DIR}
./build_tools/github_actions/docker_run.sh \
gcr.io/iree-oss/mmperf@sha256:f32657e5b9e9bf54614209517f9c895f4fb2280d1a7c1a3a9b7fb702327db8c6 \
./build_tools/benchmarks/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:
IREE_SHA: ${{ github.sha }}
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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0
- name: "Building mmperf for CUDA"
run: |
./build_tools/github_actions/docker_run.sh \
gcr.io/iree-oss/mmperf@sha256:f32657e5b9e9bf54614209517f9c895f4fb2280d1a7c1a3a9b7fb702327db8c6 \
./build_tools/benchmarks/mmperf/build_mmperf.sh "${BUILD_DIR}" "cuda" "${IREE_SHA}"
- 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 }}
- gpu
- 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.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/mmperf@sha256:f32657e5b9e9bf54614209517f9c895f4fb2280d1a7c1a3a9b7fb702327db8c6 \
./build_tools/benchmarks/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"