forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 11
111 lines (107 loc) · 4.83 KB
/
benchmark_compilation.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
# 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 compilation benchmarks.
# It is designed to be called from a parent workflow.
# The concurrency of this workflow is controlled by the caller's job.
name: Benchmark Compilation
on:
workflow_call:
inputs:
runner-group:
required: true
type: string
runner-env:
required: true
type: string
e2e-test-artifacts-dir:
required: true
type: string
e2e-test-artifacts-gcs-artifact-dir:
required: true
type: string
e2e-test-artifacts-build-log:
required: true
type: string
e2e-test-artifacts-build-log-gcs-artifact:
required: true
type: string
outputs:
compile-stats-results:
description: |
Local path to the compilation benchmark results.
value: ${{ jobs.compilation_benchmarks.outputs.compile-stats-results }}
compile-stats-results-gcs-artifact:
description: |
GCS path to the uploaded compilation benchmark results.
value: ${{ jobs.compilation_benchmarks.outputs.compile-stats-results-gcs-artifact }}
env:
# This duplicates the variable from ci.yml. The variable needs to be in env
# instead of the outputs of setup because it contains the run attempt and we
# want that to be the current attempt, not whatever attempt the setup step
# last ran in. It therefore can't be passed in via inputs because the env
# context isn't available there.
GCS_DIR: gs://iree-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }}
jobs:
compilation_benchmarks:
runs-on:
- self-hosted # must come first
- runner-group=${{ inputs.runner-group }}
- environment=${{ inputs.runner-env }}
- cpu
- os-family=Linux
env:
E2E_TEST_ARTIFACTS_DIR: ${{ inputs.e2e-test-artifacts-dir }}
E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ inputs.e2e-test-artifacts-gcs-artifact-dir }}
E2E_TEST_ARTIFACTS_BUILD_LOG: ${{ inputs.e2e-test-artifacts-build-log }}
E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT: ${{ inputs.e2e-test-artifacts-build-log-gcs-artifact }}
outputs:
compile-stats-results: ${{ steps.collect.outputs.compile-stats-results }}
compile-stats-results-gcs-artifact: ${{ steps.upload.outputs.compile-stats-results-gcs-artifact }}
steps:
- name: "Checking out repository"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: "Downloading assets"
id: "download-assets"
env:
BENCHMARK_CONFIG: ${{ env.E2E_TEST_ARTIFACTS_DIR }}/compilation-benchmark-config.json
BENCHMARK_CONFIG_GCS_ARTIFACT: ${{ env.E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR }}/compilation-benchmark-config.json
run: |
mkdir -p "${E2E_TEST_ARTIFACTS_DIR}"
gcloud storage cp "${BENCHMARK_CONFIG_GCS_ARTIFACT}" "${BENCHMARK_CONFIG}"
gcloud storage cp \
"${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" \
"${E2E_TEST_ARTIFACTS_BUILD_LOG}"
jq -r \
--arg GCS_ARTIFACT_DIR "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" \
'.module_dir_paths | map("\($GCS_ARTIFACT_DIR)/\(.)") | join("\n")' \
"${BENCHMARK_CONFIG}" | \
gcloud storage cp -r --read-paths-from-stdin \
"${E2E_TEST_ARTIFACTS_DIR}"
echo "benchmark-config=${BENCHMARK_CONFIG}" >> "${GITHUB_OUTPUT}"
- name: "Collecting compilation statistics"
id: collect
env:
BENCHMARK_CONFIG: ${{ steps.download-assets.outputs.benchmark-config }}
COMPILE_STATS_RESULTS: benchmark-results/compile-stats-results.json
run: |
mkdir -p benchmark-results
./build_tools/benchmarks/collect_compilation_statistics.py \
--e2e_test_artifacts_dir="${E2E_TEST_ARTIFACTS_DIR}" \
--build_log="${E2E_TEST_ARTIFACTS_BUILD_LOG}" \
--compilation_benchmark_config="${BENCHMARK_CONFIG}" \
--output="${COMPILE_STATS_RESULTS}"
echo "compile-stats-results=${COMPILE_STATS_RESULTS}" >> "${GITHUB_OUTPUT}"
- name: "Uploading benchmark results"
id: upload
env:
COMPILE_STATS_RESULTS: ${{ steps.collect.outputs.compile-stats-results }}
COMPILE_STATS_RESULTS_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.collect.outputs.compile-stats-results }}
run: |
gcloud storage cp \
"${COMPILE_STATS_RESULTS}" \
"${COMPILE_STATS_RESULTS_GCS_ARTIFACT}"
echo "compile-stats-results-gcs-artifact=${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}"