Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CUDA][HIP] Move adapter specific testing out of CTS #1021

Merged
merged 1 commit into from
Nov 3, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ jobs:
run: LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib
cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Test adapter specific
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180

# Temporarily disabling platform test for L0, because of hang
# See issue: #824
- name: Test L0 adapter
Expand Down
2 changes: 0 additions & 2 deletions source/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set(CUDA_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "CUDA adapter directory")

set(TARGET_NAME ur_adapter_cuda)

add_ur_adapter(${TARGET_NAME}
Expand Down
2 changes: 0 additions & 2 deletions source/adapters/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set(HIP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "HIP adapter directory")

set(TARGET_NAME ur_adapter_hip)

# Set default UR HIP platform to AMD
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enable_testing()

add_subdirectory(python)
add_subdirectory(loader)
add_subdirectory(adapters)
add_subdirectory(conformance)
add_subdirectory(unified_malloc_framework)
add_subdirectory(usm)
Expand Down
46 changes: 46 additions & 0 deletions test/adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (C) 2023 Intel Corporation
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

function(add_adapter_test name)
cmake_parse_arguments(args
"" # options
"FIXTURE" # one value keywords
"SOURCES;ENVIRONMENT" # multi value keywords
${ARGN})

set(target test-adapter-${name})
add_ur_executable(${target} ${args_SOURCES}
${PROJECT_SOURCE_DIR}/test/conformance/source/environment.cpp
${PROJECT_SOURCE_DIR}/test/conformance/source/main.cpp
)

set(fixtures "PLATFORM;DEVICES;KERNELS")
if(NOT args_FIXTURE IN_LIST fixtures)
message(FATAL_ERROR
"FIXTURE must be one of: ${fixtures}. Found: ${args_FIXTURE}")
endif()

target_compile_definitions(${target} PRIVATE
${args_FIXTURE}_ENVIRONMENT)
target_link_libraries(${target} PRIVATE
${PROJECT_NAME}::loader
${PROJECT_NAME}::headers
${PROJECT_NAME}::testing
${PROJECT_NAME}::common
GTest::gtest)

add_test(NAME ${target} COMMAND $<TARGET_FILE:${target}>)
set_tests_properties(${target} PROPERTIES
LABELS "adapter-specific;${name}"
ENVIRONMENT "${args_ENVIRONMENT}")
endfunction()

if(UR_BUILD_ADAPTER_CUDA)
add_subdirectory(cuda)
endif()

if(UR_BUILD_ADAPTER_HIP)
add_subdirectory(hip)
endif()
27 changes: 27 additions & 0 deletions test/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2023 Intel Corporation
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

add_adapter_test(cuda
FIXTURE DEVICES
SOURCES
fixtures.h
context_tests.cpp
urContextGetNativeHandle.cpp
urDeviceGetNativeHandle.cpp
urDeviceCreateWithNativeHandle.cpp
urEventGetNativeHandle.cpp
urEventCreateWithNativeHandle.cpp
kernel_tests.cpp
memory_tests.cpp
ENVIRONMENT
"UR_ADAPTERS_FORCE_LOAD=\"$<TARGET_FILE:ur_adapter_cuda>\""
)

target_include_directories(test-adapter-cuda PRIVATE
${PROJECT_SOURCE_DIR}/source
${PROJECT_SOURCE_DIR}/source/adapters/cuda
)

target_link_libraries(test-adapter-cuda PRIVATE cudadrv)
29 changes: 29 additions & 0 deletions test/adapters/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (C) 2023 Intel Corporation
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

add_adapter_test(hip
FIXTURE DEVICES
SOURCES
fixtures.h
urContextGetNativeHandle.cpp
urDeviceGetNativeHandle.cpp
urEventGetNativeHandle.cpp
test_context.cpp
ENVIRONMENT
"UR_ADAPTERS_FORCE_LOAD=\"$<TARGET_FILE:ur_adapter_hip>\""
)

target_include_directories(test-adapter-hip PRIVATE
${PROJECT_SOURCE_DIR}/source
${PROJECT_SOURCE_DIR}/source/adapters/hip
)

get_target_property(HIP_COMPILE_DEFINITIONS
ur_adapter_hip COMPILE_DEFINITIONS)
target_compile_definitions(test-adapter-hip PRIVATE
${HIP_COMPILE_DEFINITIONS}
)

target_link_libraries(test-adapter-hip PRIVATE rocmdrv)
File renamed without changes.
39 changes: 16 additions & 23 deletions test/conformance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,22 @@ function(add_conformance_test name)
${PROJECT_NAME}::common
GTest::gtest_main)

if(USE_LOCAL_TEST_CONFIGURATION)
add_test(NAME ${name}
COMMAND ${TEST_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
if(UR_BUILD_ADAPTER_CUDA)
add_test_adapter(${name} adapter_cuda)
endif()
if(UR_BUILD_ADAPTER_HIP)
add_test_adapter(${name} adapter_hip)
endif()
if(UR_BUILD_ADAPTER_L0)
add_test_adapter(${name} adapter_level_zero)
endif()
if(UR_BUILD_ADAPTER_OPENCL)
add_test_adapter(${name} adapter_opencl)
endif()

if(NOT (UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_HIP
OR UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_OPENCL))
add_test_adapter(${name} adapter_null)
endif()
if(UR_BUILD_ADAPTER_CUDA)
add_test_adapter(${name} adapter_cuda)
endif()
if(UR_BUILD_ADAPTER_HIP)
add_test_adapter(${name} adapter_hip)
endif()
if(UR_BUILD_ADAPTER_L0)
add_test_adapter(${name} adapter_level_zero)
endif()
if(UR_BUILD_ADAPTER_OPENCL)
add_test_adapter(${name} adapter_opencl)
endif()

if(NOT (UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_HIP
OR UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_OPENCL))
add_test_adapter(${name} adapter_null)
endif()
endfunction()

Expand All @@ -83,7 +77,6 @@ function(add_conformance_test_with_platform_environment name)
endfunction()

add_subdirectory(testing)
add_subdirectory(adapters)

add_subdirectory(runtime)
add_subdirectory(platform)
Expand Down
12 changes: 0 additions & 12 deletions test/conformance/adapters/CMakeLists.txt

This file was deleted.

24 changes: 0 additions & 24 deletions test/conformance/adapters/cuda/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions test/conformance/adapters/hip/CMakeLists.txt

This file was deleted.