mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-21 06:49:02 +00:00
add system SVM testing via clSVMAllocWithProperties (#2516)
This PR adds system SVM testing both using driver APIs (`clSVMAllocWithPropertiesKHR`) and the system allocator directly (e.g. `malloc`). This is done by finding all of the SVM capabilities that are "system allocated" and duplicating them with a special "use system allocator" pseudo-capability. When the "use system allocator" pseudo-capability is not present, the system SVM type is treated the same as all other unified SVM types and is tested using driver APIs. When the "use system allocator" pseudo-capability is present, the system SVM type is allocated using the system allocator directly, though this also adds some limitations, for example the properties of the allocation may not be queried using `clGetSVMPointerInfoKHR`. See discussion in: https://github.com/KhronosGroup/OpenCL-Docs/issues/1446
This commit is contained in:
@@ -135,7 +135,7 @@ struct UnifiedSVMOPs : UnifiedSVMBase
|
||||
|
||||
// We check if the memory can be read by the host.
|
||||
if (caps & CL_SVM_CAPABILITY_HOST_READ_KHR
|
||||
|| caps & CL_SVM_CAPABILITY_SYSTEM_ALLOCATED_KHR)
|
||||
|| caps & PSEUDO_CAPABILITY_USE_SYSTEM_ALLOCATOR)
|
||||
{
|
||||
err = test_SVMMemcpy(mem.get(), hostMem.get());
|
||||
test_error(err, "test_SVMMemcpy");
|
||||
@@ -143,7 +143,7 @@ struct UnifiedSVMOPs : UnifiedSVMBase
|
||||
|
||||
// We check if the memory can be written by the host.
|
||||
if (caps & CL_SVM_CAPABILITY_HOST_WRITE_KHR
|
||||
|| caps & CL_SVM_CAPABILITY_SYSTEM_ALLOCATED_KHR)
|
||||
|| caps & PSEUDO_CAPABILITY_USE_SYSTEM_ALLOCATOR)
|
||||
{
|
||||
err = test_SVMMemcpy(hostMem.get(), mem.get());
|
||||
test_error(err, "test_SVMMemcpy");
|
||||
@@ -162,7 +162,7 @@ struct UnifiedSVMOPs : UnifiedSVMBase
|
||||
cl_int err;
|
||||
cl_uint max_ti = static_cast<cl_uint>(deviceUSVMCaps.size());
|
||||
|
||||
// Test all possible comabinations between supported types
|
||||
// Test all possible combinations between supported types
|
||||
for (cl_uint src_ti = 0; src_ti < max_ti; src_ti++)
|
||||
{
|
||||
for (cl_uint dst_ti = 0; dst_ti < max_ti; dst_ti++)
|
||||
@@ -208,7 +208,7 @@ struct UnifiedSVMOPs : UnifiedSVMBase
|
||||
{
|
||||
return std::unique_ptr<USVMWrapper<T>>(
|
||||
new USVMWrapper<T>(nullptr, nullptr, nullptr, CL_UINT_MAX,
|
||||
CL_SVM_CAPABILITY_SYSTEM_ALLOCATED_KHR
|
||||
PSEUDO_CAPABILITY_USE_SYSTEM_ALLOCATOR
|
||||
| CL_SVM_CAPABILITY_HOST_READ_KHR
|
||||
| CL_SVM_CAPABILITY_HOST_WRITE_KHR,
|
||||
0, nullptr, nullptr, nullptr, nullptr));
|
||||
@@ -216,7 +216,6 @@ struct UnifiedSVMOPs : UnifiedSVMBase
|
||||
|
||||
bool caps_compatibility_check(cl_uint srcTypeIndex, cl_uint dstTypeIndex)
|
||||
{
|
||||
|
||||
const auto srcCaps = deviceUSVMCaps[srcTypeIndex];
|
||||
const auto dstCaps = deviceUSVMCaps[dstTypeIndex];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user