forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
281 lines (271 loc) · 10.7 KB
/
sycl-linux-build.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
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
name: Reusable SYCL Linux build workflow
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_artifact_suffix:
type: string
required: true
artifact_archive_name:
type: string
default: llvm_sycl.tar.zst
changes:
type: string
description: 'Filter matches for the changed files in the PR'
default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]'
required: false
retention-days:
description: 'Artifacts retention period'
type: string
default: 3
e2e_binaries_artifact:
type: string
required: False
outputs:
build_conclusion:
value: ${{ jobs.build.outputs.build_conclusion }}
artifact_archive_name:
value: ${{ jobs.build.outputs.artifact_archive_name }}
artifact_decompress_command:
value: ${{ jobs.build.outputs.artifact_decompress_command }}
workflow_dispatch:
inputs:
changes:
description: 'Filter matches for the changed files in the PR'
type: choice
options:
- "[]"
- '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]'
build_image:
type: choice
options:
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly: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"
build_artifact_suffix:
type: choice
options:
- "default"
retention-days:
type: choice
options:
- 3
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 }}
artifact_archive_name: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
artifact_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.artifact_archive_name}}"
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@v4
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
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 -t Release \
--ci-defaults ${{ inputs.build_configure_extra_args }} \
--cmake-opt=-DCMAKE_C_COMPILER_LAUNCHER=ccache \
--cmake-opt=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
--cmake-opt="-DLLVM_INSTALL_UTILS=ON" \
--cmake-opt="-DNATIVECPU_USE_OCK=Off" \
--cmake-opt="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SPIRV"
- name: Compile
id: build
run: cmake --build $GITHUB_WORKSPACE/build
- name: check-llvm
if: always() && !cancelled() && contains(inputs.changes, 'llvm')
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-llvm
- name: check-clang
if: always() && !cancelled() && contains(inputs.changes, 'clang')
run: |
# Can we move this to Dockerfile? Hopefully, noop on Windows.
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
cmake --build $GITHUB_WORKSPACE/build --target check-clang
- name: check-sycl
if: always() && !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: always() && !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: always() && !cancelled() && contains(inputs.changes, 'llvm_spirv')
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
- name: check-xptifw
if: always() && !cancelled() && contains(inputs.changes, 'xptifw')
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
- name: check-libclc
if: always() && !cancelled() && contains(inputs.changes, 'libclc')
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
- name: check-libdevice
if: always() && !cancelled() && contains(inputs.changes, 'libdevice')
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-libdevice
- name: Check E2E test requirements
if: always() && !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
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
# TODO replace utility installation with a single CMake target
run: |
cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain
cmake --build $GITHUB_WORKSPACE/build --target utils/FileCheck/install
cmake --build $GITHUB_WORKSPACE/build --target utils/count/install
cmake --build $GITHUB_WORKSPACE/build --target utils/not/install
cmake --build $GITHUB_WORKSPACE/build --target utils/lit/install
cmake --build $GITHUB_WORKSPACE/build --target utils/llvm-lit/install
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-size
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-cov
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-profdata
cmake --build $GITHUB_WORKSPACE/build --target install-compiler-rt
- name: Additional Install for "--shared-libs" build
if: ${{ always() && !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: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/build/install .
- name: Upload toolchain
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
uses: actions/upload-artifact@v4
with:
name: sycl_linux_${{ inputs.build_artifact_suffix }}
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
retention-days: ${{ inputs.retention-days }}
- name: Copy toolchain
if: ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
# We must have the compiler in the same location as it will be in the E2E
# run-tests job.
run: cp -r $GITHUB_WORKSPACE/build/install $GITHUB_WORKSPACE/toolchain
- name: Source OneAPI TBB vars.sh
if: ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
shell: bash
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 && always() && !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 }}
cxx_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++