-
Notifications
You must be signed in to change notification settings - Fork 116
376 lines (313 loc) · 12.7 KB
/
cmake.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
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
name: Build and test
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
ubuntu-build:
name: Build - Ubuntu
strategy:
matrix:
os: ['ubuntu-20.04', 'ubuntu-22.04']
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}]
libbacktrace: ['-DVAL_USE_LIBBACKTRACE_BACKTRACE=OFF']
pool_tracking: ['-DUMF_ENABLE_POOL_TRACKING=ON', '-DUMF_ENABLE_POOL_TRACKING=OFF']
include:
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: clang, cxx: clang++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=OFF'
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: gcc, cxx: g++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: clang, cxx: clang++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
- os: 'ubuntu-20.04'
build_type: Release
compiler: {c: gcc-7, cxx: g++-7}
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y doxygen ${{matrix.compiler.c}}
- name: Install g++-7
if: matrix.compiler.cxx == 'g++-7'
run: |
sudo apt-get install -y ${{matrix.compiler.cxx}}
- name: Install pip packages
run: pip install -r third_party/requirements.txt
- name: Install libbacktrace
if: matrix.libbacktrace == '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
run: |
git clone https://github.com/ianlancetaylor/libbacktrace.git
cd libbacktrace
./configure
make
sudo make install
cd ..
- name: Download DPC++
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt install libncurses5
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-01-29/sycl_linux.tar.gz
mkdir -p ${{github.workspace}}/dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C ${{github.workspace}}/dpcpp_compiler
- name: Configure CMake
if: matrix.os == 'ubuntu-22.04'
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
${{matrix.libbacktrace}}
${{matrix.pool_tracking}}
- name: Configure CMake
if: matrix.os == 'ubuntu-20.04'
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
${{matrix.libbacktrace}}
${{matrix.pool_tracking}}
- name: Generate source from spec, check for uncommitted diff
if: matrix.os == 'ubuntu-22.04'
run: cmake --build ${{github.workspace}}/build --target check-generated
- name: Verify that each source file contains a license
run: cmake --build ${{github.workspace}}/build --target verify-licenses
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "umf|loader|validation|tracing|unit|urtrace"
fuzztest-build:
name: Build and run quick fuzztest scenarios
strategy:
matrix:
build_type: [Debug, Release]
compiler: [{c: clang, cxx: clang++}]
runs-on: 'ubuntu-22.04'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install pip packages
run: pip install -r third_party/requirements.txt
- name: Download DPC++
run: |
sudo apt install libncurses5
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz
- name: Setup DPC++
run: |
source ${{github.workspace}}/dpcpp_compiler/startup.sh
- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_USE_ASAN=ON
-DUR_USE_UBSAN=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
- name: Fuzz test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-short"
adapter-build-hw:
name: Build - Adapters on HW
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
strategy:
matrix:
adapter: [
{name: CUDA, platform: ""},
{name: HIP, platform: ""},
{name: L0, platform: ""},
{name: OPENCL, platform: "Intel(R) OpenCL"},
{name: NATIVE_CPU, platform: ""}
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
runs-on: ${{matrix.adapter.name}}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install pip packages
run: pip install -r third_party/requirements.txt
- name: Download DPC++
run: |
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-01-29/sycl_linux.tar.gz
mkdir dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
${{ matrix.adapter.name == 'HIP' && '-DUR_CONFORMANCE_AMD_ARCH=gfx1030' || '' }}
${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }}
- name: Build
# This is so that device binaries can find the sycl runtime library
run: cmake --build ${{github.workspace}}/build -j $(nproc)
- name: Test adapter specific
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180
- name: Test adapters
working-directory: ${{github.workspace}}/build
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
- name: Get information about platform
if: ${{ always() }}
run: .github/scripts/get_system_info.sh
examples-build-hw:
name: Build - examples on HW
# if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
if: false # temporaily disabled due to conda env setup issues
strategy:
matrix:
adapter: [
{name: L0}
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
runs-on: ${{matrix.adapter.name}}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install pip packages
run: pip install -r third_party/requirements.txt
- name: Init conda env
uses: conda-incubator/setup-miniconda@9f54435e0e72c53962ee863144e47a4b094bfd35 # v2.3.0
with:
miniconda-version: "latest"
activate-environment: examples
environment-file: third_party/deps.yml
auto-activate-base: false
- name: Configure CMake
shell: bash -el {0}
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_BUILD_EXAMPLE_CODEGEN=ON
-DUR_DEVELOPER_MODE=ON
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
- name: Test codegen example
working-directory: ${{github.workspace}}/build
run: bin/codegen
# conda init adds content to user's profile making it failing (if conda is gone)
- name: Cleanup after conda init
run: |
cat ${HOME}/.profile || true
rm ${HOME}/.profile || true
- name: Get information about platform
if: ${{ always() }}
run: .github/scripts/get_system_info.sh
windows-build:
name: Build - Windows
strategy:
matrix:
os: ['windows-2019', 'windows-2022']
adapter: [
{name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
]
# TODO: building level zero loader on windows-2019 and clang-cl is currently broken
exclude:
- os: 'windows-2019'
adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
- adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
compiler: {c: clang-cl, cxx: clang-cl}
build_type: [Debug, Release]
compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}]
include:
- compiler: {c: clang-cl, cxx: clang-cl}
toolset: "-T ClangCL"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.9
- name: Install prerequisites
run: python3 -m pip install -r third_party/requirements.txt
- name: Install doxygen
run: |
$WorkingDir = $PWD.Path
Invoke-WebRequest -Uri https://github.com/doxygen/doxygen/releases/download/Release_1_9_8/doxygen-1.9.8.windows.x64.bin.zip -OutFile "$WorkingDir\doxygen.zip"
Expand-Archive -Path "$WorkingDir\doxygen.zip"
Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen"
- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
${{matrix.toolset}}
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DCMAKE_POLICY_DEFAULT_CMP0094=NEW
-DUR_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
${{matrix.adapter.var}}
# TODO: re-enable when check-generated is fixed for windows runners see #888
# - name: Generate source from spec, check for uncommitted diff
# if: matrix.os == 'windows-2022'
# run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}}
- name: Build all
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "umf|loader|validation|tracing|unit|urtrace"
macos-build:
name: Build - MacOS
strategy:
matrix:
os: ['macos-12', 'macos-13']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.9
- name: Install prerequisites
run: python3 -m pip install -r third_party/requirements.txt
- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DUR_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DCMAKE_BUILD_TYPE=Release
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
-DUMF_ENABLE_POOL_TRACKING=ON
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(sysctl -n hw.logicalcpu)