forked from ROCm/MIOpen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
454 lines (406 loc) · 17.3 KB
/
Jenkinsfile
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
442
443
444
445
446
447
448
449
450
451
452
453
def rocmnode(name) {
def node_name = 'rocmtest'
if(name == 'fiji') {
node_name = 'rocmtest && fiji';
} else if(name == 'vega') {
node_name = 'rocmtest && vega';
} else if(name == 'vega10') {
node_name = 'rocmtest && vega10';
} else if(name == 'vega20') {
node_name = 'rocmtest && vega20';
} else if(name == 'gfx908') {
node_name = 'gfx908';
} else {
node_name = name
}
return node_name
}
def cmake_build(compiler, flags, prefixpath="/opt/rocm"){
def workspace_dir = pwd()
def vcache = "/var/jenkins/.cache/miopen/vcache"
def archive = (flags == '-DCMAKE_BUILD_TYPE=release')
def config_targets = "check doc MIOpenDriver"
def test_flags = "--disable-verification-cache"
def debug_flags = "-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined"
def compilerpath = ""
def configargs = ""
if (prefixpath == "")
compilerpath = compiler;
else
{
compilerpath = prefixpath + "/bin/" + compiler
configargs = "-DCMAKE_PREFIX_PATH=${prefixpath}"
}
if (archive == true) {
config_targets = "package"
}
def cmd = """
echo \$HSA_ENABLE_SDMA
ulimit -c unlimited
rm -rf build
mkdir build
cd build
CXX=${compilerpath} CXXFLAGS='-Werror' cmake ${configargs} -DMIOPEN_GPU_SYNC=On -DMIOPEN_TEST_FLAGS='${test_flags}' -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}' ${flags} ..
MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS=1 CTEST_PARALLEL_LEVEL=4 MIOPEN_VERIFY_CACHE_PATH=${vcache} MIOPEN_CONV_PRECISE_ROCBLAS_TIMING=0 dumb-init make -j\$(nproc) ${config_targets}
"""
echo cmd
sh cmd
// Only archive from master or develop
if (archive == true && (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master")) {
archiveArtifacts artifacts: "build/*.deb", allowEmptyArchive: true, fingerprint: true
}
}
def buildJob(compiler, flags, image, prefixpath="/opt/rocm", cmd = ""){
env.HSA_ENABLE_SDMA=0
checkout scm
def dockerOpts="--device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined"
def dockerArgs = "--build-arg PREFIX=${prefixpath} "
if(prefixpath == "")
{
dockerArgs = ""
}
def retimage
try {
retimage = docker.build("${image}", dockerArgs + '.')
withDockerContainer(image: image, args: dockerOpts) {
timeout(time: 5, unit: 'MINUTES')
{
sh 'PATH="/opt/rocm/opencl/bin/x86_64/:$PATH" clinfo'
}
}
} catch(Exception ex) {
retimage = docker.build("${image}", dockerArgs + "--no-cache .")
withDockerContainer(image: image, args: dockerOpts) {
timeout(time: 5, unit: 'MINUTES')
{
sh 'PATH="/opt/rocm/opencl/bin/x86_64/:$PATH" clinfo'
}
}
}
withDockerContainer(image: image, args: dockerOpts + ' -v=/var/jenkins/:/var/jenkins') {
timeout(time: 5, unit: 'HOURS')
{
if(cmd == ""){
cmake_build(compiler, flags, prefixpath)
}else{
sh cmd
}
}
}
return retimage
}
def buildHipClangJob(compiler, flags, image, prefixpath="/opt/rocm", cmd = ""){
env.HSA_ENABLE_SDMA=0
checkout scm
def dockerOpts="--device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined"
def dockerArgs = "--build-arg PREFIX=${prefixpath} -f hip-clang.docker "
def retimage
try {
retimage = docker.build("${image}", dockerArgs + '.')
withDockerContainer(image: image, args: dockerOpts) {
timeout(time: 5, unit: 'MINUTES')
{
sh 'PATH="/opt/rocm/opencl/bin:/opt/rocm/opencl/bin/x86_64:$PATH" clinfo'
}
}
} catch(Exception ex) {
retimage = docker.build("${image}", dockerArgs + "--no-cache .")
withDockerContainer(image: image, args: dockerOpts) {
timeout(time: 5, unit: 'MINUTES')
{
sh 'PATH="/opt/rocm/opencl/bin:/opt/rocm/opencl/bin/x86_64:$PATH" clinfo'
}
}
}
withDockerContainer(image: image, args: dockerOpts + ' -v=/var/jenkins/:/var/jenkins') {
timeout(time: 5, unit: 'HOURS')
{
if(cmd == ""){
cmake_build(compiler, flags, prefixpath)
}else{
sh cmd
}
}
}
return retimage
}
pipeline {
agent none
options {
parallelsAlwaysFailFast()
}
environment{
image = "miopen"
}
stages{
// Run all static analysis tests
stage("Static checks"){
parallel{
stage('Clang Tidy') {
agent{ label rocmnode("rocmtest") }
environment{
cmd = "rm -rf build; mkdir build; cd build; CXX='clang++-3.8' cmake -DBUILD_DEV=On ..; make -j\$(nproc) -k analyze;"
}
steps{
buildJob('hcc', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}
stage('Clang Format') {
agent{ label rocmnode("rocmtest") }
environment{
cmd = "find . -iname \'*.h\' \
-o -iname \'*.hpp\' \
-o -iname \'*.cpp\' \
-o -iname \'*.h.in\' \
-o -iname \'*.hpp.in\' \
-o -iname \'*.cpp.in\' \
-o -iname \'*.cl\' \
| grep -v 'build/' \
| xargs -n 1 -P 1 -I{} -t sh -c \'clang-format-3.8 -style=file {} | diff - {}\'"
}
steps{
buildJob('hcc', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}
stage('Hip Tidy') {
agent{ label rocmnode("rocmtest") }
environment{
cmd = "rm -rf build; mkdir build; cd build; CXX=/usr/local/bin/hcc cmake -DBUILD_DEV=On ..; make -j\$(nproc) -k analyze;"
}
steps{
buildJob('hcc', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}
}
}
// Run quick fp32 tests
stage("Fast full precision"){
parallel{
stage('Clang Debug') {
agent{ label rocmnode("vega") }
steps{
buildJob('clang++-3.8', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image, "")
}
}
stage('Clang Release') {
agent{ label rocmnode("vega") }
steps{
buildJob('clang++-3.8', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage('GCC Debug') {
agent{ label rocmnode("vega") }
steps{
buildJob('g++-5', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image, "")
}
}
stage('GCC Release') {
agent{ label rocmnode("vega") }
steps{
buildJob('g++-5', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage('Fiji GCC Debug') {
agent{ label rocmnode("fiji") }
steps{
buildJob('g++-5', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image, "")
}
}
/*stage('gfx908 GCC Debug') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('g++-5', '-DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image, "")
}
}*/
stage('Hip Release') {
agent{ label rocmnode("vega") }
steps{
buildJob('hcc', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Hip Release on /usr/local') {
agent{ label rocmnode("vega") }
steps{
buildJob('hcc', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage('Hip Static Release on /usr/local') {
agent{ label rocmnode("vega") }
steps{
buildJob('hcc', '-DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=On', image, "")
}
}
stage('Hip clang debug') {
agent{ label rocmnode("vega") }
environment{
cmd = """
ulimit -c unlimited
rm -rf build
mkdir build
cd build
CXX=/opt/rocm/llvm/bin/clang++ cmake -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug -DMIOPEN_GPU_SYNC=On -DMIOPEN_TEST_FLAGS=--disable-verification-cache ..
CTEST_PARALLEL_LEVEL=4 MIOPEN_DEBUG_IMPLICIT_GEMM_NON_XDLOPS_INLINE_ASM=0 MIOPEN_CONV_PRECISE_ROCBLAS_TIMING=0 make -j\$(nproc) check
"""
}
steps{
buildHipClangJob('/opt/rocm/llvm/bin/clang++', '', image+'-hip-clang', "/usr/local", cmd)
}
}
stage('gfx908 Hip debug') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image + "rocm")
}
}
}
}
// Run fp16, bfp16, and int8 quick tests
stage("Fast low precision"){
parallel{
stage('Half Hip Release') {
agent{ label rocmnode("vega20") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_HALF=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Half GCC Debug') {
agent{ label rocmnode("vega20") }
steps{
buildJob('g++-5', '-DMIOPEN_TEST_HALF=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image, "")
}
}
stage('Half GCC Release') {
agent{ label rocmnode("vega20") }
steps{
buildJob('g++-5', '-DMIOPEN_TEST_HALF=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage('Int8 Hip Release') {
agent{ label rocmnode("vega20") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_INT8=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Int8 GCC Debug') {
agent{ label rocmnode("vega20") }
steps{
buildJob('g++-5', '-DMIOPEN_TEST_INT8=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image, "")
}
}
stage('Int8 GCC Release') {
agent{ label rocmnode("vega20") }
steps{
buildJob('g++-5', '-DMIOPEN_TEST_INT8=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage('Bfloat16 Hip Release') {
agent{ label rocmnode("vega20") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_BFLOAT16=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Bfloat16 gfx908 Hip Debug') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_BFLOAT16=On -DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image + "rocm")
}
}
stage('Half gfx908 Hip Debug') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_BFLOAT16=On -DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=debug', image + "rocm")
}
}
}
}
stage("Full short tests"){
parallel{
stage('Int8 Hip Release All') {
agent{ label rocmnode("vega20") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_INT8=On -DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Bfloat16 Hip Release All') {
agent{ label rocmnode("vega20") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_BFLOAT16=On -DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
}
}
stage("Full long tests"){
parallel{
stage('GCC Release All') {
agent{ label rocmnode("vega") }
steps{
buildJob('g++-5', '-DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage('Hip Release All') {
agent{ label rocmnode("vega") }
steps{
buildJob('hcc', '-DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Half Hip Release All') {
agent{ label rocmnode("vega20") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_HALF=On -DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('FP32 gfx908 Hip Debug All subset') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Bfloat16 gfx908 Hip Release All Subset') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_BFLOAT16=On -DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Half gfx908 Hip Release All Subset') {
agent{ label rocmnode("gfx908") }
steps{
buildJob('hcc', '-DMIOPEN_TEST_HALF=On -DMIOPEN_TEST_GFX908=On -DBUILD_DEV=On -DMIOPEN_TEST_ALL=On -DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
stage('Hip Clang Release All') {
agent{ label rocmnode("vega20") }
environment{
cmd = """
ulimit -c unlimited
rm -rf build
mkdir build
cd build
CXX=/opt/rocm/llvm/bin/clang++ cmake -DBUILD_DEV=On -DCMAKE_BUILD_TYPE=release -DMIOPEN_GPU_SYNC=On -DMIOPEN_TEST_ALL=On -DMIOPEN_TEST_FLAGS=--disable-verification-cache ..
CTEST_PARALLEL_LEVEL=4 MIOPEN_DEBUG_IMPLICIT_GEMM_NON_XDLOPS_INLINE_ASM=0 MIOPEN_CONV_PRECISE_ROCBLAS_TIMING=0 make -j\$(nproc) check
"""
}
steps{
buildHipClangJob('/opt/rocm/llvm/bin/clang++', '', image+'-hip-clang', "/usr/local", cmd)
}
}
}
}
// Run package building
stage("Packages"){
parallel {
stage('GCC OpenCL Release package') {
agent{ label rocmnode("rocmtest") }
steps{
buildJob('g++-5', '-DCMAKE_BUILD_TYPE=release', image, "")
}
}
stage("HCC HIP Release package"){
agent{ label rocmnode("rocmtest") }
steps{
buildJob('hcc', '-DCMAKE_BUILD_TYPE=release', image + "rocm")
}
}
}
}
}
}