Skip to content

Commit

Permalink
[UnitTests] Enable minimum testing on Vulkan target in CI (#9093)
Browse files Browse the repository at this point in the history
* [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.
  • Loading branch information
Lunderberg authored Sep 28, 2021
1 parent 4905a8c commit 7adbb27
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/task_config_build_gpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions tests/scripts/task_config_build_gpu_other.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 8 additions & 13 deletions tests/scripts/task_config_build_gpu_vulkan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/scripts/task_python_integration_gpuonly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions tests/scripts/task_python_unittest_gpuonly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7adbb27

Please sign in to comment.