mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-22 07:09:03 +00:00
switch SVM tests to the new test registration framework (#2168)
Switches the SVM tests to the new test registration framework. The first commit is the best to review and contains the actual changes. The second commit purely has formatting changes. Note that several of these changes were a bit more than mechanical because many of the SVM tests create a new context vs. using the context provided by the harness and passed to each test function. The previous code named the context provided by the harness differently, and hence could use the name "context" in each test function, but with the new test registration framework this is no longer possible. Instead, I am creating the new context using the name "contextWrapper" and then assigning it to the "context" passed to the test function, which seems like the best way to avoid using the wrong context unintentionally. I am open to suggestions to do this differently. I have verified that the same calls are made before and after these changes, and specifically that there are no context leaks.
This commit is contained in:
@@ -75,7 +75,7 @@ wait_and_release(const char* s, cl_event* evs, int n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(svm_migrate)
|
||||
{
|
||||
std::vector<cl_uint> amem(GLOBAL_SIZE);
|
||||
std::vector<cl_uint> bmem(GLOBAL_SIZE);
|
||||
@@ -86,15 +86,17 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
|
||||
|
||||
RandomSeed seed(0);
|
||||
|
||||
clContextWrapper context = NULL;
|
||||
clContextWrapper contextWrapper = NULL;
|
||||
clCommandQueueWrapper queues[MAXQ];
|
||||
cl_uint num_devices = 0;
|
||||
clProgramWrapper program;
|
||||
cl_int error;
|
||||
|
||||
error = create_cl_objects(deviceID, &sources[0], &context, &program, &queues[0], &num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
|
||||
if (error)
|
||||
return -1;
|
||||
error = create_cl_objects(deviceID, &sources[0], &contextWrapper, &program,
|
||||
&queues[0], &num_devices,
|
||||
CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
|
||||
context = contextWrapper;
|
||||
if (error) return -1;
|
||||
|
||||
if (num_devices > 1) {
|
||||
log_info(" Running on two devices.\n");
|
||||
|
||||
Reference in New Issue
Block a user