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:
Ben Ashbaugh
2025-10-14 10:07:32 -07:00
committed by GitHub
parent 56802afb17
commit 089e02cdf7
7 changed files with 64 additions and 29 deletions

View File

@@ -189,10 +189,7 @@ struct UnifiedSVMExecInfo : UnifiedSVMBase
cl_int setup() override
{
cl_int err = UnifiedSVMBase::setup();
if (CL_SUCCESS != err)
{
return err;
}
test_error(err, "UnifiedSVMBase setup failed");
return createIndirectAccessKernel();
}
@@ -209,19 +206,12 @@ struct UnifiedSVMExecInfo : UnifiedSVMBase
err = mem->allocate(alloc_count);
test_error(err, "SVM allocation failed");
log_info(" testing clSetKernelArgSVMPointer() SVM type %u \n",
ti);
log_info(" testing clSetKernelExecInfo() SVM type %u \n", ti);
err = test_svm_exec_info_read(mem.get());
if (CL_SUCCESS != err)
{
return err;
}
test_error(err, "test_svm_exec_info_read failed");
err = test_svm_exec_info_write(mem.get());
if (CL_SUCCESS != err)
{
return err;
}
test_error(err, "test_svm_exec_info_write failed");
err = mem->free();
test_error(err, "SVM free failed");