-
Notifications
You must be signed in to change notification settings - Fork 45
/
.gitlab-ci.yml
430 lines (402 loc) · 13 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
# MIT License
#
# Copyright (c) 2022-2023 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
- /gpus-rocm.yaml
- /gpus-nvcc.yaml
- /rules.yaml
variables:
# Temporary suppress warnings due to nvidia_hip_runtime_api bug
CUDA_WARNING_SUPPRESS_FLAGS: ",-Wno-missing-field-initializers,-Wno-deprecated-declarations,-Wno-sign-compare,-Wno-return-local-addr -diag-suppress=1056"
CUDA_FLAGS: "-Xcompiler -Wall,-Wextra,-Werror${CUDA_WARNING_SUPPRESS_FLAGS} --Werror all-warnings"
# We require '-Wno-unused-command-line-argument' due to the following warning:
# argument unused during compilation: '--rtlib=compiler-rt'
CXX_FLAGS: "-Wno-unused-command-line-argument -Wall -Wextra -Werror"
HIP_FLAGS: "-Wno-unused-command-line-argument -Wall -Wextra -Werror"
stages:
- lint
- build
- test
clang-format:
image: $DOCKER_TAG_PREFIX:rocm-ubuntu
stage: lint
needs: []
tags:
- build
variables:
CLANG_FORMAT: "/opt/rocm/llvm/bin/clang-format"
GIT_CLANG_FORMAT: "/opt/rocm/llvm/bin/git-clang-format"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- cd $CI_PROJECT_DIR
- git config --global --add safe.directory $CI_PROJECT_DIR
- Scripts/CodeFormat/check_format.sh $CI_MERGE_REQUEST_DIFF_BASE_SHA --binary "$CLANG_FORMAT"
copyright-date:
image: $DOCKER_TAG_PREFIX:rocm-ubuntu
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/CopyrightDate/check_copyright.sh -v -d $CI_MERGE_REQUEST_DIFF_BASE_SHA
.build:dockerfiles:
timeout: 60m
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
needs: []
tags:
- build
script:
- mkdir -p /kaniko/.docker
- echo "${DOCKER_AUTH_CONFIG}" > /kaniko/.docker/config.json
- if [ "$CI_COMMIT_BRANCH" != "$CI_DEFAULT_BRANCH" ]; then NO_PUSH="--no-push"; fi;
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}/Dockerfiles"
--dockerfile "${CI_PROJECT_DIR}/Dockerfiles/hip-libraries-${TAG}.Dockerfile"
--destination "docker.io/${DOCKER_TAG_PREFIX}:${TAG}"
${NO_PUSH}
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- Dockerfiles/hip-libraries-${TAG}.Dockerfile
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- Dockerfiles/hip-libraries-${TAG}.Dockerfile
build:rocm-ubuntu-dockerfile:
extends:
- .build:dockerfiles
variables:
TAG: rocm-ubuntu
build:cuda-ubuntu-dockerfile:
extends:
- .build:dockerfiles
variables:
TAG: cuda-ubuntu
########################
# Ubuntu make #
########################
build:make-rocm:
image: $DOCKER_TAG_PREFIX:rocm-ubuntu
stage: build
extends:
- .rules:build
tags:
- build
needs: []
script:
- cd $CI_PROJECT_DIR && make CXXFLAGS="$HIP_FLAGS" -j $(nproc)
build:make-cuda:
image: $DOCKER_TAG_PREFIX:cuda-ubuntu
stage: build
extends:
- .rules:build
tags:
- build
needs: []
script:
- cd $CI_PROJECT_DIR && make CXXFLAGS="$CUDA_FLAGS" GPU_RUNTIME=CUDA -j $(nproc)
########################
# Ubuntu cmake #
########################
.build:cmake:
stage: build
extends:
- .rules:build
needs: []
artifacts:
paths:
- $CI_PROJECT_DIR/build
build:cmake-rocm:
image: $DOCKER_TAG_PREFIX:rocm-ubuntu
extends:
- .build:cmake
- .gpus:rocm-gpus
tags:
- build
script:
- cmake
-S $CI_PROJECT_DIR
-B $CI_PROJECT_DIR/build
-D CMAKE_HIP_ARCHITECTURES="$GPU_TARGETS"
-D CMAKE_CXX_FLAGS="$CXX_FLAGS"
-D CMAKE_HIP_FLAGS="$HIP_FLAGS"
2>&1 | tee cmake_log.txt
# check if all dependencies were found
- |-
if grep -qi "could not find" cmake_log.txt; then
echo "Some CMake libraries could not be found"
exit 1
fi
- cmake --build $CI_PROJECT_DIR/build
- cmake --install $CI_PROJECT_DIR/build --prefix $CI_PROJECT_DIR/install
build:cmake-cuda:
image: $DOCKER_TAG_PREFIX:cuda-ubuntu
extends:
- .build:cmake
tags:
- build
script:
- cmake
-S $CI_PROJECT_DIR
-B $CI_PROJECT_DIR/build
-D GPU_RUNTIME=CUDA
-D CMAKE_CXX_FLAGS="$CXX_FLAGS"
-D CMAKE_CUDA_FLAGS="$CUDA_FLAGS"
-D CMAKE_MODULE_PATH=/opt/rocm/lib/cmake/hip
2>&1 | tee cmake_log.txt
# check if all dependencies were found
- |-
if grep -qi "could not find" cmake_log.txt; then
echo "Some CMake libraries could not be found"
exit 1
fi
- cmake --build $CI_PROJECT_DIR/build
- cmake --install $CI_PROJECT_DIR/build --prefix $CI_PROJECT_DIR/install
########################
# Ubuntu Tests #
########################
.test:
stage: test
extends:
- .rules:test
script:
- cd $CI_PROJECT_DIR/build && ctest --output-on-failure
test:rocm:
image: $DOCKER_TAG_PREFIX:rocm-ubuntu
extends:
- .test
- .gpus:rocm
needs:
- build:cmake-rocm
test:cuda:
image: $DOCKER_TAG_PREFIX:cuda-ubuntu
extends:
- .test
- .gpus:nvcc
before_script:
- export HIP_COMPILER=nvcc
- export HIP_PLATFORM=nvidia
- export HIP_RUNTIME=cuda
needs:
- build:cmake-cuda
########################
# Windows VisualStudio #
########################
.test:windows-rocm:
tags:
- windows
- shell
- rx6900
variables:
SOLUTION_PREFIX: ROCm-Examples-VS
# hip_vulkant_interop: graphical
# hip_texture_management: does not work
# rocsparse_*: broken with new SDK
SkippedExamples: >
hip_vulkan_interop_*.exe,
hip_texture_management_*.exe,
rocsparse_bsric0_*.exe,
rocsparse_bsrilu0_*.exe,
rocsparse_bsrsm_*.exe,
rocsparse_bsrsv_*.exe,
rocsparse_csric0_*.exe,
rocsparse_csrilu0_*.exe,
rocsparse_csrsv_*.exe,
rocsparse_spsv_*.exe,
rocsparse_spsm_*.exe
.test:windows-nvcc:
tags:
- nvcc-windows
.test:windows-vs:
stage: test
timeout: 30m
extends:
- .rules:test
parallel:
matrix:
- VS_VERSION:
- 2017
- 2019
- 2022
BUILD_TYPE:
- Debug
- Release
variables:
Timeout: 60
Filter: "*_vs$VS_VERSION.exe"
script:
- |
& ${env:HIP_PATH}/bin/clang++ --version
- | # Find MSBuild.exe of the associated version.
$MSBUILD = (
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -find MSBuild\**\Bin\MSBuild.exe
| Select-String -Pattern $VS_VERSION
)[0]
Write-Output ("MSBuild: $MSBUILD" -f $MSBUILD)
- | # Fixes error MSB8036: The Windows SDK version 8.1 was not found
if ($VS_VERSION -eq 2017) {
$MSBUILD_EXTRA_OPTIONS = "/p:WindowsTargetPlatformVersion=10.0.20348.0"
}
- | # Build!
& $MSBUILD @(
"/clp:Summary;ShowEventId;ShowTimestamp"
"/p:Configuration=$BUILD_TYPE"
"/p:Verbose=false"
"/maxCpuCount:8"
"/p:CL_MPCount=8"
"/verbosity:minimal"
"/validate"
"/warnAsError"
# MSBuild cannot properly resolve the `<Content Include=` dependencies, and will sometimes try to copy
# two or more files at once. This results in a warning before it retries, which is counted towards
# /warnAsError by default. For this reason, we disable the relevant warning (MSB3026).
"/warnAsMessage:MSB3026"
"/t:build"
$MSBUILD_EXTRA_OPTIONS
"$CI_PROJECT_DIR\$SOLUTION_PREFIX$VS_VERSION.sln"
)
- | # Use external script to test examples
& $CI_PROJECT_DIR\Scripts\WindowsRunner.ps1 $CI_PROJECT_DIR\$BUILD_TYPE $Filter $Timeout $("$SkippedExamples".split(','))
test:windows-rocm-vs:
extends:
- .test:windows-rocm
- .test:windows-vs
tags:
- windows
- shell
- rx6900
variables:
SOLUTION_PREFIX: ROCm-Examples-VS
# hip_vulkan_interop: graphical
# applications_monte_carlo_pi: broken with new SDK (5.7 v66)
# hipfft/rocfft_*: broken with new SDK (5.7 v66)
SkippedExamples: >
hip_vulkan_interop_*.exe,
applications_monte_carlo_pi_*.exe,
hipfft_plan_d2z_*.exe,
hipfft_plan_z2z_*.exe,
hipfft_plan_many_2d_r2c_*.exe,
hipfft_plan_many_2d_z2z_*.exe,
hipfft_setworkarea_*.exe,
rocfft_complex_complex_*.exe,
rocfft_complex_real_*.exe,
rocfft_real_complex_*.exe
test:windows-nvcc-vs:
extends:
- .test:windows-nvcc
- .test:windows-vs
tags:
- nvcc-windows
variables:
SOLUTION_PREFIX: ROCm-Examples-Portable-VS
# NVCC examples broken with new SDK (5.7 v66)
SkippedExamples: >
*.exe
before_script:
# To test for NVIDIA, we need to set the platform toolset to HIP_nvcc. This cannot be done with /p:PlatformToolset
# though, as some examples use the regular msvc toolchain.
- |
Foreach ($f in (Get-ChildItem -Recurse -Filter "*.vcxproj" "$CI_PROJECT_DIR").FullName) {
(Get-Content $f) |
% { $_ -replace "<PlatformToolset>HIP_clang</PlatformToolset>","<PlatformToolset>HIP_nvcc</PlatformToolset>" } |
Set-Content $f
}
########################
# Windows cmake #
########################
.test:windows-cmake:
extends:
- .rules:test
variables:
VS_VERSION: 2022
BUILD_TYPE: Release
before_script:
- | # Find VS installation
$VS_PATH = (
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -property InstallationPath
| Select-String -Pattern $VS_VERSION
)[0]
- | # Find DevShell.dll
$VS_DEV_SHELL = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -path "$VS_PATH" -find "**\Tools\Microsoft.VisualStudio.DevShell.dll"
- Import-Module "$VS_DEV_SHELL"
- Enter-VsDevShell -InstallPath "$VS_PATH" -SkipAutomaticLocation -DevCmdArguments '/arch=x64 /host_arch=x64 /no_logo'
script:
- | # Ensure no libraries are missing during compilation!
if (Select-String -Path cmake_log.txt -Pattern "could not find") {
throw "Some cmake libraries are missing"
}
- cmake --build "$CI_PROJECT_DIR/build"
# CMake does not copy the dependencies to the test folder, and there is no sufficiently concise way of doing it.
# So for now, just add the library path here.
- $env:PATH = "${env:HIP_PATH}\bin;" + $env:PATH
- cd "$CI_PROJECT_DIR/build"
- ctest --output-on-failure --timeout 15
- cmake --install "$CI_PROJECT_DIR/build" --prefix "$CI_PROJECT_DIR/install"
needs: []
test:windows-rocm-cmake:
extends:
- .test:windows-rocm
- .test:windows-cmake
script:
- cmake
-S "$CI_PROJECT_DIR"
-B "$CI_PROJECT_DIR/build"
-G Ninja
-D CMAKE_CXX_COMPILER:PATH="${env:HIP_PATH}\bin\clang++.exe"
-D CMAKE_HIP_COMPILER:PATH="${env:HIP_PATH}\bin\clang++.exe"
-D CMAKE_HIP_LINK_EXECUTABLE:PATH="${env:HIP_PATH}\bin\lld-link.exe"
-D CMAKE_CXX_FLAGS="$CXX_FLAGS"
-D CMAKE_PREFIX_PATH:PATH="${env:HIP_PATH}"
-D CMAKE_HIP_FLAGS="$HIP_FLAGS"
-D CMAKE_BUILD_TYPE="$BUILD_TYPE"
-D CMAKE_HIP_ARCHITECTURES=gfx1030
-D CMAKE_TOOLCHAIN_FILE:PATH="C:\Tools\Microsoft\vcpkg\scripts\buildsystems\vcpkg.cmake"
2>&1 | Tee-Object -filepath cmake_log.txt
- !reference [.test:windows-cmake, script]
test:windows-nvcc-cmake:
extends:
- .test:windows-nvcc
- .test:windows-cmake
script:
# Note: The current version of the HIP SDK does not ship with CMake config files for Nvidia, so we can only test
# the HIP-Basic and Applications examples. It is expected that some dependencies will not be found for this.
- cmake
-S "$CI_PROJECT_DIR"
-B "$CI_PROJECT_DIR/build"
-G Ninja
-D CMAKE_TOOLCHAIN_FILE="C:/Tools/Microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_BUILD_TYPE="$BUILD_TYPE"
-D CMAKE_CXX_COMPILER="cl.exe"
-D GPU_RUNTIME=CUDA
2>&1 | Tee-Object -filepath cmake_log.txt
- !reference [.test:windows-cmake, script]