mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-20 06:29:02 +00:00
External memory updates (#1676)
* Vulkan: Fix descriptor sets Use descriptor set arrays when programming arrays for compute shader. Change-Id: Idabab775a256a223660eb7a850e26f290453659e * Vulkan: Fix queue propertyies Transfer bit for queue family is not required to be reported by the implementation, it is implicit for compute. Change-Id: I7424b00e25e35145433dd74b0b4dfe7eeeaf98c8 * Vulkan: Allow implementation to choose dedicated memory Dedicated vs non-dedicated memory must be queried by the app. Implementations are not required to support exportable non-dedicated memory. Change-Id: Idbc46ace1be20f61d1b58b34756f6d79a7745911 * Fix formatting Auto-generated formatting fix * Fix bug in dedicated memory. * Add check for if OpenCL assumes linear tiling Change-Id: Idd2e24d9d69e1fbc3ccb4a279067533104185332 * Changed macro name to reflect spec CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_HANDLE_TYPES_KHR to CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR Also changed some functions to not use the KHR variants. --------- Co-authored-by: Joshua Kelly <joshkell@qti.qualcomm.com>
This commit is contained in:
committed by
GitHub
parent
c511ac62b0
commit
15b54aa0bd
@@ -19,7 +19,7 @@
|
||||
#include "harness/errorHelpers.h"
|
||||
#include "harness/deviceInfo.h"
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#define ASSERT(x) assert((x))
|
||||
@@ -887,3 +887,67 @@ cl_semaphore_khr &clExternalSemaphore::getCLSemaphore()
|
||||
{
|
||||
return m_externalSemaphore;
|
||||
}
|
||||
|
||||
cl_external_memory_handle_type_khr vkToOpenCLExternalMemoryHandleType(
|
||||
VulkanExternalMemoryHandleType vkExternalMemoryHandleType)
|
||||
{
|
||||
switch (vkExternalMemoryHandleType)
|
||||
{
|
||||
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD:
|
||||
return CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR;
|
||||
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_NT:
|
||||
return CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR;
|
||||
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT:
|
||||
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
|
||||
return CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR;
|
||||
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_NONE: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
|
||||
cl_device_id deviceId,
|
||||
VulkanExternalMemoryHandleType vkExternalMemoryHandleType, int *error_ret)
|
||||
{
|
||||
size_t size = 0;
|
||||
VulkanImageTiling mode = VULKAN_IMAGE_TILING_OPTIMAL;
|
||||
|
||||
assert(error_ret
|
||||
!= nullptr); // errcode_ret is not optional, it must be checked
|
||||
|
||||
*error_ret = clGetDeviceInfo(
|
||||
deviceId,
|
||||
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR,
|
||||
0, nullptr, &size);
|
||||
if (*error_ret != CL_SUCCESS)
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
std::vector<cl_external_memory_handle_type_khr> assume_linear_types(
|
||||
size / sizeof(cl_external_memory_handle_type_khr));
|
||||
|
||||
*error_ret = clGetDeviceInfo(
|
||||
deviceId,
|
||||
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR,
|
||||
size, assume_linear_types.data(), nullptr);
|
||||
if (*error_ret != CL_SUCCESS)
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
if (std::find(
|
||||
assume_linear_types.begin(), assume_linear_types.end(),
|
||||
vkToOpenCLExternalMemoryHandleType(vkExternalMemoryHandleType))
|
||||
!= assume_linear_types.end())
|
||||
{
|
||||
mode = VULKAN_IMAGE_TILING_LINEAR;
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user