-
Notifications
You must be signed in to change notification settings - Fork 744
244 lines (237 loc) · 8.95 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
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/ubuntu2204_build:latest"
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
merge_ref:
description: |
Commit-ish to merge post-checkout if non-empty. Must be reachable from
the default_branch input paramter.
type: string
default: 'FETCH_HEAD'
retention-days:
description: 'Artifacts retention period'
type: string
default: 3
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_ubuntu2204_nightly:build"
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 }}
merge_ref: ${{ inputs.merge_ref }}
cache_path: "/__w/repo_cache/"
- name: Configure
env:
CC: ${{ inputs.cc }}
CXX: ${{ inputs.cxx }}
ARGS: ${{ inputs.build_configure_extra_args }}
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 $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="-DSYCL_PI_TESTS=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: 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 }}