Migrate API suite to the new test registration framework (#2196)

Contributes to #2181

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
Ahmed Hesham
2024-12-18 17:29:08 +00:00
committed by GitHub
parent 2316c6343f
commit 794d332bab
40 changed files with 803 additions and 1254 deletions

View File

@@ -37,7 +37,10 @@ const char *queue_test_kernel[] = {
"\n"
"}\n" };
int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop_def, cl_device_id deviceID, clKernelWrapper& kernel, size_t num_elements)
int enqueue_kernel(cl_context context,
const cl_queue_properties_khr *queue_prop_def,
cl_device_id device, clKernelWrapper &kernel,
size_t num_elements)
{
clMemWrapper streams[2];
int error;
@@ -46,7 +49,8 @@ int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop
cl_platform_id platform;
clEventWrapper event;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL);
error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(cl_platform_id),
&platform, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
clCreateCommandQueueWithPropertiesKHR = (clCreateCommandQueueWithPropertiesKHR_fn) clGetExtensionFunctionAddressForPlatform(platform, "clCreateCommandQueueWithPropertiesKHR");
@@ -56,7 +60,8 @@ int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop
return -1;
}
clCommandQueueWrapper queue = clCreateCommandQueueWithPropertiesKHR(context, deviceID, queue_prop_def, &error);
clCommandQueueWrapper queue = clCreateCommandQueueWithPropertiesKHR(
context, device, queue_prop_def, &error);
test_error(error, "clCreateCommandQueueWithPropertiesKHR failed");
for (size_t i = 0; i < num_elements; ++i)
@@ -96,7 +101,7 @@ int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop
return 0;
}
int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
REGISTER_TEST(queue_properties)
{
if (num_elements <= 0)
{
@@ -111,7 +116,7 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
0 };
// Query extension
if (!is_extension_available(deviceID, "cl_khr_create_command_queue"))
if (!is_extension_available(device, "cl_khr_create_command_queue"))
{
log_info("extension cl_khr_create_command_queue is not supported.\n");
return 0;
@@ -121,17 +126,19 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
test_error(error, "create_single_kernel_helper failed");
log_info("Queue property NULL. Testing ... \n");
error = enqueue_kernel(context, NULL,deviceID, kernel, (size_t)num_elements);
error = enqueue_kernel(context, NULL, device, kernel, (size_t)num_elements);
test_error(error, "enqueue_kernel failed");
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, sizeof(device_props), &device_props, NULL);
error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(device_props), &device_props, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
if (device_props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
{
log_info("Queue property CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE supported. Testing ... \n");
queue_prop_def[1] = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
error = enqueue_kernel(context, queue_prop_def, deviceID, kernel, (size_t)num_elements);
error = enqueue_kernel(context, queue_prop_def, device, kernel,
(size_t)num_elements);
test_error(error, "enqueue_kernel failed");
} else
{
@@ -142,7 +149,8 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
{
log_info("Queue property CL_QUEUE_PROFILING_ENABLE supported. Testing ... \n");
queue_prop_def[1] = CL_QUEUE_PROFILING_ENABLE;
error = enqueue_kernel(context, queue_prop_def, deviceID, kernel, (size_t)num_elements);
error = enqueue_kernel(context, queue_prop_def, device, kernel,
(size_t)num_elements);
test_error(error, "enqueue_kernel failed");
} else
{
@@ -153,7 +161,8 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
{
log_info("Queue property CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE & CL_QUEUE_PROFILING_ENABLE supported. Testing ... \n");
queue_prop_def[1] = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE|CL_QUEUE_PROFILING_ENABLE;
error = enqueue_kernel(context, queue_prop_def, deviceID, kernel, (size_t)num_elements);
error = enqueue_kernel(context, queue_prop_def, device, kernel,
(size_t)num_elements);
test_error(error, "enqueue_kernel failed");
}
else