Repository navigation
267 lines (251 loc) · 14 KB
/
Copy pathbuild-cadence-runner.yml
File metadata and controls
267 lines (251 loc) · 14 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: Cadence Build & Test
on:
schedule:
- cron: 0 8 * * *
push:
branches:
- main
- release/*
tags:
- ciflow/nightly/*
pull_request:
# Fork PRs, Meta exports from personal forks included. pull_request_target
# always runs this file from the default branch, so the paths filter below only
# affects fork PRs.
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- backends/cadence/**
- examples/cadence/**
- .ci/scripts/setup-xtensa-tools.sh
- .ci/scripts/build-cadence-xtensa.sh
- .ci/scripts/test-cadence-generic.sh
- .ci/scripts/test-cadence-xtensa.sh
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}
cancel-in-progress: true
# Every job runs on the same paths. Same-repo PRs use pull_request, which reads
# the PR's own workflow AND code -- so CI changes, new test jobs, code, and tests
# are all validated pre-merge. Fork PRs can't get credentials (OIDC) there, so
# fork PRs whose author has contributed before (CONTRIBUTOR or above) run on
# pull_request_target instead. The CPU jobs hold no AWS credentials on any path
# (contents: read only), so linux_job_v3's role/arc never reaches fork code; only
# the Xtensa jobs assume a role, the Cadence artifacts one. The run condition is
# inlined per job (GitHub Actions has no YAML anchors and env is unavailable in
# job-level if), so keep the copies in sync.
jobs:
# Resolves the image inline rather than through the shared _docker-image.yml,
# which checks out the PR head: actions/checkout refuses that for fork code on
# pull_request_target. There the image comes from the base branch (github.sha),
# which also keeps a fork from picking the image it runs in. Same-repo PRs read
# their own head, as _docker-image.yml does, so .ci/docker changes are tested.
docker-image:
name: Resolve CI docker image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
image: ${{ steps.hash.outputs.image }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- id: hash
run: |
set -eu
CI_DOCKER_HASH="$(git rev-parse HEAD:.ci/docker)"
echo "image=308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/ci-image:executorch-ubuntu-22.04-clang12-${CI_DOCKER_HASH}" >> "$GITHUB_OUTPUT"
cpu-build:
needs: docker-image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main
permissions:
contents: read
with:
job-name: build
runner: mt-l-x86iavx512-8-64
docker-image: ${{ needs.docker-image.outputs.image }}
submodules: recursive
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
timeout: 90
upload-artifact: cadence-runner-build
script: |
set -eux
# The generic Linux job chooses to use base env, not the one setup by the image
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
./install_requirements.sh > /dev/null
bash backends/cadence/build_cadence_runner.sh
# Copy runner binary to artifact dir for downstream test jobs
cp cmake-out/backends/cadence/cadence_runner "${RUNNER_ARTIFACT_DIR}/"
cpu-test:
needs: [docker-image, cpu-build]
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
contents: read
uses: ./.github/workflows/_test_cadence.yml
with:
docker-image: ${{ needs.docker-image.outputs.image }}
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
# Op-level gtests of the generic (reference) kernels on the host. A separate
# configure from cpu-build, because the gtests need the exceptions and RTTI
# that the runner build disables.
cpu-op-test:
needs: docker-image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main
permissions:
contents: read
with:
job-name: op-test
runner: mt-l-x86iavx512-8-64
docker-image: ${{ needs.docker-image.outputs.image }}
submodules: recursive
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
timeout: 90
script: |
set -eux
# The generic Linux job chooses to use base env, not the one setup by the image
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
./install_requirements.sh > /dev/null
.ci/scripts/test-cadence-generic.sh
# Cross-compile cadence_executor_runner for each Cadence Xtensa core, one job
# per backend so they show as separate lines (no matrix grouping). Shared logic
# lives in _xtensa_build.yml. fusion_g3 is omitted until the upstream fusion_g3
# <-> nnlib-FusionG3 API skew is fixed (its runner does not link).
hifi-build:
needs: docker-image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_build.yml
with:
backend: hifi4
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}
# Op-level gtest tests on the Xtensa ISS, mirroring cpu-build -> cpu-test. The
# op tests are a self-contained cross-compile (the gtests need exceptions and
# RTTI that the runner build disables), so this does not consume hifi-build's
# artifact; needs: hifi-build only to fail fast when the backend cannot build.
hifi-op-test:
needs: [docker-image, hifi-build]
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_test.yml
with:
backend: hifi4
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}
vision-build:
needs: docker-image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_build.yml
with:
backend: vision
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}
hifi1s-build:
needs: docker-image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_build.yml
with:
backend: hifi1s
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}
hifi1s-op-test:
needs: [docker-image, hifi1s-build]
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_test.yml
with:
backend: hifi1s
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}
hifi5s-build:
needs: docker-image
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_build.yml
with:
backend: hifi5s
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}
hifi5s-op-test:
needs: [docker-image, hifi5s-build]
if: >-
github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
permissions:
id-token: write
contents: read
uses: ./.github/workflows/_xtensa_test.yml
with:
backend: hifi5s
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
docker-image: ${{ needs.docker-image.outputs.image }}
allow-fork-checkout: ${{ github.event_name == 'pull_request_target' }}