-
Notifications
You must be signed in to change notification settings - Fork 822
358 lines (334 loc) · 13.3 KB
/
sycl-linux-build.yml
File metadata and controls
358 lines (334 loc) · 13.3 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
name: Reusable SYCL Linux build workflow
defaults:
run:
shell: bash
on:
workflow_call:
inputs:
cc:
type: string
required: false
default: "gcc"
cxx:
type: string
required: false
default: "g++"
build_image:
type: string
required: false
default: "ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps"
build_ref:
type: string
required: false
build_cache_root:
type: string
required: true
build_cache_suffix:
type: string
required: false
default: "default"
build_configure_extra_args:
type: string
required: false
default: "--hip --cuda --native_cpu"
build_target:
type: string
required: false
default: sycl-toolchain
changes:
type: string
description: 'Filter matches for the changed files in the PR'
default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc]'
required: false
# Artifacts:
retention-days:
description: 'Artifacts retention period'
type: string
default: 3
toolchain_artifact:
type: string
required: true
toolchain_artifact_filename:
type: string
default: llvm_sycl.tar.zst
release_toolchain_artifact:
type: string
required: false
description: |
If provided, create an additional toolchain artifact without utilities
used for testing in it. File name of the archive is the same as in the
`toolchain_artifact` above.
e2e_binaries_artifact:
type: string
required: false
e2e_binaries_spirv_backend_artifact:
type: string
required: false
e2e_binaries_preview_artifact:
type: string
required: false
outputs:
build_conclusion:
value: ${{ jobs.build.outputs.build_conclusion }}
toolchain_artifact:
value: ${{ inputs.toolchain_artifact }}
toolchain_artifact_filename:
value: ${{ jobs.build.outputs.toolchain_artifact_filename }}
toolchain_decompress_command:
value: ${{ jobs.build.outputs.toolchain_decompress_command }}
workflow_dispatch:
inputs:
changes:
description: 'Filter matches for the changed files in the PR'
type: choice
options:
- "[]"
- '[sycl]'
- '[llvm, clang, sycl, llvm_spirv, xptifw, libclc]'
build_image:
type: choice
options:
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest'
- 'ghcr.io/intel/llvm/ubuntu2204_build:latest'
cc:
type: choice
options:
- gcc
cxx:
type: choice
options:
- g++
build_configure_extra_args:
type: choice
options:
- "--hip --cuda --native_cpu"
# Cache properties need to match CC/CXX/CMake opts. Any additional choices
# would need extra care.
build_cache_root:
type: choice
options:
- "/__w/"
build_cache_suffix:
type: choice
options:
- "default"
retention-days:
type: choice
options:
- 3
toolchain_artifact:
type: choice
options:
- "sycl_linux_default"
permissions: read-all
jobs:
build:
name: Build + LIT
runs-on: [Linux, build]
container:
image: ${{ inputs.build_image }}
options: -u 1001:1001
outputs:
build_conclusion: ${{ steps.build.conclusion }}
toolchain_artifact_filename: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
toolchain_decompress_command: ${{ steps.artifact_info.outputs.DECOMPRESS }}
env:
CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }}
CCACHE_MAXSIZE: 8G
steps:
- name: Deduce artifact archive params
# To reduce number of inputs parameters that is limited for manual triggers.
id: artifact_info
run: |
NAME="${{inputs.toolchain_artifact_filename}}"
if [ -z "$NAME" ]; then
NAME=llvm_sycl.tar.zst
fi
echo ARCHIVE_NAME="$NAME" >> $GITHUB_OUTPUT
if [ "${NAME}" != "${NAME%.tar.gz}" ]; then
echo COMPRESS="gzip" >> $GITHUB_OUTPUT
echo DECOMPRESS="gunzip" >> $GITHUB_OUTPUT
elif [ "${NAME}" != "${NAME%.tar.zst}" ]; then
echo COMPRESS="zstd -9" >> $GITHUB_OUTPUT
echo DECOMPRESS="zstd" >> $GITHUB_OUTPUT
else
echo "Unsupported extension"
exit 1
fi
- uses: actions/checkout@v5
with:
sparse-checkout: |
devops/actions
# Cleanup will be run after all actions are completed.
- name: Register cleanup after job is finished
uses: ./devops/actions/cleanup
- uses: ./devops/actions/cached_checkout
with:
path: src
ref: ${{ inputs.build_ref || github.sha }}
cache_path: "/__w/repo_cache/"
- name: Setup oneAPI env
if: ${{ inputs.cc == 'icx' || inputs.cxx == 'icpx' }}
uses: ./devops/actions/setup_linux_oneapi_env
- name: Configure
# Setting `CMAKE_INSTALL_PREFIX` is important because that's the location
# where `sycl-linux-run-tests.yml` unpacks the toolchain to. That location
# *must* match between build-only and run-only E2E tests runs and we might
# be creating pre-built E2E tests' binaries in this workflow.
env:
CC: ${{ inputs.cc }}
CXX: ${{ inputs.cxx }}
CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs"
run: |
mkdir -p $CCACHE_DIR
mkdir -p $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \
-t Release \
--ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLLVM_INSTALL_UTILS=ON \
-DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON
- name: Compile
id: build
# Emulate default value for manual dispatch as we've run out of available arguments.
run: cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }}
- run: $GITHUB_WORKSPACE/build/bin/clang++ --version
- name: check-llvm
if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }}
env:
# Can't inline to support possible quotes inside:
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
run: |
if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
# https://github.com/llvm/llvm-project/issues/59429
export LIT_FILTER_OUT="ExecutionEngine/MCJIT"
fi
cmake --build $GITHUB_WORKSPACE/build --target check-llvm
- name: check-clang
if: ${{ !cancelled() && contains(inputs.changes, 'clang') }}
env:
# Can't inline to support possible quotes inside:
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
run: |
# Can we move this to Dockerfile? Hopefully, noop on Windows.
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
# https://github.com/llvm/llvm-project/issues/59428
export LIT_FILTER_OUT="(E|e)xception"
fi
cmake --build $GITHUB_WORKSPACE/build --target check-clang
- name: check-sycl
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
- name: check-sycl-unittests
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
cmake --build $GITHUB_WORKSPACE/build --target check-sycl-unittests
- name: check-llvm-spirv
if: ${{ !cancelled() && contains(inputs.changes, 'llvm_spirv') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
- name: check-xptifw
if: ${{ !cancelled() && contains(inputs.changes, 'xptifw') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
- name: check-libclc
if: ${{ !cancelled() && contains(inputs.changes, 'libclc') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
- name: Check E2E test requirements
if: ${{ !cancelled() && !contains(inputs.changes, 'sycl') }}
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
LIT_OPTS="--allow-empty-runs" LIT_FILTER="e2e_test_requirements" cmake --build $GITHUB_WORKSPACE/build --target check-sycl
- name: Install sycl-toolchain
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain
- name: Pack toolchain release
if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
- name: Upload toolchain release
if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
uses: actions/upload-artifact@v5
with:
name: ${{ inputs.release_toolchain_artifact }}
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
retention-days: ${{ inputs.retention-days }}
- name: Install utilities
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target install-sycl-test-utilities
- name: Additional Install for "--shared-libs" build
if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target install-clang-libraries
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-libraries
- name: Pack toolchain
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
- name: Upload toolchain
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
uses: actions/upload-artifact@v5
with:
name: ${{ inputs.toolchain_artifact }}
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
retention-days: ${{ inputs.retention-days }}
- name: Source OneAPI TBB vars.sh
# Tasks that use the just built toolchain below, need extra environment
# setup. No harm in it if all of those tasks would get skipped.
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: |
# https://github.com/actions/runner/issues/1964 prevents us from using
# the ENTRYPOINT in the image.
env | sort > env_before
if [ -e /runtimes/oneapi-tbb/env/vars.sh ]; then
source /runtimes/oneapi-tbb/env/vars.sh;
elif [ -e /opt/runtimes/oneapi-tbb/env/vars.sh ]; then
source /opt/runtimes/oneapi-tbb/env/vars.sh;
else
echo "no TBB vars in /opt/runtimes or /runtimes";
fi
env | sort > env_after
comm -13 env_before env_after >> $GITHUB_ENV
rm env_before env_after
- name: Build E2E tests
if: ${{ inputs.e2e_binaries_artifact && !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/run-tests/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd"
- name: Build E2E tests with SPIR-V Backend
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/run-tests/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_spirv_backend_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param spirv-backend=True
- name: Build E2E tests in Preview Mode
if: ${{ inputs.e2e_binaries_preview_artifact && !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/run-tests/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_preview_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param test-preview-mode=True