Fix vulkan subtest for diffCtx and platform/device info (#2046)

Fixes:
1. Multi import diff ctx subtest which acquires/releases external memory
via queue not associated with the context in which memory was imported.
2. Platform/Device info subtests to handle different platforms and
availability of the query.
This commit is contained in:
saurabhnv
2024-09-24 21:25:01 +05:30
committed by GitHub
parent 0c7fbc46e6
commit e865c1e8dd
5 changed files with 152 additions and 45 deletions

View File

@@ -1294,6 +1294,43 @@ cl_platform_id getPlatformFromDevice(cl_device_id deviceID)
return platform;
}
/**
* Helper to return a string containing platform information
* for the specified platform info parameter.
*/
std::string get_platform_info_string(cl_platform_id platform,
cl_platform_info param_name)
{
size_t size = 0;
int err;
if ((err = clGetPlatformInfo(platform, param_name, 0, NULL, &size))
!= CL_SUCCESS
|| size == 0)
{
throw std::runtime_error("clGetPlatformInfo failed\n");
}
std::vector<char> info(size);
if ((err = clGetPlatformInfo(platform, param_name, size, info.data(), NULL))
!= CL_SUCCESS)
{
throw std::runtime_error("clGetPlatformInfo failed\n");
}
/* The returned string does not include the null terminator. */
return std::string(info.data(), size - 1);
}
bool is_platform_extension_available(cl_platform_id platform,
const char *extensionName)
{
std::string extString =
get_platform_info_string(platform, CL_PLATFORM_EXTENSIONS);
return extString.find(extensionName) != std::string::npos;
}
void PrintArch(void)
{
vlog("sizeof( void*) = %zu\n", sizeof(void *));