Skip to content
Snippets Groups Projects
Commit d86f04ae authored by Michal Babej's avatar Michal Babej
Browse files

fix tests & poclu to not use out-of-order queues unconditionally

parent 28f58113
Branches
No related tags found
No related merge requests found
......@@ -111,10 +111,13 @@ poclu_get_any_device2 (cl_context *context, cl_device_id *device,
}
cl_int
poclu_get_multiple_devices (cl_platform_id *platform, cl_context *context,
cl_char include_custom_dev, cl_uint *num_devices,
cl_device_id **devices, cl_command_queue **queues,
int ooo_queues)
poclu_get_multiple_devices (cl_platform_id *platform,
cl_context *context,
cl_char include_custom_dev,
cl_uint *num_devices,
cl_device_id **devices,
cl_command_queue **queues,
cl_command_queue_properties optional_props)
{
cl_int err;
cl_uint num_dev_all = 0;
......@@ -185,11 +188,13 @@ poclu_get_multiple_devices (cl_platform_id *platform, cl_context *context,
if (err != CL_SUCCESS)
goto ERROR;
cl_command_queue_properties props = CL_QUEUE_PROFILING_ENABLE;
if (ooo_queues)
props |= CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
for (i = 0; i < *num_devices; ++i)
{
cl_command_queue_properties dev_props = 0;
CHECK_CL_ERROR (clGetDeviceInfo (devs[i],
CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
sizeof (dev_props), &dev_props, NULL));
cl_command_queue_properties props = dev_props & optional_props;
ques[i] = clCreateCommandQueue (*context, devs[i], props, &err);
if (err != CL_SUCCESS)
goto ERROR;
......@@ -201,6 +206,11 @@ poclu_get_multiple_devices (cl_platform_id *platform, cl_context *context,
ERROR:
free (devs);
for (i = 0; i < *num_devices; ++i)
{
if (ques[i])
clReleaseCommandQueue (ques[i]);
}
free (ques);
return err;
}
......
......@@ -220,10 +220,14 @@ POCLU_API cl_int POCLU_CALL poclu_get_any_device (cl_context *context,
* @return CL_SUCCESS on success, or a descriptive OpenCL error code upon
* failure.
*/
POCLU_API cl_int POCLU_CALL poclu_get_multiple_devices (
cl_platform_id *platform, cl_context *context, cl_char include_custom_dev,
cl_uint *num_devices, cl_device_id **devices, cl_command_queue **queues,
int ooo_queues);
POCLU_API cl_int POCLU_CALL
poclu_get_multiple_devices (cl_platform_id *platform,
cl_context *context,
cl_char include_custom_dev,
cl_uint *num_devices,
cl_device_id **devices,
cl_command_queue **queues,
cl_command_queue_properties optional_props);
/**
* Convert a float to a cl_half (uint16_t).
......
......@@ -55,7 +55,8 @@ main (int argc, char **argv)
cl_event ev1, ev2;
err = poclu_get_multiple_devices (&platform, &context, 0, &num_devices,
&devices, &queues, 1);
&devices, &queues,
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
CHECK_OPENCL_ERROR_IN ("poclu_get_multiple_devices");
printf ("NUM DEVICES: %u \n", num_devices);
......
......@@ -63,7 +63,7 @@ main (void)
uint64_t content_size;
poclu_get_multiple_devices (&platform, &context, CL_FALSE, &num_devices,
&devices, &queues, CL_FALSE);
&devices, &queues, 0);
if (num_devices < 2)
{
printf ("Not enough devices (2 required), skipping");
......
......@@ -118,8 +118,13 @@ main (int _argc, char **_argv)
CHECK_CL_ERROR (
clSetKernelArg (kernel, 2, sizeof (buffer_res), &buffer_res));
cl_command_queue command_queue = clCreateCommandQueue (
context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &error);
cl_command_queue_properties props = 0;
CHECK_CL_ERROR (clGetDeviceInfo (device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
sizeof (props), &props, NULL));
if (props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
cl_command_queue command_queue
= clCreateCommandQueue (context, device, props, &error);
CHECK_CL_ERROR (error);
cl_command_buffer_khr command_buffer
......
......@@ -116,8 +116,13 @@ main (int _argc, char **_argv)
&img_desc, NULL, &error);
CHECK_CL_ERROR (error);
cl_command_queue command_queue = clCreateCommandQueue (
context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &error);
cl_command_queue_properties props = 0;
CHECK_CL_ERROR (clGetDeviceInfo (device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
sizeof (props), &props, NULL));
if (props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
cl_command_queue command_queue
= clCreateCommandQueue (context, device, props, &error);
CHECK_CL_ERROR (error);
/**** Command buffer creation ****/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment