Import OpenCL exported semaphore in Vulkan (#1898)

Except for SYNC_FD, current implementation doesn't import exported
OpenCL semaphore in Vulkan and ends up doing signal and wait on
essentially two unrelated semaphores (one created in OpenCL and one in
Vulkan).
Since OpenCL exports the semaphore, import that in Vulkan to perform
signal/wait on the same underlying payload.
This commit is contained in:
saurabhnv
2024-05-28 22:50:25 +05:30
committed by GitHub
parent 1433ffe515
commit 6807e165d7
5 changed files with 157 additions and 42 deletions

View File

@@ -140,10 +140,12 @@ int run_test_with_two_queue(
}
else
{
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, true);
}
const uint32_t maxIter = innerIterations;
@@ -469,10 +471,12 @@ int run_test_with_one_queue(
}
else
{
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, true);
}
const uint32_t maxIter = innerIterations;
@@ -770,10 +774,12 @@ int run_test_with_multi_import_same_ctx(
}
else
{
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, true);
}
const uint32_t maxIter = innerIterations;
@@ -1113,17 +1119,19 @@ int run_test_with_multi_import_diff_ctx(
}
else
{
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore,
context, vkExternalSemaphoreHandleType,
deviceId, false);
clVk2CLExternalSemaphore2 = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context2, vkExternalSemaphoreHandleType,
deviceId);
clCl2VkExternalSemaphore2 = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context2, vkExternalSemaphoreHandleType,
deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore2, vkVk2CLSemaphore,
context2, vkExternalSemaphoreHandleType,
deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore2, vkCl2VkSemaphore,
context2, vkExternalSemaphoreHandleType,
deviceId, false);
}
const uint32_t maxIter = innerIterations;

View File

@@ -251,10 +251,10 @@ int run_test_with_two_queue(
clExternalSemaphore *clVk2CLExternalSemaphore = NULL;
clExternalSemaphore *clCl2VkExternalSemaphore = NULL;
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, true);
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory1;
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory2;
@@ -863,10 +863,10 @@ int run_test_with_one_queue(
clExternalSemaphore *clVk2CLExternalSemaphore = NULL;
clExternalSemaphore *clCl2VkExternalSemaphore = NULL;
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, true);
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory1;
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory2;