Skip to content

Commit 7f56cec

Browse files
authored
Merge pull request #1021 from kbenzie/benie/test-adapters
[CUDA][HIP] Move adapter specific testing out of CTS
2 parents ba994bb + 93bdb81 commit 7f56cec

25 files changed

+123
-89
lines changed

.github/workflows/cmake.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ jobs:
203203
run: LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib
204204
cmake --build ${{github.workspace}}/build -j $(nproc)
205205

206+
- name: Test adapter specific
207+
working-directory: ${{github.workspace}}/build
208+
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180
209+
206210
# Temporarily disabling platform test for L0, because of hang
207211
# See issue: #824
208212
- name: Test L0 adapter

source/adapters/cuda/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
set(CUDA_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "CUDA adapter directory")
7-
86
set(TARGET_NAME ur_adapter_cuda)
97

108
add_ur_adapter(${TARGET_NAME}

source/adapters/hip/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
set(HIP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "HIP adapter directory")
7-
86
set(TARGET_NAME ur_adapter_hip)
97

108
# Set default UR HIP platform to AMD

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enable_testing()
1616

1717
add_subdirectory(python)
1818
add_subdirectory(loader)
19+
add_subdirectory(adapters)
1920
add_subdirectory(conformance)
2021
add_subdirectory(unified_malloc_framework)
2122
add_subdirectory(usm)

test/adapters/CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
function(add_adapter_test name)
7+
cmake_parse_arguments(args
8+
"" # options
9+
"FIXTURE" # one value keywords
10+
"SOURCES;ENVIRONMENT" # multi value keywords
11+
${ARGN})
12+
13+
set(target test-adapter-${name})
14+
add_ur_executable(${target} ${args_SOURCES}
15+
${PROJECT_SOURCE_DIR}/test/conformance/source/environment.cpp
16+
${PROJECT_SOURCE_DIR}/test/conformance/source/main.cpp
17+
)
18+
19+
set(fixtures "PLATFORM;DEVICES;KERNELS")
20+
if(NOT args_FIXTURE IN_LIST fixtures)
21+
message(FATAL_ERROR
22+
"FIXTURE must be one of: ${fixtures}. Found: ${args_FIXTURE}")
23+
endif()
24+
25+
target_compile_definitions(${target} PRIVATE
26+
${args_FIXTURE}_ENVIRONMENT)
27+
target_link_libraries(${target} PRIVATE
28+
${PROJECT_NAME}::loader
29+
${PROJECT_NAME}::headers
30+
${PROJECT_NAME}::testing
31+
${PROJECT_NAME}::common
32+
GTest::gtest)
33+
34+
add_test(NAME ${target} COMMAND $<TARGET_FILE:${target}>)
35+
set_tests_properties(${target} PROPERTIES
36+
LABELS "adapter-specific;${name}"
37+
ENVIRONMENT "${args_ENVIRONMENT}")
38+
endfunction()
39+
40+
if(UR_BUILD_ADAPTER_CUDA)
41+
add_subdirectory(cuda)
42+
endif()
43+
44+
if(UR_BUILD_ADAPTER_HIP)
45+
add_subdirectory(hip)
46+
endif()

test/adapters/cuda/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
add_adapter_test(cuda
7+
FIXTURE DEVICES
8+
SOURCES
9+
fixtures.h
10+
context_tests.cpp
11+
urContextGetNativeHandle.cpp
12+
urDeviceGetNativeHandle.cpp
13+
urDeviceCreateWithNativeHandle.cpp
14+
urEventGetNativeHandle.cpp
15+
urEventCreateWithNativeHandle.cpp
16+
kernel_tests.cpp
17+
memory_tests.cpp
18+
ENVIRONMENT
19+
"UR_ADAPTERS_FORCE_LOAD=\"$<TARGET_FILE:ur_adapter_cuda>\""
20+
)
21+
22+
target_include_directories(test-adapter-cuda PRIVATE
23+
${PROJECT_SOURCE_DIR}/source
24+
${PROJECT_SOURCE_DIR}/source/adapters/cuda
25+
)
26+
27+
target_link_libraries(test-adapter-cuda PRIVATE cudadrv)

0 commit comments

Comments
 (0)