-
Notifications
You must be signed in to change notification settings - Fork 41
/
.gitlab-ci.yml
441 lines (415 loc) · 11.8 KB
/
.gitlab-ci.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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# MIT License
#
# Copyright (c) 2017-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
include:
- project: amd/ci-templates
ref: main
file:
- /defaults.yaml
- /deps-cmake.yaml
- /deps-docs.yaml
- /deps-format.yaml
- /deps-rocm.yaml
- /deps-nvcc.yaml
- /deps-compiler-acceleration.yaml
- /gpus-rocm.yaml
- /gpus-nvcc.yaml
- /rules.yaml
stages:
- lint
- build
- test
- benchmark
clang-format:
extends:
- .lint:clang-format
copyright-date:
extends:
- .deps:rocm
stage: lint
needs: []
tags:
- build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- cd $CI_PROJECT_DIR
- git config --global --add safe.directory $CI_PROJECT_DIR
- scripts/copyright-date/check-copyright.sh -v -d $CI_MERGE_REQUEST_DIFF_BASE_SHA
# hipCUB with rocPRIM backend
.rocm:
variables:
ROCPRIM_GIT_BRANCH: "develop_stream"
extends:
- .deps:rocm
- .deps:cmake-minimum
- .deps:compiler-acceleration
before_script:
- !reference [".deps:rocm", before_script]
- !reference [".deps:cmake-minimum", before_script]
- !reference [".deps:compiler-acceleration", before_script]
# Install rocPRIM from git
- BRANCH_NAME="$ROCPRIM_GIT_BRANCH"
- if [ "$CI_COMMIT_BRANCH" = develop -o "$CI_COMMIT_BRANCH" = master ]; then BRANCH_NAME="$CI_COMMIT_BRANCH"
- fi;
- git clone -b "$BRANCH_NAME" --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@${ROCPRIM_GIT_URL} $CI_PROJECT_DIR/rocPRIM
- cmake
-G Ninja
-D CMAKE_CXX_COMPILER="$AMDCLANG"
-D CMAKE_CXX_FLAGS="-Wall -Wextra"
-D CMAKE_BUILD_TYPE=Release
-D BUILD_TEST=OFF
-D BUILD_EXAMPLE=OFF
-D ROCM_DEP_ROCMCORE=OFF
-D GPU_TARGETS="$GPU_TARGETS"
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
-D CMAKE_CXX_STANDARD=14
-B $CI_PROJECT_DIR/rocPRIM/build
-S $CI_PROJECT_DIR/rocPRIM
- cd $CI_PROJECT_DIR/rocPRIM/build
- cpack -G "DEB"
- $SUDO_CMD dpkg -i rocprim*.deb
build:rocm:
extends:
- .rocm
- .gpus:rocm-gpus
- .rules:build
stage: build
tags:
- build
needs: []
script:
- cmake
-G Ninja
-D CMAKE_CXX_COMPILER="$AMDCLANG"
-D CMAKE_CXX_FLAGS="-Wall -Wextra -Werror -Wno-error=pass-failed"
-D CMAKE_BUILD_TYPE=Release
-D BUILD_TEST=ON
-D BUILD_EXAMPLE=ON
-D GPU_TARGETS="$GPU_TARGETS"
-D GPU_TEST_TARGETS="$GPU_TARGETS"
-D ROCM_SYMLINK_LIBS=OFF
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
-D CMAKE_CXX_STANDARD="$BUILD_VERSION"
-B $CI_PROJECT_DIR/build
-S $CI_PROJECT_DIR
- cmake --build $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
- cpack -G "DEB;ZIP"
artifacts:
paths:
- $CI_PROJECT_DIR/build/test/hipcub/test_*
- $CI_PROJECT_DIR/build/test/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/test/hipcub/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/gtest/
- $CI_PROJECT_DIR/build/CMakeCache.txt
- $CI_PROJECT_DIR/build/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/hipcub*.deb
- $CI_PROJECT_DIR/build/hipcub*.zip
- $CI_PROJECT_DIR/build/.ninja_log
expire_in: 2 weeks
parallel:
matrix:
- BUILD_VERSION: [14, 17]
build:rocm-benchmark:
extends:
- .rocm
- .gpus:rocm-gpus
- .rules:build
stage: build
tags:
- build
needs: []
script:
- cmake
-G Ninja
-D CMAKE_CXX_COMPILER="$AMDCLANG"
-D CMAKE_CXX_FLAGS="-Wall -Wextra"
-D CMAKE_BUILD_TYPE=Release
-D BUILD_BENCHMARK=ON
-D GPU_TARGETS="$GPU_TARGETS"
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
-D CMAKE_CXX_STANDARD=14
-B $CI_PROJECT_DIR/build
-S $CI_PROJECT_DIR
- cmake --build $CI_PROJECT_DIR/build
artifacts:
paths:
- $CI_PROJECT_DIR/build/benchmark/*
- $CI_PROJECT_DIR/build/deps/googlebenchmark/
- $CI_PROJECT_DIR/build/.ninja_log
- $CI_PROJECT_DIR/build/CMakeCache.txt
expire_in: 2 weeks
test:rocm:
stage: test
needs:
- build:rocm
extends:
- .rocm
- .gpus:rocm
- .rules:test
script:
- cd $CI_PROJECT_DIR/build
- cmake
-D CMAKE_PREFIX_PATH=/opt/rocm
-D CMAKE_CXX_STANDARD=14
-P $CI_PROJECT_DIR/cmake/GenerateResourceSpec.cmake
- cat ./resources.json
# Parallel execution (with other AMDGPU processes) can oversubscribe the SDMA queue.
# This causes the hipMemcpy to fail, which is not reported as an error by HIP.
# As a temporary workaround, disable the SDMA for test stability.
- HSA_ENABLE_SDMA=0 ctest
--output-on-failure
--repeat-until-fail 2
--tests-regex "$GPU_TARGET"
--resource-spec-file ./resources.json
--parallel $PARALLEL_JOBS
.benchmark:
stage: benchmark
variables:
BENCHMARK_FILENAME_REGEX: ^benchmark
BENCHMARK_FILTER_REGEX: ""
script:
- python3 ${CI_PROJECT_DIR}/.gitlab/run_and_upload_benchmarks.py
--api_endpoint ${BENCHMARK_API_ENDPOINT}
--api_base_folder_id ${BENCHMARK_API_FOLDER_ID}
--api_auth_token ${BENCHMARK_API_AUTH_TOKEN}
--benchmark_dir ${CI_PROJECT_DIR}/build/benchmark
--benchmark_datetime ${CI_PIPELINE_CREATED_AT}
--benchmark_version ${CI_COMMIT_REF_SLUG}_MR${CI_MERGE_REQUEST_IID}_${CI_COMMIT_SHORT_SHA}
--benchmark_gpu_name "${GPU}"
--benchmark_filename_regex "${BENCHMARK_FILENAME_REGEX}"
--benchmark_filter_regex "${BENCHMARK_FILTER_REGEX}"
--no_upload
artifacts:
paths:
- ${CI_PROJECT_DIR}/build/benchmark/*.json
expire_in: 1 week
benchmark:rocm:
extends:
- .rocm
- .benchmark
- .gpus:rocm
- .rules:benchmark
needs:
- build:rocm-benchmark
.test_package:
script:
- |
if [[ -n $GPU_TARGETS ]]; then
GPU_TARGETS_ARG="-DGPU_TARGETS=$GPU_TARGETS"
else
GPU_TARGETS_ARG=""
fi
- cmake
-G Ninja
-D CMAKE_CXX_FLAGS="-Wall -Wextra -Werror"
"$GPU_TARGETS_ARG"
-D CMAKE_CXX_STANDARD=14
-S $CI_PROJECT_DIR/test/extra
-B $CI_PROJECT_DIR/build/package_test
- cmake --build $CI_PROJECT_DIR/build/package_test
- cd $CI_PROJECT_DIR/build/package_test
- ctest --output-on-failure --repeat-until-fail 2
.test:package:
script:
- cd $CI_PROJECT_DIR/build
- $SUDO_CMD dpkg -i ${HIPCUB_DEV_PACKAGE_WILDCARD}
- export CXX
- !reference [".test_package", script]
- $SUDO_CMD dpkg -r rocprim-dev hipcub-dev
.test:install:
script:
- export CXX
- cmake
-G Ninja
-D BUILD_TEST=OFF
-D CMAKE_CXX_STANDARD=14
-S $CI_PROJECT_DIR
-B $CI_PROJECT_DIR/build_only_install
# Preserve $PATH when sudoing
- $SUDO_CMD env PATH="$PATH" cmake --install $CI_PROJECT_DIR/build_only_install
- !reference [".test_package", script]
test:rocm_package:
stage: test
needs:
- build:rocm
variables:
CXX: "$AMDCLANG"
HIPCUB_DEV_PACKAGE_WILDCARD: hipcub-dev*.deb
tags:
- rocm
extends:
- .rocm
- .gpus:rocm-gpus
- .test:package
- .rules:test
test:rocm_install:
stage: test
needs: []
variables:
CXX: "$AMDCLANG"
tags:
- rocm
extends:
- .rocm
- .gpus:rocm-gpus
- .test:install
- .rules:test
# hipCUB with CUB backend
.nvcc:
extends:
- .deps:nvcc
- .gpus:nvcc-gpus
- .deps:cmake-minimum
- .deps:compiler-acceleration
before_script:
- !reference [".deps:nvcc", before_script]
- !reference [".deps:cmake-minimum", before_script]
- !reference [".deps:compiler-acceleration", before_script]
build:nvcc:
stage: build
extends:
- .nvcc
- .rules:build
tags:
- build
needs: []
script:
- cmake
-G Ninja
-D CMAKE_CXX_FLAGS="-Wall -Wextra"
-D CMAKE_BUILD_TYPE=Release
-D BUILD_TEST=ON
-D BUILD_EXAMPLE=ON
-D NVGPU_TARGETS="$GPU_TARGETS"
-D ROCM_SYMLINK_LIBS=OFF
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
-D CMAKE_CUDA_COMPILER_LAUNCHER=phc_sccache_cuda
-D CMAKE_CXX_STANDARD="$BUILD_VERSION"
-B $CI_PROJECT_DIR/build
-S $CI_PROJECT_DIR
- cmake --build $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
- cpack -G "DEB;ZIP"
artifacts:
paths:
- $CI_PROJECT_DIR/build/test/hipcub/test_*
- $CI_PROJECT_DIR/build/test/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/test/hipcub/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/gtest/
- $CI_PROJECT_DIR/build/CMakeCache.txt
- $CI_PROJECT_DIR/build/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/hipcub*.deb
- $CI_PROJECT_DIR/build/hipcub*.zip
- $CI_PROJECT_DIR/build/.ninja_log
expire_in: 2 weeks
parallel:
matrix:
- BUILD_VERSION: [14, 17]
build:nvcc-benchmark:
stage: build
extends:
- .nvcc
- .rules:build
tags:
- build
needs: []
script:
- cmake
-G Ninja
-D CMAKE_CXX_FLAGS="-Wall -Wextra"
-D CMAKE_BUILD_TYPE=Release
-D BUILD_BENCHMARK=ON
-D NVGPU_TARGETS="$GPU_TARGETS"
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
-D CMAKE_CUDA_COMPILER_LAUNCHER=phc_sccache_cuda
-D CMAKE_CXX_STANDARD=14
-B $CI_PROJECT_DIR/build
-S $CI_PROJECT_DIR
- cmake --build $CI_PROJECT_DIR/build
artifacts:
paths:
- $CI_PROJECT_DIR/build/benchmark/*
- $CI_PROJECT_DIR/build/deps/googlebenchmark/
- $CI_PROJECT_DIR/build/.ninja_log
- $CI_PROJECT_DIR/build/CMakeCache.txt
expire_in: 2 weeks
test:nvcc:
stage: test
needs:
- build:nvcc
extends:
- .nvcc
- .gpus:nvcc
- .rules:test
before_script:
# This is only needed because of the legacy before_script in .gpus:nvcc would otherwise overwrite before_script
- !reference [.nvcc, before_script]
script:
- cd $CI_PROJECT_DIR/build
- ctest --output-on-failure --repeat-until-fail 2
benchmark:nvcc:
needs:
- build:nvcc-benchmark
extends:
- .nvcc
- .gpus:nvcc
- .benchmark
- .rules:benchmark
before_script:
# This is only needed because of the legacy before_script in .gpus:nvcc would otherwise overwrite before_script
- !reference [.nvcc, before_script]
test:nvcc_package:
stage: test
needs:
- build:nvcc
variables:
HIPCUB_DEV_PACKAGE_WILDCARD: hipcub_nvcc-dev*.deb
tags:
- nvcc
extends:
- .nvcc
- .test:package
- .rules:test
test:nvcc_install:
stage: test
needs: []
tags:
- nvcc
extends:
- .nvcc
- .test:install
- .rules:test
test:doc:
stage: test
variables:
SPHINX_DIR: $DOCS_DIR/sphinx
extends:
- .rules:test
- .build:docs
scheduled-check-changes:
extends: .rules:scheduled-check-changes