mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
Correct test_consistency_svm (#1071)
Do not use NULL svm pointers. Add a check for clEnqueueSVMMigrateMem. Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
@@ -79,44 +79,51 @@ int test_consistency_svm(cl_device_id deviceID, cl_context context,
|
|||||||
// CL_INVALID_OPERATION if the device associated with command_queue does
|
// CL_INVALID_OPERATION if the device associated with command_queue does
|
||||||
// not support Shared Virtual Memory.
|
// not support Shared Virtual Memory.
|
||||||
|
|
||||||
|
// These calls purposefully pass bogus pointers to the functions to
|
||||||
|
// better test that they are a NOP when SVM is not supported.
|
||||||
|
void* bogus0 = (void*)0xDEADBEEF;
|
||||||
|
void* bogus1 = (void*)0xDEADDEAD;
|
||||||
cl_uint pattern = 0xAAAAAAAA;
|
cl_uint pattern = 0xAAAAAAAA;
|
||||||
error = clEnqueueSVMMemFill(queue, ptr0, &pattern, sizeof(pattern),
|
error = clEnqueueSVMMemFill(queue, bogus0, &pattern, sizeof(pattern),
|
||||||
allocSize, 0, NULL, NULL);
|
allocSize, 0, NULL, NULL);
|
||||||
test_failure_error(
|
test_failure_error(
|
||||||
error, CL_INVALID_OPERATION,
|
error, CL_INVALID_OPERATION,
|
||||||
"CL_DEVICE_SVM_CAPABILITIES returned 0 but clEnqueueSVMMemFill did "
|
"CL_DEVICE_SVM_CAPABILITIES returned 0 but clEnqueueSVMMemFill did "
|
||||||
"not return CL_INVALID_OPERATION");
|
"not return CL_INVALID_OPERATION");
|
||||||
|
|
||||||
error = clEnqueueSVMMemcpy(queue, CL_TRUE, ptr1, ptr0, allocSize, 0,
|
error = clEnqueueSVMMemcpy(queue, CL_TRUE, bogus1, bogus0, allocSize, 0,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
test_failure_error(
|
test_failure_error(
|
||||||
error, CL_INVALID_OPERATION,
|
error, CL_INVALID_OPERATION,
|
||||||
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
||||||
"clEnqueueSVMMemcpy did not return CL_INVALID_OPERATION");
|
"clEnqueueSVMMemcpy did not return CL_INVALID_OPERATION");
|
||||||
|
|
||||||
error = clEnqueueSVMMap(queue, CL_TRUE, CL_MAP_READ, ptr1, allocSize, 0,
|
error = clEnqueueSVMMap(queue, CL_TRUE, CL_MAP_READ, bogus1, allocSize,
|
||||||
NULL, NULL);
|
0, NULL, NULL);
|
||||||
test_failure_error(
|
test_failure_error(
|
||||||
error, CL_INVALID_OPERATION,
|
error, CL_INVALID_OPERATION,
|
||||||
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
||||||
"clEnqueueSVMMap did not return CL_INVALID_OPERATION");
|
"clEnqueueSVMMap did not return CL_INVALID_OPERATION");
|
||||||
|
|
||||||
error = clEnqueueSVMUnmap(queue, ptr1, 0, NULL, NULL);
|
error = clEnqueueSVMUnmap(queue, bogus1, 0, NULL, NULL);
|
||||||
test_failure_error(
|
test_failure_error(
|
||||||
error, CL_INVALID_OPERATION,
|
error, CL_INVALID_OPERATION,
|
||||||
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
||||||
"clEnqueueSVMUnmap did not return CL_INVALID_OPERATION");
|
"clEnqueueSVMUnmap did not return CL_INVALID_OPERATION");
|
||||||
|
|
||||||
|
error = clEnqueueSVMMigrateMem(queue, 1, (const void**)&bogus1, NULL, 0,
|
||||||
|
0, NULL, NULL);
|
||||||
|
test_failure_error(
|
||||||
|
error, CL_INVALID_OPERATION,
|
||||||
|
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
||||||
|
"clEnqueueSVMMigrateMem did not return CL_INVALID_OPERATION");
|
||||||
|
|
||||||
// If the enqueue calls above did not return errors, a clFinish would be
|
// If the enqueue calls above did not return errors, a clFinish would be
|
||||||
// needed here to ensure the SVM operations are complete before freeing
|
// needed here to ensure the SVM operations are complete before freeing
|
||||||
// the SVM pointers.
|
// the SVM pointers.
|
||||||
|
|
||||||
// These calls to free SVM purposefully passes a bogus pointer to the
|
clSVMFree(context, bogus0);
|
||||||
// free function to better test that it they are a NOP when SVM is not
|
error = clEnqueueSVMFree(queue, 1, &bogus0, NULL, NULL, 0, NULL, NULL);
|
||||||
// supported.
|
|
||||||
void* bogus = (void*)0xDEADBEEF;
|
|
||||||
clSVMFree(context, bogus);
|
|
||||||
error = clEnqueueSVMFree(queue, 1, &bogus, NULL, NULL, 0, NULL, NULL);
|
|
||||||
test_failure_error(
|
test_failure_error(
|
||||||
error, CL_INVALID_OPERATION,
|
error, CL_INVALID_OPERATION,
|
||||||
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
"CL_DEVICE_SVM_CAPABILITIES returned 0 but "
|
||||||
|
|||||||
Reference in New Issue
Block a user