-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
executable file
·1403 lines (1355 loc) · 43.7 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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!groovy
// -*- mode: groovy -*-
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// Jenkins pipeline
// See documents at https://jenkins.io/doc/book/pipeline/jenkinsfile/
// Docker env used for testing
// Different image may have different version tag
// because some of them are more stable than anoter.
//
// Docker images are maintained by PMC, cached in dockerhub
// and remains relatively stable over the time.
// Flow for upgrading docker env(need commiter)
//
// - Send PR to upgrade build script in the repo
// - Build the new docker image
// - Tag the docker image with a new version and push to a binary cache.
// - Update the version in the Jenkinsfile, send a PR
// - Fix any issues wrt to the new image version in the PR
// - Merge the PR and now we are in new version
// - Tag the new version as the lates
// - Periodically cleanup the old versions on local workers
//
// ============================= IMPORTANT NOTE =============================
// This file is generated by 'jenkins/generate.py'. Do not edit this file directly!
// Make edits to 'jenkins/Jenkinsfile.j2' and regenerate this with
// 'python3 jenkins/generate.py'
// Note: This timestamp is here to ensure that updates to the Jenkinsfile are
// always rebased on main before merging:
// Generated at 2022-04-30T10:10:58.528075
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
// NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. -->
ci_lint = 'tlcpack/ci-lint:v0.71'
ci_gpu = 'tlcpack/ci-gpu:v0.87'
ci_cpu = 'tlcpack/ci-cpu:v0.84'
ci_wasm = 'tlcpack/ci-wasm:v0.73'
ci_i386 = 'tlcpack/ci-i386:v0.77'
ci_qemu = 'tlcpack/ci-qemu:v0.13'
ci_arm = 'tlcpack/ci-arm:v0.10'
ci_hexagon = 'tlcpack/ci-hexagon:v0.03'
// <--- End of regex-scanned config.
// Parameters to allow overriding (in Jenkins UI), the images
// to be used by a given build. When provided, they take precedence
// over default values above.
properties([
parameters([
string(name: 'ci_arm_param', defaultValue: ''),
string(name: 'ci_cpu_param', defaultValue: ''),
string(name: 'ci_gpu_param', defaultValue: ''),
string(name: 'ci_hexagon_param', defaultValue: ''),
string(name: 'ci_i386_param', defaultValue: ''),
string(name: 'ci_lint_param', defaultValue: ''),
string(name: 'ci_qemu_param', defaultValue: ''),
string(name: 'ci_wasm_param', defaultValue: ''),
])
])
// Global variable assigned during Sanity Check that holds the sha1 which should be
// merged into the PR in all branches.
upstream_revision = null
// command to start a docker container
docker_run = 'docker/bash.sh --env CI --env TVM_SHARD_INDEX --env TVM_NUM_SHARDS --env RUN_DISPLAY_URL --env PLATFORM'
docker_build = 'docker/build.sh'
// timeout in minutes
max_time = 120
rebuild_docker_images = false
def per_exec_ws(folder) {
return "workspace/exec_${env.EXECUTOR_NUMBER}/" + folder
}
// initialize source codes
def init_git() {
checkout scm
// Add more info about job node
sh (
script: './tests/scripts/task_show_node_info.sh',
label: 'Show executor node info',
)
// Determine merge commit to use for all stages
sh(
script: 'git fetch origin main',
label: 'Fetch upstream',
)
if (upstream_revision == null) {
upstream_revision = sh(
script: 'git log -1 FETCH_HEAD --format=\'%H\'',
label: 'Determine upstream revision',
returnStdout: true,
).trim()
}
sh (
script: "git -c user.name=TVM-Jenkins -c [email protected] merge ${upstream_revision}",
label: 'Merge to origin/main'
)
retry(5) {
timeout(time: 2, unit: 'MINUTES') {
sh (script: 'git submodule update --init -f', label: 'Update git submodules')
}
}
}
def should_skip_slow_tests(pr_number) {
withCredentials([string(
credentialsId: 'tvm-bot-jenkins-reader',
variable: 'GITHUB_TOKEN',
)]) {
// Exit code of 1 means run slow tests, exit code of 0 means skip slow tests
result = sh (
returnStatus: true,
script: "./tests/scripts/should_run_slow_tests.py --pr '${pr_number}'",
label: 'Check if CI should run slow tests',
)
}
return result == 0
}
def cancel_previous_build() {
// cancel previous build if it is not on main.
if (env.BRANCH_NAME != 'main') {
def buildNumber = env.BUILD_NUMBER as int
// Milestone API allows us to cancel previous build
// with the same milestone number
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
}
}
def should_skip_ci(pr_number) {
if (env.BRANCH_NAME == null || !env.BRANCH_NAME.startsWith('PR-')) {
// never skip CI on build sourced from a branch
return false
}
glob_skip_ci_code = sh (
returnStatus: true,
script: "./tests/scripts/git_skip_ci_globs.py",
label: 'Check if CI should be skipped due to changed files',
)
if (glob_skip_ci_code == 0) {
return true
}
withCredentials([string(
credentialsId: 'tvm-bot-jenkins-reader',
variable: 'TOKEN',
)]) {
// Exit code of 1 means run full CI (or the script had an error, so run
// full CI just in case). Exit code of 0 means skip CI.
git_skip_ci_code = sh (
returnStatus: true,
script: "./tests/scripts/git_skip_ci.py --pr '${pr_number}'",
label: 'Check if CI should be skipped',
)
}
return git_skip_ci_code == 0
}
// skips builds from branch indexing; sourced from https://www.jvt.me/posts/2020/02/23/jenkins-multibranch-skip-branch-index/
// execute this before anything else, including requesting any time on an agent
if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
print "INFO: Build skipped due to trigger being Branch Indexing"
currentBuild.result = 'ABORTED' // optional, gives a better hint to the user that it's been skipped, rather than the default which shows it's successful
return
}
cancel_previous_build()
def lint() {
stage('Lint') {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
ci_lint = params.ci_lint_param ?: ci_lint
ci_cpu = params.ci_cpu_param ?: ci_cpu
ci_gpu = params.ci_gpu_param ?: ci_gpu
ci_wasm = params.ci_wasm_param ?: ci_wasm
ci_i386 = params.ci_i386_param ?: ci_i386
ci_qemu = params.ci_qemu_param ?: ci_qemu
ci_arm = params.ci_arm_param ?: ci_arm
ci_hexagon = params.ci_hexagon_param ?: ci_hexagon
sh (script: """
echo "Docker images being used in this build:"
echo " ci_lint = ${ci_lint}"
echo " ci_cpu = ${ci_cpu}"
echo " ci_gpu = ${ci_gpu}"
echo " ci_wasm = ${ci_wasm}"
echo " ci_i386 = ${ci_i386}"
echo " ci_qemu = ${ci_qemu}"
echo " ci_arm = ${ci_arm}"
echo " ci_hexagon = ${ci_hexagon}"
""", label: 'Docker image names')
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/sanity") {
init_git()
is_docs_only_build = sh (
returnStatus: true,
script: './tests/scripts/git_change_docs.sh',
label: 'Check for docs only changes',
)
skip_ci = should_skip_ci(env.CHANGE_ID)
skip_slow_tests = should_skip_slow_tests(env.CHANGE_ID)
rebuild_docker_images = sh (
returnStatus: true,
script: './tests/scripts/git_change_docker.sh',
label: 'Check for any docker changes',
)
if (skip_ci) {
// Don't rebuild when skipping CI
rebuild_docker_images = false
}
if (rebuild_docker_images) {
// Exit before linting so we can use the newly created Docker images
// to run the lint
return
}
sh (
script: "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh",
label: 'Run lint',
)
}
}
}
}
}
// [note: method size]
// This has to be extracted into a method due to JVM limitations on the size of
// a method (so the code can't all be inlined)
lint()
def build_image(image_name) {
hash = sh(
returnStdout: true,
script: 'git log -1 --format=\'%h\''
).trim()
def full_name = "${image_name}:${env.BRANCH_NAME}-${hash}-${env.BUILD_NUMBER}"
sh(
script: "${docker_build} ${image_name} --spec ${full_name}",
label: 'Build docker image'
)
aws_account_id = sh(
returnStdout: true,
script: 'aws sts get-caller-identity | grep Account | cut -f4 -d\\"',
label: 'Get AWS ID'
).trim()
try {
// Use a credential so Jenkins knows to scrub the AWS account ID which is nice
// (but so we don't have to rely it being hardcoded in Jenkins)
withCredentials([string(
credentialsId: 'aws-account-id',
variable: '_ACCOUNT_ID_DO_NOT_USE',
)]) {
withEnv([
"AWS_ACCOUNT_ID=${aws_account_id}",
'AWS_DEFAULT_REGION=us-west-2']) {
sh(
script: '''
set -x
aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
''',
label: 'Log in to ECR'
)
sh(
script: """
set -x
docker tag ${full_name} \$AWS_ACCOUNT_ID.dkr.ecr.\$AWS_DEFAULT_REGION.amazonaws.com/${full_name}
docker push \$AWS_ACCOUNT_ID.dkr.ecr.\$AWS_DEFAULT_REGION.amazonaws.com/${full_name}
""",
label: 'Upload image to ECR'
)
}
}
} finally {
sh(
script: 'rm -f ~/.docker/config.json',
label: 'Clean up login credentials'
)
}
sh(
script: "docker rmi ${full_name}",
label: 'Remove docker image'
)
}
if (rebuild_docker_images) {
stage('Docker Image Build') {
// TODO in a follow up PR: Find ecr tag and use in subsequent builds
parallel 'ci-lint': {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_lint')
}
}
}, 'ci-cpu': {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_cpu')
}
}
}, 'ci-gpu': {
node('GPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_gpu')
}
}
}, 'ci-qemu': {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_qemu')
}
}
}, 'ci-i386': {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_i386')
}
}
}, 'ci-arm': {
node('ARM') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_arm')
}
}
}, 'ci-wasm': {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_wasm')
}
}
}, 'ci-hexagon': {
node('CPU') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
build_image('ci_hexagon')
}
}
}
}
// // TODO: Once we are able to use the built images, enable this step
// // If the docker images changed, we need to run the image build before the lint
// // can run since it requires a base docker image. Most of the time the images
// // aren't build though so it's faster to use the same node that checks for
// // docker changes to run the lint in the usual case.
// stage('Sanity Check (re-run)') {
// timeout(time: max_time, unit: 'MINUTES') {
// node('CPU') {
// ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/sanity") {
// init_git()
// sh (
// script: "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh",
// label: 'Run lint',
// )
// }
// }
// }
// }
}
// Run make. First try to do an incremental make from a previous workspace in hope to
// accelerate the compilation. If something is wrong, clean the workspace and then
// build from scratch.
def make(docker_type, path, make_flag) {
timeout(time: max_time, unit: 'MINUTES') {
try {
cmake_build(docker_type, path, make_flag)
// always run cpp test when build
} catch (hudson.AbortException ae) {
// script exited due to user abort, directly throw instead of retry
if (ae.getMessage().contains('script returned exit code 143')) {
throw ae
}
echo 'Incremental compilation failed. Fall back to build from scratch'
sh (
script: "${docker_run} ${docker_type} ./tests/scripts/task_clean.sh ${path}",
label: 'Clear old cmake workspace',
)
cmake_build(docker_type, path, make_flag)
}
}
}
// Specifications to Jenkins "stash" command for use with various pack_ and unpack_ functions.
tvm_runtime = 'build/libtvm_runtime.so, build/config.cmake' // use libtvm_runtime.so.
tvm_lib = 'build/libtvm.so, ' + tvm_runtime // use libtvm.so to run the full compiler.
// LLVM upstream lib
tvm_multilib = 'build/libtvm.so, ' +
'build/libvta_fsim.so, ' +
tvm_runtime
tvm_multilib_tsim = 'build/libvta_tsim.so, ' +
tvm_multilib
microtvm_tar_gz = 'build/microtvm_template_projects.tar.gz'
// pack libraries for later use
def pack_lib(name, libs) {
sh (script: """
echo "Packing ${libs} into ${name}"
echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
""", label: 'Stash libraries and show md5')
stash includes: libs, name: name
}
// unpack libraries saved before
def unpack_lib(name, libs) {
unstash name
sh (script: """
echo "Unpacked ${libs} from ${name}"
echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
""", label: 'Unstash libraries and show md5')
}
// compress microtvm template projects and pack the tar.
def pack_microtvm_template_projects(name) {
sh(
script: 'cd build && tar -czvf microtvm_template_projects.tar.gz microtvm_template_projects/',
label: 'Compress microtvm_template_projects'
)
pack_lib(name + '-microtvm-libs', microtvm_tar_gz)
}
def unpack_microtvm_template_projects(name) {
unpack_lib(name + '-microtvm-libs', microtvm_tar_gz)
sh(
script: 'cd build && tar -xzvf microtvm_template_projects.tar.gz',
label: 'Unpack microtvm_template_projects'
)
}
def ci_setup(image) {
sh (
script: "${docker_run} ${image} ./tests/scripts/task_ci_setup.sh",
label: 'Set up CI environment',
)
}
def python_unittest(image) {
sh (
script: "${docker_run} ${image} ./tests/scripts/task_python_unittest.sh",
label: 'Run Python unit tests',
)
}
def fsim_test(image) {
sh (
script: "${docker_run} ${image} ./tests/scripts/task_python_vta_fsim.sh",
label: 'Run VTA tests in FSIM',
)
}
def cmake_build(image, path, make_flag) {
sh (
script: "${docker_run} --env CI_NUM_EXECUTORS ${image} ./tests/scripts/task_build.py --sccache-bucket tvm-sccache-prod",
label: 'Run cmake build',
)
}
def cpp_unittest(image) {
sh (
script: "${docker_run} --env CI_NUM_EXECUTORS ${image} ./tests/scripts/task_cpp_unittest.sh",
label: 'Build and run C++ tests',
)
}
def build() {
stage('Build') {
environment {
SKIP_SLOW_TESTS = "${skip_slow_tests}"
}
parallel 'BUILD: GPU': {
if (!skip_ci) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-gpu") {
init_git()
sh "${docker_run} --no-gpu ${ci_gpu} ./tests/scripts/task_config_build_gpu.sh build"
make("${ci_gpu} --no-gpu", 'build', '-j2')
pack_lib('gpu', tvm_multilib)
pack_microtvm_template_projects('gpu')
// compiler test
sh "${docker_run} --no-gpu ${ci_gpu} ./tests/scripts/task_config_build_gpu_other.sh build2"
make("${ci_gpu} --no-gpu", 'build2', '-j2')
pack_lib('gpu2', tvm_multilib)
}
}
}
},
'BUILD: CPU': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-cpu") {
init_git()
sh (
script: "${docker_run} ${ci_cpu} ./tests/scripts/task_config_build_cpu.sh build",
label: 'Create CPU cmake config',
)
make(ci_cpu, 'build', '-j2')
pack_lib('cpu', tvm_multilib_tsim)
timeout(time: max_time, unit: 'MINUTES') {
ci_setup(ci_cpu)
// sh "${docker_run} ${ci_cpu} ./tests/scripts/task_golang.sh"
// TODO(@jroesch): need to resolve CI issue will turn back on in follow up patch
sh (script: "${docker_run} ${ci_cpu} ./tests/scripts/task_rust.sh", label: 'Rust build and test')
}
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: CPU')
}
},
'BUILD: WASM': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-wasm") {
init_git()
sh (
script: "${docker_run} ${ci_wasm} ./tests/scripts/task_config_build_wasm.sh build",
label: 'Create WASM cmake config',
)
make(ci_wasm, 'build', '-j2')
cpp_unittest(ci_wasm)
timeout(time: max_time, unit: 'MINUTES') {
ci_setup(ci_wasm)
sh (
script: "${docker_run} ${ci_wasm} ./tests/scripts/task_web_wasm.sh",
label: 'Run WASM lint and tests',
)
}
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: WASM')
}
},
'BUILD: i386': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-i386") {
init_git()
sh (
script: "${docker_run} ${ci_i386} ./tests/scripts/task_config_build_i386.sh build",
label: 'Create i386 cmake config',
)
make(ci_i386, 'build', '-j2')
pack_lib('i386', tvm_multilib_tsim)
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: i386')
}
},
'BUILD: arm': {
if (!skip_ci && is_docs_only_build != 1) {
node('ARM') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-arm") {
init_git()
sh (
script: "${docker_run} ${ci_arm} ./tests/scripts/task_config_build_arm.sh build",
label: 'Create ARM cmake config',
)
make(ci_arm, 'build', '-j4')
pack_lib('arm', tvm_multilib)
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: arm')
}
},
'BUILD: QEMU': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-qemu") {
init_git()
sh (
script: "${docker_run} ${ci_qemu} ./tests/scripts/task_config_build_qemu.sh build",
label: 'Create QEMU cmake config',
)
make(ci_qemu, 'build', '-j2')
pack_lib('qemu', tvm_lib)
pack_microtvm_template_projects('qemu')
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: QEMU')
}
},
'BUILD: Hexagon': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-hexagon") {
init_git()
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_config_build_hexagon.sh build",
label: 'Create Hexagon cmake config',
)
make(ci_hexagon, 'build', '-j2')
pack_lib('hexagon', tvm_lib)
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: Hexagon')
}
}
}
}
// [note: method size]
build()
def test() {
stage('Test') {
environment {
SKIP_SLOW_TESTS = "${skip_slow_tests}"
}
parallel(
'unittest: GPU 1 of 2': {
if (!skip_ci && is_docs_only_build != 1) {
node('GPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/ut-python-gpu") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=gpu',
'TVM_NUM_SHARDS=2',
'TVM_SHARD_INDEX=0'], {
unpack_lib('gpu2', tvm_multilib)
cpp_unittest(ci_gpu)
unpack_lib('gpu', tvm_multilib)
ci_setup(ci_gpu)
cpp_unittest(ci_gpu)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_java_unittest.sh",
label: 'Run Java unit tests',
)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh",
label: 'Run Python GPU unit tests',
)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration_gpuonly.sh",
label: 'Run Python GPU integration tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('unittest: GPU 1 of 2')
}
},
'unittest: GPU 2 of 2': {
if (!skip_ci && is_docs_only_build != 1) {
node('GPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/ut-python-gpu") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=gpu',
'TVM_NUM_SHARDS=2',
'TVM_SHARD_INDEX=1'], {
unpack_lib('gpu2', tvm_multilib)
cpp_unittest(ci_gpu)
unpack_lib('gpu', tvm_multilib)
ci_setup(ci_gpu)
cpp_unittest(ci_gpu)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_java_unittest.sh",
label: 'Run Java unit tests',
)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh",
label: 'Run Python GPU unit tests',
)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration_gpuonly.sh",
label: 'Run Python GPU integration tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('unittest: GPU 2 of 2')
}
},
'integration: CPU 1 of 2': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/integration-python-cpu") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=cpu',
'TVM_NUM_SHARDS=2',
'TVM_SHARD_INDEX=0'], {
unpack_lib('cpu', tvm_multilib_tsim)
ci_setup(ci_cpu)
sh (
script: "${docker_run} ${ci_cpu} ./tests/scripts/task_python_integration.sh",
label: 'Run CPU integration tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('integration: CPU 1 of 2')
}
},
'integration: CPU 2 of 2': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/integration-python-cpu") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=cpu',
'TVM_NUM_SHARDS=2',
'TVM_SHARD_INDEX=1'], {
unpack_lib('cpu', tvm_multilib_tsim)
ci_setup(ci_cpu)
sh (
script: "${docker_run} ${ci_cpu} ./tests/scripts/task_python_integration.sh",
label: 'Run CPU integration tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('integration: CPU 2 of 2')
}
},
'unittest: CPU': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/ut-python-cpu") {
timeout(time: max_time, unit: 'MINUTES') {
try {
init_git()
withEnv(['PLATFORM=cpu'], {
unpack_lib('cpu', tvm_multilib_tsim)
ci_setup(ci_cpu)
cpp_unittest(ci_cpu)
python_unittest(ci_cpu)
fsim_test(ci_cpu)
sh (
script: "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_tsim.sh",
label: 'Run VTA tests in TSIM',
)
})
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
}
} else {
Utils.markStageSkippedForConditional('unittest: CPU')
}
},
'python: i386 1 of 2': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/integration-python-i386") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=i386',
'TVM_NUM_SHARDS=2',
'TVM_SHARD_INDEX=0'], {
unpack_lib('i386', tvm_multilib)
ci_setup(ci_i386)
cpp_unittest(ci_i386)
python_unittest(ci_i386)
sh (
script: "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration_i386only.sh",
label: 'Run i386 integration tests',
)
fsim_test(ci_i386)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('python: i386 1 of 2')
}
},
'python: i386 2 of 2': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/integration-python-i386") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=i386',
'TVM_NUM_SHARDS=2',
'TVM_SHARD_INDEX=1'], {
unpack_lib('i386', tvm_multilib)
ci_setup(ci_i386)
cpp_unittest(ci_i386)
python_unittest(ci_i386)
sh (
script: "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration_i386only.sh",
label: 'Run i386 integration tests',
)
fsim_test(ci_i386)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('python: i386 2 of 2')
}
},
'test: Hexagon 1 of 4': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/test-hexagon") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=hexagon',
'TVM_NUM_SHARDS=4',
'TVM_SHARD_INDEX=0'], {
unpack_lib('hexagon', tvm_lib)
ci_setup(ci_hexagon)
cpp_unittest(ci_hexagon)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_build_hexagon_api.sh",
label: 'Build Hexagon API',
)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh",
label: 'Run Hexagon tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('test: Hexagon 1 of 4')
}
},
'test: Hexagon 2 of 4': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/test-hexagon") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=hexagon',
'TVM_NUM_SHARDS=4',
'TVM_SHARD_INDEX=1'], {
unpack_lib('hexagon', tvm_lib)
ci_setup(ci_hexagon)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_build_hexagon_api.sh",
label: 'Build Hexagon API',
)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh",
label: 'Run Hexagon tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('test: Hexagon 2 of 4')
}
},
'test: Hexagon 3 of 4': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/test-hexagon") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=hexagon',
'TVM_NUM_SHARDS=4',
'TVM_SHARD_INDEX=2'], {
unpack_lib('hexagon', tvm_lib)
ci_setup(ci_hexagon)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_build_hexagon_api.sh",
label: 'Build Hexagon API',
)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh",
label: 'Run Hexagon tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('test: Hexagon 3 of 4')
}
},
'test: Hexagon 4 of 4': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU') {
ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/test-hexagon") {
try {
init_git()
timeout(time: max_time, unit: 'MINUTES') {
withEnv([
'PLATFORM=hexagon',
'TVM_NUM_SHARDS=4',
'TVM_SHARD_INDEX=3'], {
unpack_lib('hexagon', tvm_lib)
ci_setup(ci_hexagon)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_build_hexagon_api.sh",
label: 'Build Hexagon API',
)
sh (
script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh",
label: 'Run Hexagon tests',
)
})
}
} finally {
junit 'build/pytest-results/*.xml'
}
}
}
} else {
Utils.markStageSkippedForConditional('test: Hexagon 4 of 4')
}
},
'test: QEMU': {