Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -638,18 +638,6 @@ if(BUILD_FOR_HEXAGON AND DEFINED USE_HEXAGON_GTEST AND EXISTS ${USE_HEXAGON_GTES
include_directories("${USE_HEXAGON_GTEST}/include")
endif()

if(USE_OPENCL AND DEFINED USE_OPENCL_GTEST AND EXISTS ${USE_OPENCL_GTEST})
include(FetchContent)
FetchContent_Declare(googletest SOURCE_DIR "${USE_OPENCL_GTEST}")
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
target_link_libraries(tvm_runtime PUBLIC gtest)
target_link_libraries(tvm PUBLIC gtest)
include_directories("${USE_OPENCL_GTEST}/include")
include_directories("${USE_OPENCL_GTEST}/googletest/include")
message(STATUS "Found OpenCL gtest at ${USE_OPENCL_GTEST}")
endif()

# Set flags for clang
include(cmake/modules/ClangFlags.cmake)
set(CRC16_INCLUDE_PATH "3rdparty/libcrc/include")
Expand Down Expand Up @@ -715,9 +703,6 @@ install(TARGETS tvm_runtime EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_S
if(BUILD_FOR_HEXAGON AND DEFINED USE_HEXAGON_GTEST AND EXISTS ${USE_HEXAGON_GTEST})
install(TARGETS gtest EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX})
endif()
if(USE_OPENCL AND DEFINED USE_OPENCL_GTEST AND EXISTS ${USE_OPENCL_GTEST})
install(TARGETS gtest EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX})
endif()

if (INSTALL_DEV)
install(
Expand Down
2 changes: 1 addition & 1 deletion ci/jenkins/docker-images.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ci_arm: tlcpack/ci-arm:20221013-060115-61c9742ea
ci_cortexm: tlcpack/ci-cortexm:20221013-060115-61c9742ea
ci_cpu: tlcpack/ci-cpu:20221013-060115-61c9742ea
ci_gpu: tlcpack/ci-gpu:20221019-060125-0b4836739
ci_gpu: tlcpack/ci-gpu:20221128-070141-ae4fd7df7
ci_hexagon: tlcpack/ci-hexagon:20221013-060115-61c9742ea
ci_i386: tlcpack/ci-i386:20221013-060115-61c9742ea
ci_lint: tlcpack/ci-lint:20221013-060115-61c9742ea
Expand Down
8 changes: 8 additions & 0 deletions ci/jenkins/generated/gpu_jenkinsfile.groovy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ci/jenkins/templates/gpu_jenkinsfile.groovy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
make_standalone_crt(ci_gpu, 'build')
make_cpp_tests(ci_gpu, 'build')
cpp_unittest(ci_gpu)
sh (
script: "${docker_run} ${ci_gpu} python3 ./tests/scripts/task_build.py --sccache-bucket tvm-sccache-prod --cmake-target opencl-cpptest --build-dir build",
label: 'Make OpenCL cpp unit tests',
)
sh (
script: "${docker_run} ${ci_gpu} ./tests/scripts/task_opencl_cpp_unittest.sh",
label: 'Run OpenCL cpp unit tests',
)
micro_cpp_unittest(ci_gpu)
{% else %}
{{ m.download_artifacts(tag='gpu') }}
Expand Down
12 changes: 11 additions & 1 deletion cmake/modules/OpenCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,19 @@ if(USE_OPENCL)
endif()

if(DEFINED USE_OPENCL_GTEST AND EXISTS ${USE_OPENCL_GTEST})
file_glob_append(RUNTIME_OPENCL_SRCS
include(FetchContent)
FetchContent_Declare(googletest SOURCE_DIR "${USE_OPENCL_GTEST}")
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
install(TARGETS gtest EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX})

message(STATUS "Found OpenCL gtest at ${USE_OPENCL_GTEST}")

tvm_file_glob(GLOB_RECURSE OPENCL_TEST_SRCS
"${CMAKE_SOURCE_DIR}/tests/cpp-runtime/opencl/*.cc"
)
add_executable(opencl-cpptest ${OPENCL_TEST_SRCS})
target_link_libraries(opencl-cpptest PRIVATE gtest_main tvm_runtime)
endif()
list(APPEND RUNTIME_SRCS ${RUNTIME_OPENCL_SRCS})
else()
Expand Down
60 changes: 0 additions & 60 deletions tests/cpp-runtime/opencl/run_gtests.cc

This file was deleted.

56 changes: 0 additions & 56 deletions tests/python/contrib/test_opencl/test_run_gtests.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/scripts/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ def add_subparser(
"run unit tests",
[
"./tests/scripts/task_java_unittest.sh",
"./tests/scripts/task_opencl_cpp_unittest.sh",
"./tests/scripts/task_python_unittest_gpuonly.sh",
"./tests/scripts/task_python_integration_gpuonly.sh",
],
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 @@ -29,6 +29,7 @@ echo set\(USE_CUDA ON\) >> config.cmake
echo set\(USE_VULKAN ON\) >> config.cmake
echo set\(USE_OPENGL ON\) >> config.cmake
echo set\(USE_OPENCL ON\) >> config.cmake
echo set\(USE_OPENCL_GTEST \"/googletest\"\) >> config.cmake
echo set\(USE_MICRO ON\) >> config.cmake
echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake
echo set\(USE_LLVM \"/usr/bin/llvm-config-9 --link-static\"\) >> config.cmake
Expand Down
39 changes: 39 additions & 0 deletions tests/scripts/task_opencl_cpp_unittest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env 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.

set -euxo pipefail

if [ $# -gt 0 ]; then
BUILD_DIR="$1"
elif [ -n "${TVM_BUILD_PATH:-}" ]; then
# TVM_BUILD_PATH may contain multiple space-separated paths. If
# so, use the first one.
BUILD_DIR=$(IFS=" "; set -- $TVM_BUILD_PATH; echo $1)
else
BUILD_DIR=build
fi


# to avoid CI thread throttling.
export TVM_BIND_THREADS=0
export OMP_NUM_THREADS=1

pushd "${BUILD_DIR}"
# run cpp test executable
./opencl-cpptest
popd