Skip to content

Commit

Permalink
Initial CTS for external semaphore and memory extensions (KhronosGrou…
Browse files Browse the repository at this point in the history
…p#1390)

* Initial CTS for external sharing extensions

Initial set of tests for below extensions
with Vulkan as producer
1. cl_khr_external_memory
2. cl_khr_external_memory_win32
3. cl_khr_external_memory_opaque_fd
4. cl_khr_external_semaphore
5. cl_khr_external_semaphore_win32
6. cl_khr_external_semaphore_opaque_fd

* Updates to external sharing CTS

Updates to external sharing CTS
1. Fix some build issues to remove unnecessary, non-existent files
2. Add new tests for platform and device queries.
3. Some added checks for VK Support.

* Update CTS build script for Vulkan Headers

Update CTS build to clone Vulkan Headers
repo and pass it to CTS build
in preparation for external memory
and semaphore tests

* Fix Vulkan header path

Fix Vulkan header include path.

* Add Vulkan loader dependency

Vulkan loader is required to build
test_vulkan of OpenCL-CTS.
Clone and build Vulkan loader as prerequisite
to OpenCL-CTS.

* Fix Vulkan loader path in test_vulkan

Remove arch/os suffix in Vulkan loader path
to match vulkan loader repo build.

* Fix warnings around getHandle API.

Return type of getHandle is defined
differently based on win or linux builds.
Use appropriate guards when using API
at other places.
While at it remove duplicate definition
of ARRAY_SIZE.

* Use ARRAY_SIZE in harness.

Use already defined ARRAY_SIZE macro
from test_harness.

* Fix build issues for test_vulkan

Fix build issues for test_vulkan
1. Add cl_ext.h in common files
2. Replace cl_mem_properties_khr with cl_mem_properties
3. Replace cl_external_mem_handle_type_khr with
cl_external_memory_handle_type_khr
4. Type-cast malloc as required.

* Fix code formatting.

Fix code formatting to
get CTS CI builds clean.

* Fix formatting fixes part-2

Another set of formatting fixes.

* Fix code formatting part-3

Some more code formatting fixes.

* Fix code formatting issues part-4

More code formatting fixes.

* Formatting fixes part-5

Some more formatting fixes

* Fix formatting part-6

More formatting fixes continued.

* Code formatting fixes part-7

Code formatting fixes for image

* Code formatting fixes part-8

Fixes for platform and device query tests.

* Code formatting fixes part-9

More formatting fixes for vulkan_wrapper

* Code formatting fixes part-10

More fixes to wrapper header

* Code formatting fixes part-11

Formatting fixes for api_list

* Code formatting fixes part-12

Formatting fixes for api_list_map.

* Code formatting changes part-13

Code formatting changes for utility.

* Code formatting fixes part-15
Formatting fixes for wrapper.

* Misc Code formatting fixes

Some more misc code formatting fixes.

* Fix build breaks due to code formatting

Fix build issues arised with recent
code formatting issues.

* Fix presubmit script after merge

Fix presubmit script after merge conflicts.

* Fix Vulkan loader build in presubmit script.

Use cmake ninja and appropriate toolchain
for Vulkan loader dependency to fix
linking issue on arm/aarch64.

* Use static array sizes

Use static array sizes to fix
windows builds.

* Some left-out formatting fixes.

Fix remaining formatting issues.

* Fix harness header path

Fix harness header path
While at it, remove Misc and test pragma.

* Add/Fix license information

Add Khronos License info for test_vulkan.
Replace Apple license with Khronos
as applicable.

* Fix headers for Mac OSX builds.

Use appropriate headers for
Mac OSX builds

* Fix Mac OSX builds.

Use appropriate headers for
Mac OSX builds.
Also, fix some build issues
due to type-casting.

* Fix new code formatting issues

Fix new code formatting issues
with recent MacOS fixes.

* Add back missing case statement

Add back missing case statement
that was accidentally removed.

* Disable USE_GAS for Vulkan Loader build.

Disable USE_GAS for Vulkan Loader build
to fix aarch64 build.

* Update Copyright Year.

Update Copyright Year to 2022
for external memory sharing tests.

* Android specific fixes

Android specific fixes to
external sharing tests.
  • Loading branch information
nikhiljnv authored Jun 21, 2022
1 parent 67ac6c8 commit 0b71181
Show file tree
Hide file tree
Showing 23 changed files with 10,535 additions and 5 deletions.
18 changes: 17 additions & 1 deletion presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ if [[ ( ${JOB_ARCHITECTURE} == "" && ${JOB_ENABLE_GL} == "1" ) ]]; then
BUILD_OPENGL_TEST="ON"
fi

#Vulkan Headers
git clone https://github.com/KhronosGroup/Vulkan-Headers.git

# Get and build loader
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git
cd ${TOP}/OpenCL-ICD-Loader
Expand All @@ -48,6 +51,16 @@ cd build
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/
cmake --build . -j2 --config Release

#Vulkan Loader
cd ${TOP}
git clone https://github.com/KhronosGroup/Vulkan-Loader.git
cd Vulkan-Loader
mkdir build
cd build
python3 ../scripts/update_deps.py
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF -DBUILD_WSI_WAYLAND_SUPPORT=OFF -DUSE_GAS=OFF -C helper.cmake ..
cmake --build . -j2 --config Release

# Build CTS
cd ${TOP}
ls -l
Expand All @@ -68,6 +81,9 @@ cmake .. -G Ninja \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=./bin \
-DOPENCL_LIBRARIES="${CMAKE_OPENCL_LIBRARIES_OPTION}" \
-DUSE_CL_EXPERIMENTAL=ON \
-DGL_IS_SUPPORTED=${BUILD_OPENGL_TEST}
-DGL_IS_SUPPORTED=${BUILD_OPENGL_TEST} \
-DVULKAN_INCLUDE_DIR=${TOP}/Vulkan-Headers/include/ \
-DVULKAN_LIB_DIR=${TOP}/Vulkan-Loader/build/loader/
cmake --build . -j3 --config Release


12 changes: 8 additions & 4 deletions test_common/harness/kernelHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,8 +1661,10 @@ Version get_device_latest_cl_c_version(cl_device_id device)
Version max_supported_cl_c_version{};
for (const auto &name_version : name_versions)
{
Version current_version{ CL_VERSION_MAJOR(name_version.version),
CL_VERSION_MINOR(name_version.version) };
Version current_version{
static_cast<int>(CL_VERSION_MAJOR(name_version.version)),
static_cast<int>(CL_VERSION_MINOR(name_version.version))
};
max_supported_cl_c_version =
(current_version > max_supported_cl_c_version)
? current_version
Expand Down Expand Up @@ -1745,8 +1747,10 @@ bool device_supports_cl_c_version(cl_device_id device, Version version)

for (const auto &name_version : name_versions)
{
Version current_version{ CL_VERSION_MAJOR(name_version.version),
CL_VERSION_MINOR(name_version.version) };
Version current_version{
static_cast<int>(CL_VERSION_MAJOR(name_version.version)),
static_cast<int>(CL_VERSION_MINOR(name_version.version))
};
if (current_version == version)
{
return true;
Expand Down
1 change: 1 addition & 0 deletions test_conformance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ add_subdirectory( pipes )
add_subdirectory( device_timer )
add_subdirectory( spirv_new )
add_subdirectory( spir )
add_subdirectory( vulkan )

file(GLOB CSV_FILES "opencl_conformance_tests_*.csv")

Expand Down
1 change: 1 addition & 0 deletions test_conformance/subgroups/subhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static cl_uint4 bs128_to_cl_uint4(bs128 v)

struct WorkGroupParams
{

WorkGroupParams(size_t gws, size_t lws, int dm_arg = -1, int cs_arg = -1)
: global_workgroup_size(gws), local_workgroup_size(lws),
divergence_mask_arg(dm_arg), cluster_size_arg(cs_arg)
Expand Down
50 changes: 50 additions & 0 deletions test_conformance/vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
set (MODULE_NAME VULKAN)

if(WIN32)
list(APPEND CLConform_LIBRARIES vulkan-1)
else(WIN32)
list(APPEND CLConform_LIBRARIES vulkan dl)
endif(WIN32)
set(CMAKE_CXX_FLAGS "-fpermissive")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_WIN32_KHR")
endif(WIN32)

set (CLConform_VULKAN_LIBRARIES_DIR "${VULKAN_LIB_DIR}")

link_directories(${CLConform_VULKAN_LIBRARIES_DIR})

list(APPEND CLConform_INCLUDE_DIR ${VULKAN_INCLUDE_DIR})

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

include_directories (${CLConform_INCLUDE_DIR})

set (${MODULE_NAME}_SOURCES
main.cpp
test_vulkan_interop_buffer.cpp
test_vulkan_interop_image.cpp
test_vulkan_api_consistency.cpp
test_vulkan_platform_device_info.cpp
vulkan_interop_common/vulkan_wrapper.cpp
vulkan_interop_common/vulkan_interop_common.cpp
vulkan_interop_common/opencl_vulkan_wrapper.cpp
vulkan_interop_common/vulkan_utility.cpp
vulkan_interop_common/vulkan_list_map.cpp
../../test_common/harness/genericThread.cpp
../../test_common/harness/errorHelpers.cpp
../../test_common/harness/testHarness.cpp
../../test_common/harness/kernelHelpers.cpp
../../test_common/harness/mt19937.cpp
../../test_common/harness/msvc9.c
../../test_common/harness/parseParameters.cpp
../../test_common/harness/deviceInfo.cpp
../../test_common/harness/crc32.cpp
)

set_source_files_properties(
${${MODULE_NAME}_SOURCES}
PROPERTIES LANGUAGE CXX)
include_directories("./vulkan_interop_common/")

include(../CMakeCommon.txt)
Loading

0 comments on commit 0b71181

Please sign in to comment.