Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors in test_vulkan #2183

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test_common/harness/errorHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const char *IGetErrorString(int clErrorCode)
return "CL_INVALID_SYNC_POINT_WAIT_LIST_KHR";
case CL_INVALID_COMMAND_BUFFER_KHR:
return "CL_INVALID_COMMAND_BUFFER_KHR";
case CL_INVALID_SEMAPHORE_KHR: return "CL_INVALID_SEMAPHORE_KHR";
default: return "(unknown)";
}
}
Expand Down
12 changes: 9 additions & 3 deletions test_conformance/common/vulkan_wrapper/vulkan_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ getDefaultVulkanQueueFamilyToQueueCountMap()
}

const std::vector<VulkanExternalMemoryHandleType>
getSupportedVulkanExternalMemoryHandleTypeList()
getSupportedVulkanExternalMemoryHandleTypeList(
const VulkanPhysicalDevice &physical_device)
{
std::vector<VulkanExternalMemoryHandleType> externalMemoryHandleTypeList;

Expand All @@ -238,8 +239,13 @@ getSupportedVulkanExternalMemoryHandleTypeList()
externalMemoryHandleTypeList.push_back(
VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT);
#else
externalMemoryHandleTypeList.push_back(
VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD);
if (physical_device.hasExtension(
VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Ben: Is this the right extension name to check for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer we wait on merging this, it introduces a segfault for us. We would like to debug

{

externalMemoryHandleTypeList.push_back(
VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD);
}
#endif

return externalMemoryHandleTypeList;
Expand Down
3 changes: 2 additions & 1 deletion test_conformance/common/vulkan_wrapper/vulkan_utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const VulkanDescriptorSetLayoutList& getEmptyVulkanDescriptorSetLayoutList();
const VulkanQueueFamilyToQueueCountMap&
getDefaultVulkanQueueFamilyToQueueCountMap();
const std::vector<VulkanExternalMemoryHandleType>
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(
const VulkanPhysicalDevice& physical_device);
const std::vector<VulkanExternalSemaphoreHandleType>
getSupportedVulkanExternalSemaphoreHandleTypeList(const VulkanDevice& vkDevice);
std::vector<VulkanExternalSemaphoreHandleType>
Expand Down
28 changes: 15 additions & 13 deletions test_conformance/vulkan/test_vulkan_api_consistency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ struct ConsistencyExternalBufferTest : public VulkanTestBase
#else
if (!is_extension_available(device, "cl_khr_external_memory_opaque_fd"))
{
throw std::runtime_error(
"Device does not support "
"cl_khr_external_memory_opaque_fd extension \n");
log_info("Device does not support "
"cl_khr_external_memory_opaque_fd extension \n");
return TEST_SKIPPED_ITSELF;
}
#endif

VulkanExternalMemoryHandleType vkExternalMemoryHandleType =
getSupportedVulkanExternalMemoryHandleTypeList()[0];
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice->getPhysicalDevice())[0];

VulkanBuffer vkDummyBuffer(*vkDevice, 4 * 1024,
vkExternalMemoryHandleType);
Expand Down Expand Up @@ -212,7 +213,8 @@ struct ConsistencyExternalImageTest : public VulkanTestBase
cl_image_format img_format = { 0 };

VulkanExternalMemoryHandleType vkExternalMemoryHandleType =
getSupportedVulkanExternalMemoryHandleTypeList()[0];
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice->getPhysicalDevice())[0];

VulkanImageTiling vulkanImageTiling =
vkClExternalMemoryHandleTilingAssumption(
Expand Down Expand Up @@ -484,18 +486,18 @@ struct ConsistencyExternalSemaphoreTest : public VulkanTestBase
// Pass invalid semaphore object to wait
errNum = clEnqueueWaitSemaphoresKHRptr(queue, 1, NULL, NULL, 0,
NULL, NULL);
test_failure_error(
errNum, CL_INVALID_VALUE,
"clEnqueueWaitSemaphoresKHR fails with CL_INVALID_VALUE "
"when invalid semaphore object is passed");
test_failure_error(errNum, CL_INVALID_SEMAPHORE_KHR,
"clEnqueueWaitSemaphoresKHR fails with "
"CL_INVALID_SEMAPHORE_KHR "
"when invalid semaphore object is passed");

// Pass invalid semaphore object to signal
errNum = clEnqueueSignalSemaphoresKHRptr(queue, 1, NULL, NULL, 0,
NULL, NULL);
test_failure_error(
errNum, CL_INVALID_VALUE,
"clEnqueueSignalSemaphoresKHR fails with CL_INVALID_VALUE"
"when invalid semaphore object is passed");
test_failure_error(errNum, CL_INVALID_SEMAPHORE_KHR,
"clEnqueueSignalSemaphoresKHR fails with "
"CL_INVALID_SEMAPHORE_KHR"
"when invalid semaphore object is passed");

// Create two semaphore objects
clVk2Clsemaphore = clCreateSemaphoreWithPropertiesKHRptr(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ struct ConsistencyExternalImage1DTest : public VulkanTestBase
#else
if (!is_extension_available(device, "cl_khr_external_memory_opaque_fd"))
{
throw std::runtime_error(
"Device does not support cl_khr_external_memory_opaque_fd "
"extension \n");
log_info("Device does not support "
"cl_khr_external_memory_opaque_fd extension \n");
return TEST_SKIPPED_ITSELF;
}
#endif
uint32_t width = 256;
Expand All @@ -70,7 +70,8 @@ struct ConsistencyExternalImage1DTest : public VulkanTestBase
cl_image_format img_format = { 0 };

VulkanExternalMemoryHandleType vkExternalMemoryHandleType =
getSupportedVulkanExternalMemoryHandleTypeList()[0];
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice->getPhysicalDevice())[0];

VulkanImageTiling vulkanImageTiling =
vkClExternalMemoryHandleTilingAssumption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ struct ConsistencyExternalImage3DTest : public VulkanTestBase
#else
if (!is_extension_available(device, "cl_khr_external_memory_opaque_fd"))
{
throw std::runtime_error(
"Device does not support cl_khr_external_memory_opaque_fd "
"extension \n");
log_info("Device does not support "
"cl_khr_external_memory_opaque_fd extension \n");
return TEST_SKIPPED_ITSELF;
}
#endif
uint32_t width = 256;
Expand All @@ -73,7 +73,8 @@ struct ConsistencyExternalImage3DTest : public VulkanTestBase
cl_image_format img_format = { 0 };

VulkanExternalMemoryHandleType vkExternalMemoryHandleType =
getSupportedVulkanExternalMemoryHandleTypeList()[0];
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice->getPhysicalDevice())[0];

VulkanImageTiling vulkanImageTiling =
vkClExternalMemoryHandleTilingAssumption(
Expand Down
12 changes: 8 additions & 4 deletions test_conformance/vulkan/test_vulkan_interop_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ int run_test_with_two_queue(

const std::vector<VulkanExternalMemoryHandleType>
vkExternalMemoryHandleTypeList =
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice.getPhysicalDevice());
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
std::shared_ptr<VulkanFence> fence = nullptr;
Expand Down Expand Up @@ -447,7 +448,8 @@ int run_test_with_one_queue(

const std::vector<VulkanExternalMemoryHandleType>
vkExternalMemoryHandleTypeList =
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice.getPhysicalDevice());
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
std::shared_ptr<VulkanFence> fence = nullptr;
Expand Down Expand Up @@ -752,7 +754,8 @@ int run_test_with_multi_import_same_ctx(

const std::vector<VulkanExternalMemoryHandleType>
vkExternalMemoryHandleTypeList =
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice.getPhysicalDevice());
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
std::shared_ptr<VulkanFence> fence = nullptr;
Expand Down Expand Up @@ -1092,7 +1095,8 @@ int run_test_with_multi_import_diff_ctx(

const std::vector<VulkanExternalMemoryHandleType>
vkExternalMemoryHandleTypeList =
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice.getPhysicalDevice());
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
std::shared_ptr<VulkanFence> fence = nullptr;
Expand Down
7 changes: 5 additions & 2 deletions test_conformance/vulkan/test_vulkan_interop_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ int run_test_with_two_queue(
std::vector<VulkanFormat> vkFormatList = getSupportedVulkanFormatList();
const std::vector<VulkanExternalMemoryHandleType>
vkExternalMemoryHandleTypeList =
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(

vkDevice.getPhysicalDevice());
char magicValue = 0;

VulkanBuffer vkParamsBuffer(vkDevice, sizeof(Params));
Expand Down Expand Up @@ -820,7 +822,8 @@ int run_test_with_one_queue(
std::vector<VulkanFormat> vkFormatList = getSupportedVulkanFormatList();
const std::vector<VulkanExternalMemoryHandleType>
vkExternalMemoryHandleTypeList =
getSupportedVulkanExternalMemoryHandleTypeList();
getSupportedVulkanExternalMemoryHandleTypeList(
vkDevice.getPhysicalDevice());
char magicValue = 0;

VulkanBuffer vkParamsBuffer(vkDevice, sizeof(Params));
Expand Down
Loading