mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Semaphore types bug fixes revised (#1822)
* Added support for SYNC_FD and other handle types * Fix consistency test Deleted test cases that are no longer testable according to the spec. * Fix multi-import tests -Delete obsolete code relating to offsets -Propagate dedicated memory change * Fix error handling Some subtests did not fail on incorrect result. Changes to macros to fail, so this does not occur again. * Delete invalid test cases Test cases are not related to this extension. * External memory test Add support for any handle type supported by the platform. Change-Id: I6765fde5e7929988f49bfbf2df2f41d5263b6abc * Update multi-import tests to use new semaphore types * Fix formatting * Addressed review comments. Deleted VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT as it appears to be redundant.
This commit is contained in:
@@ -61,6 +61,21 @@ static int vlog_win32(const char *format, ...);
|
||||
log_error(msg, ##__VA_ARGS__); \
|
||||
return TEST_FAIL; \
|
||||
}
|
||||
#define test_fail_and_cleanup(errRet, cleanup, msg, ...) \
|
||||
{ \
|
||||
log_error(msg, ##__VA_ARGS__); \
|
||||
errRet = TEST_FAIL; \
|
||||
goto cleanup; \
|
||||
}
|
||||
#define test_error_and_cleanup(errCode, cleanup, msg, ...) \
|
||||
{ \
|
||||
auto errCodeResult = errCode; \
|
||||
if (errCodeResult != CL_SUCCESS) \
|
||||
{ \
|
||||
print_error(errCodeResult, msg); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
#define test_error(errCode, msg) test_error_ret(errCode, msg, errCode)
|
||||
#define test_error_fail(errCode, msg) test_error_ret(errCode, msg, TEST_FAIL)
|
||||
#define test_error_ret(errCode, msg, retValue) \
|
||||
|
||||
@@ -33,6 +33,7 @@ pfnclEnqueueAcquireExternalMemObjectsKHR
|
||||
pfnclEnqueueReleaseExternalMemObjectsKHR
|
||||
clEnqueueReleaseExternalMemObjectsKHRptr;
|
||||
pfnclReleaseSemaphoreKHR clReleaseSemaphoreKHRptr;
|
||||
pfnclGetSemaphoreHandleForTypeKHR clGetSemaphoreHandleForTypeKHRptr;
|
||||
|
||||
void init_cl_vk_ext(cl_platform_id opencl_platform)
|
||||
{
|
||||
@@ -69,6 +70,15 @@ void init_cl_vk_ext(cl_platform_id opencl_platform)
|
||||
throw std::runtime_error("Failed to get the function pointer of "
|
||||
"clCreateSemaphoreWithPropertiesKHRptr!");
|
||||
}
|
||||
|
||||
clGetSemaphoreHandleForTypeKHRptr = (pfnclGetSemaphoreHandleForTypeKHR)
|
||||
clGetExtensionFunctionAddressForPlatform(
|
||||
opencl_platform, "clGetSemaphoreHandleForTypeKHR");
|
||||
if (NULL == clGetSemaphoreHandleForTypeKHRptr)
|
||||
{
|
||||
throw std::runtime_error("Failed to get the function pointer of "
|
||||
"clGetSemaphoreHandleForTypeKHRptr!");
|
||||
}
|
||||
}
|
||||
|
||||
cl_int setMaxImageDimensions(cl_device_id deviceID, size_t &max_width,
|
||||
@@ -522,8 +532,8 @@ clExternalMemory::clExternalMemory(const clExternalMemory &externalMemory)
|
||||
|
||||
clExternalMemory::clExternalMemory(
|
||||
const VulkanDeviceMemory *deviceMemory,
|
||||
VulkanExternalMemoryHandleType externalMemoryHandleType, uint64_t offset,
|
||||
uint64_t size, cl_context context, cl_device_id deviceId)
|
||||
VulkanExternalMemoryHandleType externalMemoryHandleType, uint64_t size,
|
||||
cl_context context, cl_device_id deviceId)
|
||||
{
|
||||
int err = 0;
|
||||
m_externalMemory = NULL;
|
||||
@@ -548,9 +558,9 @@ clExternalMemory::clExternalMemory(
|
||||
{
|
||||
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD:
|
||||
#ifdef _WIN32
|
||||
log_info("Opaque file descriptors are not supported on Windows\n");
|
||||
ASSERT(0);
|
||||
#endif
|
||||
log_info("Opaque file descriptors are not supported on Windows\n");
|
||||
fd = (int)deviceMemory->getHandle(externalMemoryHandleType);
|
||||
err = check_external_memory_handle_type(
|
||||
devList[0], CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR);
|
||||
@@ -728,56 +738,19 @@ clExternalMemoryImage::clExternalMemoryImage() {}
|
||||
// clExternalSemaphore implementation //
|
||||
//////////////////////////////////////////
|
||||
|
||||
clExternalSemaphore::clExternalSemaphore(
|
||||
const clExternalSemaphore &externalSemaphore)
|
||||
: m_externalSemaphore(externalSemaphore.m_externalSemaphore)
|
||||
{}
|
||||
|
||||
clExternalSemaphore::clExternalSemaphore(
|
||||
const VulkanSemaphore &semaphore, cl_context context,
|
||||
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
|
||||
cl_device_id deviceId)
|
||||
: m_deviceSemaphore(semaphore)
|
||||
{
|
||||
|
||||
cl_int err = 0;
|
||||
cl_device_id devList[] = { deviceId, NULL };
|
||||
|
||||
switch (externalSemaphoreHandleType)
|
||||
{
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD:
|
||||
if (!is_extension_available(devList[0],
|
||||
"cl_khr_external_semaphore_opaque_fd"))
|
||||
{
|
||||
throw std::runtime_error("Device does not support "
|
||||
"cl_khr_external_semaphore_opaque_fd "
|
||||
"extension \n");
|
||||
}
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT:
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
|
||||
if (!is_extension_available(devList[0],
|
||||
"cl_khr_external_semaphore_win32"))
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Device does not support "
|
||||
"cl_khr_external_semaphore_win32 extension\n");
|
||||
}
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD:
|
||||
if (!is_extension_available(devList[0],
|
||||
"cl_khr_external_semaphore_sync_fd"))
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Device does not support cl_khr_external_semaphore_sync_fd "
|
||||
"extension \n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error(
|
||||
"Unsupported external semaphore handle type\n");
|
||||
break;
|
||||
}
|
||||
m_externalHandleType = externalSemaphoreHandleType;
|
||||
m_externalSemaphore = nullptr;
|
||||
m_device = deviceId;
|
||||
m_context = context;
|
||||
|
||||
std::vector<cl_semaphore_properties_khr> sema_props{
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
|
||||
@@ -873,16 +846,97 @@ clExternalSemaphore::~clExternalSemaphore() noexcept(false)
|
||||
}
|
||||
}
|
||||
|
||||
void clExternalSemaphore::signal(cl_command_queue cmd_queue)
|
||||
int clExternalSemaphore::signal(cl_command_queue cmd_queue)
|
||||
{
|
||||
clEnqueueSignalSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore, NULL, 0,
|
||||
NULL, NULL);
|
||||
int err = clEnqueueSignalSemaphoresKHRptr(
|
||||
cmd_queue, 1, &m_externalSemaphore, NULL, 0, NULL, nullptr);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
if (m_externalHandleType == VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
|
||||
{
|
||||
err = clGetSemaphoreHandleForTypeKHRptr(m_externalSemaphore, m_device,
|
||||
CL_SEMAPHORE_HANDLE_SYNC_FD_KHR,
|
||||
sizeof(int), &fd, nullptr);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error("Failed to export fd from semaphore\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
VkImportSemaphoreFdInfoKHR import = {};
|
||||
import.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
|
||||
import.semaphore = m_deviceSemaphore;
|
||||
import.fd = fd;
|
||||
import.pNext = nullptr;
|
||||
import.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR;
|
||||
import.flags = 0;
|
||||
|
||||
VkResult res =
|
||||
vkImportSemaphoreFdKHR(m_deviceSemaphore.getDevice(), &import);
|
||||
ASSERT(res == VK_SUCCESS);
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
err = CL_INVALID_OPERATION;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void clExternalSemaphore::wait(cl_command_queue cmd_queue)
|
||||
int clExternalSemaphore::wait(cl_command_queue cmd_queue)
|
||||
{
|
||||
clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore, NULL, 0,
|
||||
NULL, NULL);
|
||||
int err = CL_SUCCESS;
|
||||
if (m_externalHandleType == VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
|
||||
{
|
||||
cl_int err = 0;
|
||||
cl_device_id devList[] = { m_device, NULL };
|
||||
std::vector<cl_semaphore_properties_khr> sema_props{
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
|
||||
};
|
||||
fd = (int)m_deviceSemaphore.getHandle(m_externalHandleType);
|
||||
|
||||
err = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
log_error("CL_SEMAPHORE_HANDLE_SYNC_FD_KHR not supported\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
sema_props.push_back(
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
|
||||
sema_props.push_back((cl_semaphore_properties_khr)fd);
|
||||
|
||||
sema_props.push_back(0);
|
||||
|
||||
if (m_externalSemaphore)
|
||||
{
|
||||
err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error("Failed to release CL external semaphore\n");
|
||||
return err;
|
||||
}
|
||||
m_externalSemaphore = nullptr;
|
||||
}
|
||||
|
||||
m_externalSemaphore = clCreateSemaphoreWithPropertiesKHRptr(
|
||||
m_context, sema_props.data(), &err);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
log_error("clCreateSemaphoreWithPropertiesKHRptr failed with %d\n",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
err = clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore,
|
||||
NULL, 0, NULL, NULL);
|
||||
return err;
|
||||
}
|
||||
|
||||
cl_semaphore_khr &clExternalSemaphore::getCLSemaphore()
|
||||
|
||||
@@ -50,6 +50,10 @@ typedef cl_int (*pfnclEnqueueReleaseExternalMemObjectsKHR)(
|
||||
const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
|
||||
const cl_event *event_wait_list, cl_event *event);
|
||||
typedef cl_int (*pfnclReleaseSemaphoreKHR)(cl_semaphore_khr sema_object);
|
||||
typedef cl_int (*pfnclGetSemaphoreHandleForTypeKHR)(
|
||||
cl_semaphore_khr sema_object, cl_device_id device,
|
||||
cl_external_semaphore_handle_type_khr handleType, size_t handle_size,
|
||||
void *handle, size_t *handleSize);
|
||||
|
||||
extern pfnclCreateSemaphoreWithPropertiesKHR
|
||||
clCreateSemaphoreWithPropertiesKHRptr;
|
||||
@@ -83,8 +87,7 @@ public:
|
||||
clExternalMemory();
|
||||
clExternalMemory(const VulkanDeviceMemory *deviceMemory,
|
||||
VulkanExternalMemoryHandleType externalMemoryHandleType,
|
||||
uint64_t offset, uint64_t size, cl_context context,
|
||||
cl_device_id deviceId);
|
||||
uint64_t size, cl_context context, cl_device_id deviceId);
|
||||
|
||||
virtual ~clExternalMemory();
|
||||
cl_mem getExternalMemoryBuffer();
|
||||
@@ -111,9 +114,12 @@ public:
|
||||
class clExternalSemaphore {
|
||||
protected:
|
||||
cl_semaphore_khr m_externalSemaphore;
|
||||
VulkanExternalSemaphoreHandleType m_externalHandleType;
|
||||
cl_device_id m_device;
|
||||
cl_context m_context;
|
||||
const VulkanSemaphore &m_deviceSemaphore;
|
||||
int fd;
|
||||
void *handle;
|
||||
clExternalSemaphore(const clExternalSemaphore &externalSemaphore);
|
||||
|
||||
public:
|
||||
clExternalSemaphore(
|
||||
@@ -121,8 +127,8 @@ public:
|
||||
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
|
||||
cl_device_id deviceId);
|
||||
virtual ~clExternalSemaphore() noexcept(false);
|
||||
void signal(cl_command_queue command_queue);
|
||||
void wait(cl_command_queue command_queue);
|
||||
int signal(cl_command_queue command_queue);
|
||||
int wait(cl_command_queue command_queue);
|
||||
cl_semaphore_khr &getCLSemaphore();
|
||||
// operator openclExternalSemaphore_t() const;
|
||||
};
|
||||
|
||||
@@ -98,8 +98,9 @@
|
||||
VK_FUNC_DECL(vkGetPhysicalDeviceSurfaceFormatsKHR) \
|
||||
VK_FUNC_DECL(vkGetPhysicalDeviceSurfacePresentModesKHR) \
|
||||
VK_FUNC_DECL(vkEnumerateDeviceExtensionProperties) \
|
||||
VK_FUNC_DECL(vkGetPhysicalDeviceSurfaceSupportKHR)
|
||||
|
||||
VK_FUNC_DECL(vkGetPhysicalDeviceSurfaceSupportKHR) \
|
||||
VK_FUNC_DECL(vkImportSemaphoreFdKHR) \
|
||||
VK_FUNC_DECL(vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)
|
||||
#define VK_WINDOWS_FUNC_LIST \
|
||||
VK_FUNC_DECL(vkGetMemoryWin32HandleKHR) \
|
||||
VK_FUNC_DECL(vkGetSemaphoreWin32HandleKHR)
|
||||
@@ -192,7 +193,9 @@
|
||||
_vkEnumerateDeviceExtensionProperties
|
||||
#define vkGetPhysicalDeviceSurfaceSupportKHR \
|
||||
_vkGetPhysicalDeviceSurfaceSupportKHR
|
||||
|
||||
#define vkImportSemaphoreFdKHR _vkImportSemaphoreFdKHR
|
||||
#define vkGetPhysicalDeviceExternalSemaphorePropertiesKHR \
|
||||
_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR
|
||||
#define vkGetMemoryWin32HandleKHR _vkGetMemoryWin32HandleKHR
|
||||
#define vkGetSemaphoreWin32HandleKHR _vkGetSemaphoreWin32HandleKHR
|
||||
|
||||
|
||||
@@ -336,6 +336,8 @@ const VulkanWrapper &
|
||||
return (m_wrapperList.size() > 0) ? m_wrapperList[idx].get()
|
||||
: m_constWrapperList[idx].get();
|
||||
}
|
||||
|
||||
throw std::runtime_error("Out of bounds operator access");
|
||||
}
|
||||
|
||||
template <class VulkanWrapper, class VulkanNative>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <algorithm>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_ext.h>
|
||||
#include "deviceInfo.h"
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <versionhelpers.h>
|
||||
#endif
|
||||
@@ -174,7 +175,7 @@ getVulkanMemoryType(const VulkanDevice &device,
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK_LT(mtIdx, memoryTypeList.size());
|
||||
ASSERT(mtIdx < memoryTypeList.size());
|
||||
return memoryTypeList[mtIdx];
|
||||
}
|
||||
|
||||
@@ -236,30 +237,112 @@ getSupportedVulkanExternalMemoryHandleTypeList()
|
||||
}
|
||||
|
||||
const std::vector<VulkanExternalSemaphoreHandleType>
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList()
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList(const VulkanDevice &vkDevice)
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
const char *extension_name;
|
||||
VkExternalSemaphoreHandleTypeFlagBits vk_type;
|
||||
VulkanExternalSemaphoreHandleType enum_type;
|
||||
} VkSemaphoreHandleMap;
|
||||
|
||||
// Add all known handle types, use Vulkan queries to determine what is
|
||||
// supported.
|
||||
std::vector<VkSemaphoreHandleMap> all_known_handle_types;
|
||||
all_known_handle_types.push_back(
|
||||
{ "VK_KHR_external_semaphore_fd",
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD });
|
||||
all_known_handle_types.push_back(
|
||||
{ "VK_KHR_external_semaphore_fd",
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD });
|
||||
all_known_handle_types.push_back(
|
||||
{ "VK_KHR_external_semaphore_win32",
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT });
|
||||
all_known_handle_types.push_back(
|
||||
{ "VK_KHR_external_semaphore_win32",
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT });
|
||||
|
||||
std::vector<VulkanExternalSemaphoreHandleType>
|
||||
externalSemaphoreHandleTypeList;
|
||||
|
||||
#if _WIN32
|
||||
if (IsWindows8OrGreater())
|
||||
for (auto handle_type : all_known_handle_types)
|
||||
{
|
||||
externalSemaphoreHandleTypeList.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT);
|
||||
if (!vkDevice.getPhysicalDevice().hasExtension(
|
||||
handle_type.extension_name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
VkPhysicalDeviceExternalSemaphoreInfo handle_query = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, nullptr,
|
||||
handle_type.vk_type
|
||||
};
|
||||
VkExternalSemaphoreProperties query_result = {};
|
||||
vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(
|
||||
vkDevice.getPhysicalDevice(), &handle_query, &query_result);
|
||||
if (query_result.externalSemaphoreFeatures
|
||||
& (VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR
|
||||
| VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR))
|
||||
{
|
||||
externalSemaphoreHandleTypeList.push_back(handle_type.enum_type);
|
||||
}
|
||||
}
|
||||
externalSemaphoreHandleTypeList.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT);
|
||||
#elif defined(__ANDROID__)
|
||||
externalSemaphoreHandleTypeList.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD);
|
||||
#else
|
||||
externalSemaphoreHandleTypeList.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD);
|
||||
#endif
|
||||
|
||||
return externalSemaphoreHandleTypeList;
|
||||
}
|
||||
|
||||
std::vector<VulkanExternalSemaphoreHandleType>
|
||||
getSupportedInteropExternalSemaphoreHandleTypes(cl_device_id device,
|
||||
VulkanDevice &vkDevice)
|
||||
{
|
||||
const std::vector<VulkanExternalSemaphoreHandleType>
|
||||
supportedVkSemaphoreTypes =
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList(vkDevice);
|
||||
std::vector<VulkanExternalSemaphoreHandleType> supportedSemaphoreTypes;
|
||||
|
||||
if (is_extension_available(device, "cl_khr_external_semaphore_opaque_fd")
|
||||
&& std::count(supportedVkSemaphoreTypes.begin(),
|
||||
supportedVkSemaphoreTypes.end(),
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD))
|
||||
{
|
||||
supportedSemaphoreTypes.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD);
|
||||
}
|
||||
|
||||
if (is_extension_available(device, "cl_khr_external_semaphore_sync_fd")
|
||||
&& std::count(supportedVkSemaphoreTypes.begin(),
|
||||
supportedVkSemaphoreTypes.end(),
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD))
|
||||
{
|
||||
supportedSemaphoreTypes.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD);
|
||||
}
|
||||
|
||||
if (is_extension_available(device, "cl_khr_external_semaphore_win32")
|
||||
&& std::count(supportedVkSemaphoreTypes.begin(),
|
||||
supportedVkSemaphoreTypes.end(),
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT))
|
||||
{
|
||||
supportedSemaphoreTypes.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT);
|
||||
}
|
||||
|
||||
if (is_extension_available(device, "cl_khr_external_semaphore_win32")
|
||||
&& std::count(supportedVkSemaphoreTypes.begin(),
|
||||
supportedVkSemaphoreTypes.end(),
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT))
|
||||
{
|
||||
supportedSemaphoreTypes.push_back(
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT);
|
||||
}
|
||||
|
||||
return supportedSemaphoreTypes;
|
||||
}
|
||||
|
||||
const std::vector<VulkanFormat> getSupportedVulkanFormatList()
|
||||
{
|
||||
std::vector<VulkanFormat> formatList;
|
||||
@@ -498,7 +581,6 @@ cl_external_semaphore_handle_type_khr getCLSemaphoreTypeFromVulkanType(
|
||||
clExternalSemaphoreHandleTypeKhr =
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR;
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
|
||||
clExternalSemaphoreHandleTypeKhr =
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR;
|
||||
@@ -631,8 +713,8 @@ operator<<(std::ostream &os,
|
||||
return os << "Opaque NT handle";
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
|
||||
return os << "Opaque D3DKMT handle";
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
|
||||
return os << "Opaque NT and D3DKMT handle";
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD:
|
||||
return os << "Sync fd semaphore handle";
|
||||
}
|
||||
|
||||
return os;
|
||||
|
||||
@@ -46,7 +46,10 @@ getDefaultVulkanQueueFamilyToQueueCountMap();
|
||||
const std::vector<VulkanExternalMemoryHandleType>
|
||||
getSupportedVulkanExternalMemoryHandleTypeList();
|
||||
const std::vector<VulkanExternalSemaphoreHandleType>
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList();
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList(const VulkanDevice& vkDevice);
|
||||
std::vector<VulkanExternalSemaphoreHandleType>
|
||||
getSupportedInteropExternalSemaphoreHandleTypes(cl_device_id device,
|
||||
VulkanDevice& vkDevice);
|
||||
const std::vector<VulkanFormat> getSupportedVulkanFormatList();
|
||||
|
||||
uint32_t getVulkanFormatElementSize(VulkanFormat format);
|
||||
|
||||
@@ -335,6 +335,16 @@ VulkanPhysicalDevice::VulkanPhysicalDevice(VkPhysicalDevice vkPhysicalDevice)
|
||||
memoryHeap);
|
||||
m_memoryTypeList.add(*memoryType);
|
||||
}
|
||||
|
||||
uint32_t num_extensions = 0;
|
||||
vkEnumerateDeviceExtensionProperties(m_vkPhysicalDevice, nullptr,
|
||||
&num_extensions, nullptr);
|
||||
if (num_extensions)
|
||||
{
|
||||
m_extensions.resize(num_extensions);
|
||||
vkEnumerateDeviceExtensionProperties(
|
||||
m_vkPhysicalDevice, nullptr, &num_extensions, m_extensions.data());
|
||||
}
|
||||
}
|
||||
|
||||
VulkanPhysicalDevice::~VulkanPhysicalDevice()
|
||||
@@ -388,6 +398,18 @@ VulkanPhysicalDevice::operator VkPhysicalDevice() const
|
||||
return m_vkPhysicalDevice;
|
||||
}
|
||||
|
||||
bool VulkanPhysicalDevice::hasExtension(const char *extension_name) const
|
||||
{
|
||||
for (const auto &m_extension : m_extensions)
|
||||
{
|
||||
if (!strcmp(m_extension.extensionName, extension_name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator<(const VulkanQueueFamily &queueFamilyA,
|
||||
const VulkanQueueFamily &queueFamilyB)
|
||||
{
|
||||
@@ -2256,6 +2278,8 @@ VulkanSemaphore::VulkanSemaphore(
|
||||
vkCreateSemaphore(m_device, &vkSemaphoreCreateInfo, NULL, &m_vkSemaphore);
|
||||
}
|
||||
|
||||
const VulkanDevice &VulkanSemaphore::getDevice() const { return m_device; }
|
||||
|
||||
VulkanSemaphore::~VulkanSemaphore()
|
||||
{
|
||||
vkDestroySemaphore(m_device, m_vkSemaphore, NULL);
|
||||
@@ -2301,6 +2325,23 @@ int VulkanSemaphore::getHandle(
|
||||
|
||||
return fd;
|
||||
}
|
||||
else if (externalSemaphoreHandleType
|
||||
== VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
|
||||
{
|
||||
int fd;
|
||||
|
||||
VkSemaphoreGetFdInfoKHR vkSemaphoreGetFdInfoKHR = {};
|
||||
vkSemaphoreGetFdInfoKHR.sType =
|
||||
VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR;
|
||||
vkSemaphoreGetFdInfoKHR.pNext = NULL;
|
||||
vkSemaphoreGetFdInfoKHR.semaphore = m_vkSemaphore;
|
||||
vkSemaphoreGetFdInfoKHR.handleType =
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR;
|
||||
|
||||
vkGetSemaphoreFdKHR(m_device, &vkSemaphoreGetFdInfoKHR, &fd);
|
||||
|
||||
return fd;
|
||||
}
|
||||
return HANDLE_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -53,12 +53,15 @@ protected:
|
||||
VulkanQueueFamilyList m_queueFamilyList;
|
||||
VulkanMemoryHeapList m_memoryHeapList;
|
||||
VulkanMemoryTypeList m_memoryTypeList;
|
||||
std::vector<VkExtensionProperties> m_extensions;
|
||||
|
||||
|
||||
VulkanPhysicalDevice(const VulkanPhysicalDevice &physicalDevice);
|
||||
VulkanPhysicalDevice(VkPhysicalDevice vkPhysicalDevice);
|
||||
virtual ~VulkanPhysicalDevice();
|
||||
|
||||
public:
|
||||
bool hasExtension(const char *extension_name) const;
|
||||
const VulkanQueueFamilyList &getQueueFamilyList() const;
|
||||
const VulkanMemoryHeapList &getMemoryHeapList() const;
|
||||
const VulkanMemoryTypeList &getMemoryTypeList() const;
|
||||
@@ -537,6 +540,7 @@ protected:
|
||||
uint64_t m_size;
|
||||
bool m_isDedicated;
|
||||
|
||||
|
||||
VulkanDeviceMemory(const VulkanDeviceMemory &deviceMemory);
|
||||
|
||||
public:
|
||||
@@ -588,6 +592,7 @@ public:
|
||||
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType =
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NONE,
|
||||
const std::wstring name = L"");
|
||||
const VulkanDevice &getDevice() const;
|
||||
virtual ~VulkanSemaphore();
|
||||
#ifdef _WIN32
|
||||
HANDLE getHandle(
|
||||
|
||||
@@ -167,9 +167,6 @@ enum VulkanExternalSemaphoreHandleType
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT =
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT =
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR
|
||||
| VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR,
|
||||
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD =
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ static void params_reset()
|
||||
|
||||
extern int test_buffer_common(cl_device_id device_, cl_context context_,
|
||||
cl_command_queue queue_, int numElements_,
|
||||
float use_fence);
|
||||
bool use_fence);
|
||||
extern int test_image_common(cl_device_id device_, cl_context context_,
|
||||
cl_command_queue queue_, int numElements_);
|
||||
|
||||
@@ -227,10 +227,6 @@ size_t parseParams(int argc, const char *argv[], const char **argList)
|
||||
{
|
||||
disableNTHandleType = true;
|
||||
}
|
||||
if (!strcmp(argv[i], "--enableOffset"))
|
||||
{
|
||||
enableOffset = true;
|
||||
}
|
||||
if (strcmp(argv[i], "-h") == 0)
|
||||
{
|
||||
printUsage(argv[0]);
|
||||
|
||||
@@ -219,9 +219,8 @@ int test_consistency_external_image(cl_device_id deviceID, cl_context _context,
|
||||
#else
|
||||
if (!is_extension_available(devList[0], "cl_khr_external_memory_opaque_fd"))
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Device does not support cl_khr_external_memory_opaque_fd "
|
||||
"extension \n");
|
||||
test_fail("Device does not support cl_khr_external_memory_opaque_fd "
|
||||
"extension \n");
|
||||
}
|
||||
#endif
|
||||
uint32_t width = 256;
|
||||
@@ -324,26 +323,6 @@ int test_consistency_external_image(cl_device_id deviceID, cl_context _context,
|
||||
test_error(errNum, "Unable to create Image with Properties");
|
||||
image.reset();
|
||||
|
||||
// Passing properties, image_desc and image_format all as NULL
|
||||
image = clCreateImageWithProperties(context, NULL, CL_MEM_READ_WRITE, NULL,
|
||||
NULL, NULL, &errNum);
|
||||
test_failure_error(
|
||||
errNum, CL_INVALID_IMAGE_DESCRIPTOR,
|
||||
"Image creation must fail with CL_INVALID_IMAGE_DESCRIPTOR "
|
||||
"when all are passed as NULL");
|
||||
|
||||
image.reset();
|
||||
|
||||
// Passing NULL properties and a valid image_format and image_desc
|
||||
image =
|
||||
clCreateImageWithProperties(context, NULL, CL_MEM_READ_WRITE,
|
||||
&img_format, &image_desc, NULL, &errNum);
|
||||
test_error(errNum,
|
||||
"Unable to create image with NULL properties "
|
||||
"with valid image format and image desc");
|
||||
|
||||
image.reset();
|
||||
|
||||
// Passing image_format as NULL
|
||||
image = clCreateImageWithProperties(context, extMemProperties.data(),
|
||||
CL_MEM_READ_WRITE, NULL, &image_desc,
|
||||
@@ -396,88 +375,92 @@ int test_consistency_external_semaphore(cl_device_id deviceID,
|
||||
|
||||
cl_device_id devList[] = { deviceID, NULL };
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!is_extension_available(devList[0], "cl_khr_external_semaphore_win32"))
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Device does not support cl_khr_external_semaphore_win32 "
|
||||
"extension \n");
|
||||
}
|
||||
#else
|
||||
if (!is_extension_available(devList[0],
|
||||
"cl_khr_external_semaphore_opaque_fd"))
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Device does not support "
|
||||
"cl_khr_external_semaphore_opaque_fd extension \n");
|
||||
}
|
||||
#endif
|
||||
VulkanExternalSemaphoreHandleType vkExternalSemaphoreHandleType =
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList()[0];
|
||||
VulkanSemaphore vkVk2Clsemaphore(vkDevice, vkExternalSemaphoreHandleType);
|
||||
VulkanSemaphore vkCl2Vksemaphore(vkDevice, vkExternalSemaphoreHandleType);
|
||||
cl_semaphore_khr clCl2Vksemaphore;
|
||||
cl_semaphore_khr clVk2Clsemaphore;
|
||||
std::vector<VulkanExternalSemaphoreHandleType> supportedExternalSemaphores =
|
||||
getSupportedInteropExternalSemaphoreHandleTypes(devList[0], vkDevice);
|
||||
|
||||
void* handle1 = NULL;
|
||||
void* handle2 = NULL;
|
||||
int fd1, fd2;
|
||||
std::vector<cl_semaphore_properties_khr> sema_props1{
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
|
||||
};
|
||||
std::vector<cl_semaphore_properties_khr> sema_props2{
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
|
||||
};
|
||||
switch (vkExternalSemaphoreHandleType)
|
||||
if (supportedExternalSemaphores.empty())
|
||||
{
|
||||
test_fail("No supported external semaphore types found\n");
|
||||
}
|
||||
|
||||
for (VulkanExternalSemaphoreHandleType semaphoreHandleType :
|
||||
supportedExternalSemaphores)
|
||||
{
|
||||
VulkanSemaphore vkVk2Clsemaphore(vkDevice, semaphoreHandleType);
|
||||
VulkanSemaphore vkCl2Vksemaphore(vkDevice, semaphoreHandleType);
|
||||
cl_semaphore_khr clCl2Vksemaphore;
|
||||
cl_semaphore_khr clVk2Clsemaphore;
|
||||
void* handle1 = NULL;
|
||||
void* handle2 = NULL;
|
||||
int fd1, fd2;
|
||||
std::vector<cl_semaphore_properties_khr> sema_props1{
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
|
||||
};
|
||||
std::vector<cl_semaphore_properties_khr> sema_props2{
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
|
||||
};
|
||||
switch (semaphoreHandleType)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT:
|
||||
log_info(" Opaque NT handles are only supported on Windows\n");
|
||||
handle1 = vkVk2Clsemaphore.getHandle(vkExternalSemaphoreHandleType);
|
||||
handle2 = vkCl2Vksemaphore.getHandle(vkExternalSemaphoreHandleType);
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)handle1);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)handle2);
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
|
||||
log_info(" Opaque D3DKMT handles are only supported on Windows\n");
|
||||
handle1 = vkVk2Clsemaphore.getHandle(vkExternalSemaphoreHandleType);
|
||||
handle2 = vkCl2Vksemaphore.getHandle(vkExternalSemaphoreHandleType);
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)handle1);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)handle2);
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT:
|
||||
log_info(" Opaque NT handles are only supported on Windows\n");
|
||||
handle1 = vkVk2Clsemaphore.getHandle(semaphoreHandleType);
|
||||
handle2 = vkCl2Vksemaphore.getHandle(semaphoreHandleType);
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)handle1);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)handle2);
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
|
||||
log_info(
|
||||
" Opaque D3DKMT handles are only supported on Windows\n");
|
||||
handle1 = vkVk2Clsemaphore.getHandle(semaphoreHandleType);
|
||||
handle2 = vkCl2Vksemaphore.getHandle(semaphoreHandleType);
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR);
|
||||
sema_props1.push_back(
|
||||
(cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)handle1);
|
||||
sema_props2.push_back(
|
||||
(cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)handle2);
|
||||
break;
|
||||
#else
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD:
|
||||
log_info(" Opaque file descriptors are not supported on Windows\n");
|
||||
fd1 =
|
||||
(int)vkVk2Clsemaphore.getHandle(vkExternalSemaphoreHandleType);
|
||||
fd2 =
|
||||
(int)vkCl2Vksemaphore.getHandle(vkExternalSemaphoreHandleType);
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
|
||||
sema_props1.push_back(
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)fd1);
|
||||
sema_props2.push_back(
|
||||
(cl_semaphore_properties_khr)CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)fd2);
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD:
|
||||
fd1 = (int)vkVk2Clsemaphore.getHandle(semaphoreHandleType);
|
||||
fd2 = (int)vkCl2Vksemaphore.getHandle(semaphoreHandleType);
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)fd1);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)fd2);
|
||||
break;
|
||||
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD:
|
||||
fd1 = -1;
|
||||
fd2 = -1;
|
||||
errNum = check_external_semaphore_handle_type(
|
||||
devList[0], CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
|
||||
sema_props1.push_back((cl_semaphore_properties_khr)fd1);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)
|
||||
CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
|
||||
sema_props2.push_back((cl_semaphore_properties_khr)fd2);
|
||||
break;
|
||||
#endif
|
||||
default: log_error("Unsupported external memory handle type\n"); break;
|
||||
}
|
||||
}
|
||||
if (CL_SUCCESS != errNum)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
@@ -532,31 +515,6 @@ int test_consistency_external_semaphore(cl_device_id deviceID,
|
||||
test_error(errNum,
|
||||
"Unable to create semaphore with valid semaphore properties");
|
||||
|
||||
|
||||
// Call Signal twice consecutively
|
||||
errNum = clEnqueueSignalSemaphoresKHRptr(cmd_queue, 1, &clVk2Clsemaphore,
|
||||
NULL, 0, NULL, NULL);
|
||||
test_error(errNum, "clEnqueueSignalSemaphoresKHRptr failed");
|
||||
|
||||
errNum = clEnqueueSignalSemaphoresKHRptr(cmd_queue, 1, &clCl2Vksemaphore,
|
||||
NULL, 0, NULL, NULL);
|
||||
test_error(errNum,
|
||||
"clEnqueueSignalSemaphoresKHRptr failed for two "
|
||||
"consecutive wait events");
|
||||
|
||||
|
||||
// Call Wait twice consecutively
|
||||
errNum = clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &clVk2Clsemaphore,
|
||||
NULL, 0, NULL, NULL);
|
||||
test_error(errNum, "clEnqueueWaitSemaphoresKHRptr failed");
|
||||
|
||||
errNum = clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &clCl2Vksemaphore,
|
||||
NULL, 0, NULL, NULL);
|
||||
test_error(errNum,
|
||||
"clEnqueueWaitSemaphoresKHRptr failed for two "
|
||||
" consecutive wait events");
|
||||
|
||||
|
||||
// Pass invalid object to release call
|
||||
errNum = clReleaseSemaphoreKHRptr(NULL);
|
||||
test_failure_error(errNum, CL_INVALID_VALUE,
|
||||
@@ -569,6 +527,7 @@ int test_consistency_external_semaphore(cl_device_id deviceID,
|
||||
|
||||
errNum = clReleaseSemaphoreKHRptr(clCl2Vksemaphore);
|
||||
test_error(errNum, "clReleaseSemaphoreKHRptr failed");
|
||||
}
|
||||
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
#include <string>
|
||||
#include "harness/errorHelpers.h"
|
||||
#include <algorithm>
|
||||
#include "deviceInfo.h"
|
||||
|
||||
#define MAX_2D_IMAGES 5
|
||||
#define MAX_2D_IMAGE_WIDTH 1024
|
||||
@@ -189,11 +190,11 @@ const cl_kernel getKernelType(VulkanFormat format, cl_kernel kernel_float,
|
||||
return kernel;
|
||||
}
|
||||
|
||||
int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
cl_command_queue &cmd_queue2,
|
||||
cl_kernel *kernel_unsigned,
|
||||
cl_kernel *kernel_signed, cl_kernel *kernel_float,
|
||||
VulkanDevice &vkDevice)
|
||||
int run_test_with_two_queue(
|
||||
cl_context &context, cl_command_queue &cmd_queue1,
|
||||
cl_command_queue &cmd_queue2, cl_kernel *kernel_unsigned,
|
||||
cl_kernel *kernel_signed, cl_kernel *kernel_float, VulkanDevice &vkDevice,
|
||||
VulkanExternalSemaphoreHandleType vkExternalSemaphoreHandleType)
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
size_t origin[3] = { 0, 0, 0 };
|
||||
@@ -245,8 +246,6 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
VulkanCommandBuffer vkShaderCommandBuffer(vkDevice, vkCommandPool);
|
||||
VulkanQueue &vkQueue = vkDevice.getQueue();
|
||||
|
||||
VulkanExternalSemaphoreHandleType vkExternalSemaphoreHandleType =
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList()[0];
|
||||
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
|
||||
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
|
||||
clExternalSemaphore *clVk2CLExternalSemaphore = NULL;
|
||||
@@ -462,7 +461,11 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
->getExternalMemoryImage();
|
||||
}
|
||||
|
||||
clCl2VkExternalSemaphore->signal(cmd_queue1);
|
||||
err = clCl2VkExternalSemaphore->signal(cmd_queue1);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to signal CL semaphore\n");
|
||||
|
||||
if (!useSingleImageKernel)
|
||||
{
|
||||
vkDescriptorSet.updateArray(1,
|
||||
@@ -499,6 +502,7 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
1);
|
||||
vkShaderCommandBuffer.end();
|
||||
}
|
||||
|
||||
for (uint32_t iter = 0; iter < innerIterations;
|
||||
iter++)
|
||||
{
|
||||
@@ -552,7 +556,17 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
vkQueue.submit(vkCl2VkSemaphore,
|
||||
vkShaderCommandBuffer,
|
||||
vkVk2CLSemaphore);
|
||||
clVk2CLExternalSemaphore->wait(cmd_queue1);
|
||||
|
||||
err =
|
||||
clVk2CLExternalSemaphore->wait(cmd_queue1);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err,
|
||||
"Error: failed to wait on CL "
|
||||
"external semaphore\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
switch (num2DImages)
|
||||
{
|
||||
case 2:
|
||||
@@ -626,14 +640,10 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
err |= clSetKernelArg(updateKernelCQ1, ++j,
|
||||
sizeof(unsigned int),
|
||||
&numMipLevels);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Error: Failed to set arg values \n");
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(
|
||||
err,
|
||||
"Error: Failed to set arg values \n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
// clVk2CLExternalSemaphore->wait(cmd_queue1);
|
||||
size_t global_work_size[3] = { width, height,
|
||||
1 };
|
||||
@@ -642,21 +652,24 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
cmd_queue1, updateKernelCQ1, 2, NULL,
|
||||
global_work_size, NULL, 0, NULL,
|
||||
&first_launch);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to enqueue updateKernelCQ1\n");
|
||||
|
||||
err = clEnqueueNDRangeKernel(
|
||||
cmd_queue2, updateKernelCQ2, 2, NULL,
|
||||
global_work_size, NULL, 1, &first_launch,
|
||||
NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to enqueue updateKernelCQ2\n");
|
||||
|
||||
clFinish(cmd_queue2);
|
||||
clCl2VkExternalSemaphore->signal(cmd_queue2);
|
||||
err = clCl2VkExternalSemaphore->signal(
|
||||
cmd_queue2);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to signal CL semaphore\n");
|
||||
}
|
||||
|
||||
unsigned int flags = 0;
|
||||
@@ -668,14 +681,11 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
err = clEnqueueReadImage(
|
||||
cmd_queue1, external_mem_image2[i], CL_TRUE,
|
||||
origin, region, 0, 0, dstBufferPtr, 0, NULL,
|
||||
&eventReadImage);
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err,
|
||||
"clEnqueueReadImage failed with"
|
||||
"error\n");
|
||||
}
|
||||
NULL);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"clEnqueueReadImage failed with"
|
||||
"error\n");
|
||||
|
||||
if (memcmp(srcBufferPtr, dstBufferPtr,
|
||||
srcBufSize))
|
||||
@@ -727,10 +737,8 @@ int run_test_with_two_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
externalMemory2.erase(externalMemory2.begin(),
|
||||
externalMemory2.begin()
|
||||
+ num2DImages);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP,
|
||||
"Test error detected\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -748,10 +756,11 @@ CLEANUP:
|
||||
return err;
|
||||
}
|
||||
|
||||
int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
cl_kernel *kernel_unsigned,
|
||||
cl_kernel *kernel_signed, cl_kernel *kernel_float,
|
||||
VulkanDevice &vkDevice)
|
||||
int run_test_with_one_queue(
|
||||
cl_context &context, cl_command_queue &cmd_queue1,
|
||||
cl_kernel *kernel_unsigned, cl_kernel *kernel_signed,
|
||||
cl_kernel *kernel_float, VulkanDevice &vkDevice,
|
||||
VulkanExternalSemaphoreHandleType vkExternalSemaphoreHandleType)
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
size_t origin[3] = { 0, 0, 0 };
|
||||
@@ -802,8 +811,6 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
VulkanCommandBuffer vkShaderCommandBuffer(vkDevice, vkCommandPool);
|
||||
VulkanQueue &vkQueue = vkDevice.getQueue();
|
||||
|
||||
VulkanExternalSemaphoreHandleType vkExternalSemaphoreHandleType =
|
||||
getSupportedVulkanExternalSemaphoreHandleTypeList()[0];
|
||||
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
|
||||
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
|
||||
clExternalSemaphore *clVk2CLExternalSemaphore = NULL;
|
||||
@@ -925,8 +932,8 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
vkClExternalMemoryHandleTilingAssumption(
|
||||
deviceId,
|
||||
vkExternalMemoryHandleTypeList[emhtIdx], &err);
|
||||
ASSERT_SUCCESS(err,
|
||||
"Failed to query OpenCL tiling mode");
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP, "Failed to query OpenCL tiling mode");
|
||||
|
||||
VulkanImage2D vkDummyImage2D(
|
||||
vkDevice, vkFormatList[0], widthList[0],
|
||||
@@ -1024,7 +1031,11 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
->getExternalMemoryImage();
|
||||
}
|
||||
|
||||
clCl2VkExternalSemaphore->signal(cmd_queue1);
|
||||
err = clCl2VkExternalSemaphore->signal(cmd_queue1);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to signal CL semaphore\n");
|
||||
|
||||
if (!useSingleImageKernel)
|
||||
{
|
||||
vkDescriptorSet.updateArray(1,
|
||||
@@ -1061,6 +1072,7 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
1);
|
||||
vkShaderCommandBuffer.end();
|
||||
}
|
||||
|
||||
for (uint32_t iter = 0; iter < innerIterations;
|
||||
iter++)
|
||||
{
|
||||
@@ -1114,7 +1126,14 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
vkQueue.submit(vkCl2VkSemaphore,
|
||||
vkShaderCommandBuffer,
|
||||
vkVk2CLSemaphore);
|
||||
clVk2CLExternalSemaphore->wait(cmd_queue1);
|
||||
|
||||
err =
|
||||
clVk2CLExternalSemaphore->wait(cmd_queue1);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Error: failed to wait on CL external "
|
||||
"semaphore\n");
|
||||
|
||||
switch (num2DImages)
|
||||
{
|
||||
case 1:
|
||||
@@ -1158,25 +1177,25 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
err |= clSetKernelArg(updateKernelCQ1, ++j,
|
||||
sizeof(unsigned int),
|
||||
&numMipLevels);
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err,
|
||||
"Error: Failed to set arg "
|
||||
"values for kernel-1\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Error: Failed to set arg "
|
||||
"values for kernel-1\n");
|
||||
|
||||
size_t global_work_size[3] = { width, height,
|
||||
1 };
|
||||
err = clEnqueueNDRangeKernel(
|
||||
cmd_queue1, updateKernelCQ1, 2, NULL,
|
||||
global_work_size, NULL, 0, NULL, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
goto CLEANUP;
|
||||
}
|
||||
clCl2VkExternalSemaphore->signal(cmd_queue1);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to enqueue updateKernelCQ1\n");
|
||||
|
||||
err = clCl2VkExternalSemaphore->signal(
|
||||
cmd_queue1);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"Failed to signal CL semaphore\n");
|
||||
}
|
||||
|
||||
unsigned int flags = 0;
|
||||
@@ -1187,14 +1206,11 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
err = clEnqueueReadImage(
|
||||
cmd_queue1, external_mem_image2[i], CL_TRUE,
|
||||
origin, region, 0, 0, dstBufferPtr, 0, NULL,
|
||||
&eventReadImage);
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err,
|
||||
"clEnqueueReadImage failed with"
|
||||
"error\n");
|
||||
}
|
||||
NULL);
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP,
|
||||
"clEnqueueReadImage failed with"
|
||||
"error\n");
|
||||
|
||||
if (memcmp(srcBufferPtr, dstBufferPtr,
|
||||
srcBufSize))
|
||||
@@ -1246,10 +1262,8 @@ int run_test_with_one_queue(cl_context &context, cl_command_queue &cmd_queue1,
|
||||
externalMemory2.erase(externalMemory2.begin(),
|
||||
externalMemory2.begin()
|
||||
+ num2DImages);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP,
|
||||
"Test detected error\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1293,44 +1307,35 @@ int test_image_common(cl_device_id device_, cl_context context_,
|
||||
char source_2[4096];
|
||||
char source_3[4096];
|
||||
size_t program_source_length;
|
||||
cl_program program[num_kernel_types];
|
||||
cl_kernel kernel_float[num_kernels] = { NULL, NULL, NULL, NULL };
|
||||
cl_kernel kernel_signed[num_kernels] = { NULL, NULL, NULL, NULL };
|
||||
cl_kernel kernel_unsigned[num_kernels] = { NULL, NULL, NULL, NULL };
|
||||
cl_program program[num_kernel_types] = { NULL };
|
||||
cl_kernel kernel_float[num_kernels] = { NULL };
|
||||
cl_kernel kernel_signed[num_kernels] = { NULL };
|
||||
cl_kernel kernel_unsigned[num_kernels] = { NULL };
|
||||
cl_mem external_mem_image1;
|
||||
cl_mem external_mem_image2;
|
||||
std::vector<VulkanExternalSemaphoreHandleType> supportedSemaphoreTypes;
|
||||
|
||||
VulkanDevice vkDevice;
|
||||
|
||||
cl_context_properties contextProperties[] = { CL_CONTEXT_PLATFORM, 0, 0 };
|
||||
// get the platform ID
|
||||
err = clGetPlatformIDs(1, &platform, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err, "Error: Failed to get platform\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "Error: Failed to get platform\n");
|
||||
|
||||
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &num_devices);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
print_error(err, "clGetDeviceIDs failed in returning no. of devices\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(
|
||||
err, CLEANUP, "clGetDeviceIDs failed in returning no. of devices\n");
|
||||
|
||||
devices = (cl_device_id *)malloc(num_devices * sizeof(cl_device_id));
|
||||
if (NULL == devices)
|
||||
{
|
||||
err = CL_OUT_OF_HOST_MEMORY;
|
||||
print_error(err, "Unable to allocate memory for devices\n");
|
||||
goto CLEANUP;
|
||||
test_fail_and_cleanup(err, CLEANUP,
|
||||
"Unable to allocate memory for devices\n");
|
||||
}
|
||||
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, num_devices, devices,
|
||||
NULL);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
print_error(err, "Failed to get deviceID.\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "Failed to get deviceID.\n");
|
||||
|
||||
contextProperties[1] = (cl_context_properties)platform;
|
||||
log_info("Assigned contextproperties for platform\n");
|
||||
for (device_no = 0; device_no < num_devices; device_no++)
|
||||
@@ -1360,12 +1365,20 @@ int test_image_common(cl_device_id device_, cl_context context_,
|
||||
goto CLEANUP;
|
||||
}
|
||||
err = clGetDeviceInfo(devices[device_no], CL_DEVICE_UUID_KHR,
|
||||
CL_UUID_SIZE_KHR, uuid, &extensionSize);
|
||||
if (CL_SUCCESS != err)
|
||||
CL_UUID_SIZE_KHR, uuid, NULL);
|
||||
test_error_and_cleanup(err, CLEANUP,
|
||||
"clGetDeviceInfo failed with error");
|
||||
|
||||
supportedSemaphoreTypes =
|
||||
getSupportedInteropExternalSemaphoreHandleTypes(devices[device_no],
|
||||
vkDevice);
|
||||
|
||||
// If device does not support any semaphores, try the next one
|
||||
if (supportedSemaphoreTypes.empty())
|
||||
{
|
||||
print_error(err, "clGetDeviceInfo failed with error");
|
||||
goto CLEANUP;
|
||||
continue;
|
||||
}
|
||||
|
||||
err =
|
||||
memcmp(uuid, vkDevice.getPhysicalDevice().getUUID(), VK_UUID_SIZE);
|
||||
if (err == 0)
|
||||
@@ -1373,48 +1386,41 @@ int test_image_common(cl_device_id device_, cl_context context_,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (supportedSemaphoreTypes.empty())
|
||||
{
|
||||
test_fail_and_cleanup(
|
||||
err, CLEANUP, "No devices found that support OpenCL semaphores\n");
|
||||
}
|
||||
|
||||
if (device_no >= num_devices)
|
||||
{
|
||||
err = EXIT_FAILURE;
|
||||
print_error(err,
|
||||
"OpenCL error:"
|
||||
"No Vulkan-OpenCL Interop capable GPU found.\n");
|
||||
goto CLEANUP;
|
||||
test_fail_and_cleanup(err, CLEANUP,
|
||||
"OpenCL error:"
|
||||
"No Vulkan-OpenCL Interop capable GPU found.\n");
|
||||
}
|
||||
deviceId = devices[device_no];
|
||||
err = setMaxImageDimensions(deviceId, max_width, max_height);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
print_error(err, "error setting max image dimensions");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "error setting max image dimensions");
|
||||
|
||||
log_info("Set max_width to %lu and max_height to %lu\n", max_width,
|
||||
max_height);
|
||||
context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_GPU,
|
||||
NULL, NULL, &err);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
print_error(err, "error creating context");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "error creating context");
|
||||
|
||||
log_info("Successfully created context !!!\n");
|
||||
|
||||
cmd_queue1 = clCreateCommandQueue(context, devices[device_no], 0, &err);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
err = CL_INVALID_COMMAND_QUEUE;
|
||||
print_error(err, "Error: Failed to create command queue!\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP,
|
||||
"Error: Failed to create command queue!\n");
|
||||
|
||||
log_info("clCreateCommandQueue successfull \n");
|
||||
|
||||
cmd_queue2 = clCreateCommandQueue(context, devices[device_no], 0, &err);
|
||||
if (CL_SUCCESS != err)
|
||||
{
|
||||
err = CL_INVALID_COMMAND_QUEUE;
|
||||
print_error(err, "Error: Failed to create command queue!\n");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP,
|
||||
"Error: Failed to create command queue!\n");
|
||||
|
||||
log_info("clCreateCommandQueue2 successful \n");
|
||||
|
||||
for (int i = 0; i < num_kernels; i++)
|
||||
@@ -1473,42 +1479,33 @@ int test_image_common(cl_device_id device_, cl_context context_,
|
||||
context, 1, &sourceTexts[k], &program_source_length, &err);
|
||||
err |= clBuildProgram(program[k], 0, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "Error: Failed to build program");
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err, "Error: Failed to build program");
|
||||
goto CLEANUP;
|
||||
}
|
||||
// create the kernel
|
||||
kernel_float[i] = clCreateKernel(program[0], "image2DKernel", &err);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err, "clCreateKernel failed");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "clCreateKernel failed");
|
||||
|
||||
kernel_signed[i] = clCreateKernel(program[1], "image2DKernel", &err);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
print_error(err, "clCreateKernel failed");
|
||||
goto CLEANUP;
|
||||
}
|
||||
test_error_and_cleanup(err, CLEANUP, "clCreateKernel failed");
|
||||
|
||||
kernel_unsigned[i] = clCreateKernel(program[2], "image2DKernel", &err);
|
||||
if (err != CL_SUCCESS)
|
||||
test_error_and_cleanup(err, CLEANUP, "clCreateKernel failed ");
|
||||
}
|
||||
for (VulkanExternalSemaphoreHandleType externalSemaphoreType :
|
||||
supportedSemaphoreTypes)
|
||||
{
|
||||
if (numCQ == 2)
|
||||
{
|
||||
print_error(err, "clCreateKernel failed ");
|
||||
goto CLEANUP;
|
||||
err = run_test_with_two_queue(
|
||||
context, cmd_queue1, cmd_queue2, kernel_unsigned, kernel_signed,
|
||||
kernel_float, vkDevice, externalSemaphoreType);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = run_test_with_one_queue(context, cmd_queue1, kernel_unsigned,
|
||||
kernel_signed, kernel_float, vkDevice,
|
||||
externalSemaphoreType);
|
||||
}
|
||||
}
|
||||
if (numCQ == 2)
|
||||
{
|
||||
err = run_test_with_two_queue(context, cmd_queue1, cmd_queue2,
|
||||
kernel_unsigned, kernel_signed,
|
||||
kernel_float, vkDevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = run_test_with_one_queue(context, cmd_queue1, kernel_unsigned,
|
||||
kernel_signed, kernel_float, vkDevice);
|
||||
}
|
||||
CLEANUP:
|
||||
for (int i = 0; i < num_kernels; i++)
|
||||
|
||||
@@ -43,7 +43,5 @@ extern bool debug_trace;
|
||||
extern bool useSingleImageKernel;
|
||||
extern bool useDeviceLocal;
|
||||
extern bool disableNTHandleType;
|
||||
// Enable offset for multiImport of vulkan device memory
|
||||
extern bool enableOffset;
|
||||
|
||||
#endif // _vulkan_interop_common_hpp_
|
||||
|
||||
Reference in New Issue
Block a user