From 13f15fa5a470a0d32a147def1b763a0e246fa897 Mon Sep 17 00:00:00 2001 From: Lunderberg Date: Tue, 28 Sep 2021 16:29:43 -0500 Subject: [PATCH] [UnitTests] Enable minimum testing on Vulkan target in CI (#9093) * [UnitTests] Enable minimum testing on Vulkan target in CI - Include the Vulkan runtime in the GPU build. - Run test_target_codegen_vulkan.py as part of the `python3: GPU` CI step. * [CI] Added a dummy task_config_build_gpu_vulkan.sh, to be removed later. The CI builds use the Jenkinsfile located in the ci-docker-staging branch, but the scripts in the PR that is being run. Temporarily adding back a task_config_build_gpu_vulkan.sh, which just calls the renamed task_config_build_gpu_other.sh. --- Jenkinsfile | 2 +- tests/scripts/task_config_build_gpu.sh | 1 + tests/scripts/task_config_build_gpu_other.sh | 35 +++++++++++++++++++ tests/scripts/task_config_build_gpu_vulkan.sh | 21 +++++------ .../task_python_integration_gpuonly.sh | 2 +- tests/scripts/task_python_unittest_gpuonly.sh | 18 ++++++++-- 6 files changed, 62 insertions(+), 17 deletions(-) create mode 100755 tests/scripts/task_config_build_gpu_other.sh diff --git a/Jenkinsfile b/Jenkinsfile index 647c696246e9..15f72e04563c 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -209,7 +209,7 @@ stage('Build') { make(ci_gpu, 'build', '-j2') pack_lib('gpu', tvm_multilib) // compiler test - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_gpu_vulkan.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_gpu_other.sh" make(ci_gpu, 'build2', '-j2') } } diff --git a/tests/scripts/task_config_build_gpu.sh b/tests/scripts/task_config_build_gpu.sh index 5f86476c64c7..3a429721709e 100755 --- a/tests/scripts/task_config_build_gpu.sh +++ b/tests/scripts/task_config_build_gpu.sh @@ -26,6 +26,7 @@ cp ../cmake/config.cmake . echo set\(USE_CUBLAS ON\) >> config.cmake echo set\(USE_CUDNN ON\) >> config.cmake echo set\(USE_CUDA ON\) >> config.cmake +echo set\(USE_VULKAN ON\) >> config.cmake echo set\(USE_OPENGL ON\) >> config.cmake echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake diff --git a/tests/scripts/task_config_build_gpu_other.sh b/tests/scripts/task_config_build_gpu_other.sh new file mode 100755 index 000000000000..c11669a2ab0d --- /dev/null +++ b/tests/scripts/task_config_build_gpu_other.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# 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. + +# This file is a compiler test to ensure that runtimes can compile +# correctly, even if they aren't actively tested in the CI. + +set -e +set -u + +mkdir -p build2 +cd build2 +cp ../cmake/config.cmake . + +echo set\(USE_OPENCL ON\) >> config.cmake +echo set\(USE_ROCM ON\) >> config.cmake +echo set\(USE_MICRO ON\) >> config.cmake +echo set\(USE_PROFILER ON\) >> config.cmake +echo set\(USE_LIBBACKTRACE OFF\) >> config.cmake +echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake +echo set\(USE_CCACHE OFF\) >> config.cmake diff --git a/tests/scripts/task_config_build_gpu_vulkan.sh b/tests/scripts/task_config_build_gpu_vulkan.sh index a5a26a1db0fb..93adc9667da7 100755 --- a/tests/scripts/task_config_build_gpu_vulkan.sh +++ b/tests/scripts/task_config_build_gpu_vulkan.sh @@ -16,18 +16,13 @@ # specific language governing permissions and limitations # under the License. -set -e -set -u +# TODO(Lunderberg): Remove this file once the Jenkinsfile in the +# ci-docker-staging branch no longer references it. -mkdir -p build2 -cd build2 -cp ../cmake/config.cmake . +# This file is a backwards compatibility file, as the TVM CI uses the +# Jenkinsfile from the ci-docker-staging branch, but the task scripts +# from the PR branch. -echo set\(USE_OPENCL ON\) >> config.cmake -echo set\(USE_ROCM ON\) >> config.cmake -echo set\(USE_VULKAN ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake -echo set\(USE_PROFILER ON\) >> config.cmake -echo set\(USE_LIBBACKTRACE OFF\) >> config.cmake -echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake -echo set\(USE_CCACHE OFF\) >> config.cmake +set -euo pipefail + +./tests/scripts/task_config_build_gpu_other.sh diff --git a/tests/scripts/task_python_integration_gpuonly.sh b/tests/scripts/task_python_integration_gpuonly.sh index ac09cb5a14a3..36c3883d4379 100755 --- a/tests/scripts/task_python_integration_gpuonly.sh +++ b/tests/scripts/task_python_integration_gpuonly.sh @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. -export TVM_TEST_TARGETS="cuda;opencl;metal;rocm;vulkan;nvptx;opencl -device=mali,aocl_sw_emu" +export TVM_TEST_TARGETS="cuda;opencl;metal;rocm;nvptx;opencl -device=mali,aocl_sw_emu" export PYTEST_ADDOPTS="-m gpu $PYTEST_ADDOPTS" export TVM_RELAY_TEST_TARGETS="cuda" export TVM_INTEGRATION_TESTSUITE_NAME=python-integration-gpu diff --git a/tests/scripts/task_python_unittest_gpuonly.sh b/tests/scripts/task_python_unittest_gpuonly.sh index 22f79bc70ec9..54dd085f1817 100755 --- a/tests/scripts/task_python_unittest_gpuonly.sh +++ b/tests/scripts/task_python_unittest_gpuonly.sh @@ -16,8 +16,22 @@ # specific language governing permissions and limitations # under the License. -export TVM_TEST_TARGETS="cuda;opencl;metal;rocm;vulkan;nvptx;opencl -device=mali,aocl_sw_emu" -export PYTEST_ADDOPTS="-m gpu $PYTEST_ADDOPTS" +set -euo pipefail + +export PYTEST_ADDOPTS="-m gpu ${PYTEST_ADDOPTS:-}" + +# Test most of the enabled runtimes here. +export TVM_TEST_TARGETS="cuda;opencl;metal;rocm;nvptx;opencl -device=mali,aocl_sw_emu" export TVM_UNITTEST_TESTSUITE_NAME=python-unittest-gpu ./tests/scripts/task_python_unittest.sh + +# Kept separate to avoid increasing time needed to run CI, testing +# only minimal functionality of Vulkan runtime. +export TVM_TEST_TARGETS="vulkan -from_device=0" +export TVM_UNITTEST_TESTSUITE_NAME=python-unittest-vulkan + +source tests/scripts/setup-pytest-env.sh + +run_pytest ctypes ${TVM_UNITTEST_TESTSUITE_NAME} tests/python/unittest/test_target_codegen_vulkan.py +run_pytest cython ${TVM_UNITTEST_TESTSUITE_NAME} tests/python/unittest/test_target_codegen_vulkan.py