Add external semaphore tests. (#1645)

* Add external semaphore tests.

Added basic test to check the functionality of cl_ext_external_semaphore_test extension.
Tests rely on Vulkan API as the producer of the external semaphore functionality. The
Vulkan wrapper has been copied from the Vulkan CTS tests and minor changes have been
introduced. A separate copy of the Vulkan wrapper is for breaking any dependencies
between different CTS modules and thus make the build system simpler.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix clang-format

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Move vulkan wrapper to a separate library.

Vulkan wrapper is extracted as a separate module and can be used in different
CTS tests as a shared library.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Add cl_ext_external_samaphore tests based on cl_khr_semaphore tests.

Added cl_khr_semaphore adjusted to creating semaphores in Vulkan context
and importing them through export semaphore functionality in OpenCL
(cl_ext_external_samaphore).

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Cleanup.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix build issues.

* Add missing directories for build cl_ext_external_semaphore.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Set Vulkan lib directory.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Change extension directory name.

Changed extensions directory name from cl_ext_external_semaphore to cl_khr_external_semaphore.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Remove unneeded compile options.

Removed VK_USE_PLATFORM_WIN32_KHR option from cl_khr_external_semaphore
compilation arguments.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

---------

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
This commit is contained in:
Paweł Jastrzębski
2023-03-21 17:06:15 +01:00
committed by GitHub
parent b7f2dd58e9
commit 63b0f441f1
20 changed files with 2056 additions and 475 deletions

View File

@@ -0,0 +1,69 @@
set(VULKAN_WRAPPER_SOURCES
vulkan_wrapper.cpp
opencl_vulkan_wrapper.cpp
vulkan_utility.cpp
vulkan_list_map.cpp
)
# needed by Vulkan wrapper to compile
add_cxx_flag_if_supported(-Wmisleading-indentation)
add_cxx_flag_if_supported(-Wno-narrowing)
add_cxx_flag_if_supported(-Wno-format)
add_cxx_flag_if_supported(-Wno-error)
add_cxx_flag_if_supported(-Wno-error=cpp) # Allow #warning directive
add_cxx_flag_if_supported(-Wno-error=unknown-pragmas) # Issue #785
add_cxx_flag_if_supported(-Wno-error=asm-operand-widths) # Issue #784
add_cxx_flag_if_supported(-Wno-unused-variable)
add_cxx_flag_if_supported(-Wno-error=terminate)
add_cxx_flag_if_supported(-Wno-error=unused-function)
add_cxx_flag_if_supported(-Wno-error=return-type)
link_directories(${CLConform_VULKAN_LIBRARIES_DIR})
list(APPEND CLConform_INCLUDE_DIR ${VULKAN_INCLUDE_DIR})
add_library(vulkan_wrapper STATIC ${VULKAN_WRAPPER_SOURCES})
if(ANDROID)
target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_ANDROID_KHR)
elseif(WIN32)
target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_WIN32_KHR)
elseif(APPLE)
target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_METAL_EXT)
elseif(UNIX)
# Variable taken from Vulkan samples, commented out due to lack of WSI
# Choose WSI based on VKB_WSI_SELECTION
#if (VKB_WSI_SELECTION STREQUAL XCB OR VKB_WSI_SELECTION STREQUAL XLIB OR VKB_WSI_SELECTION STREQUAL WAYLAND)
# find_package(PkgConfig REQUIRED)
#endif()
#if (VKB_WSI_SELECTION STREQUAL XCB)
# pkg_check_modules(XCB xcb REQUIRED)
# if (XCB_FOUND)
# target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_XCB_KHR)
# endif()
#elseif (VKB_WSI_SELECTION STREQUAL XLIB)
# pkg_check_modules(X11 x11 REQUIRED)
# if (X11_FOUND)
# target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_XLIB_KHR)
# endif()
#elseif (VKB_WSI_SELECTION STREQUAL WAYLAND)
# pkg_check_modules(WAYLAND wayland-client REQUIRED)
# if (WAYLAND_FOUND)
# target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_WAYLAND_KHR)
# endif()
#elseif (VKB_WSI_SELECTION STREQUAL D2D)
# set(DIRECT_TO_DISPLAY TRUE)
# set(DIRECT_TO_DISPLAY TRUE PARENT_SCOPE)
# target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_DISPLAY_KHR)
#else()
# message(FATAL_ERROR "Unknown WSI")
#endif()
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CLConform_INCLUDE_DIR})
if (NOT WIN32)
target_link_libraries(vulkan_wrapper dl)
endif()