Allow creating out-of-order queues with clCreateCommandQueue

Submitted by Rebecca N. Palmer on July 21, 2018, 7:25 p.m.

Details

Message ID d8725799-07ef-a51e-11d0-f6eecadea70e@zoho.com
State New
Series "Allow creating out-of-order queues with clCreateCommandQueue"
Headers show

Commit Message

Rebecca N. Palmer July 21, 2018, 7:25 p.m.
clCreateCommandQueueWithProperties can already create them, but
that's a 2.0 function.

Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>
---
yes, this currently gives you out-of-order if you ask for in-order,
but says "can't do that" if you ask for out-of-order...

Patch hide | download patch | download mbox

--- a/src/cl_api_command_queue.c
+++ b/src/cl_api_command_queue.c
@@ -27,35 +27,11 @@  clCreateCommandQueue(cl_context context,
                      cl_command_queue_properties properties,
                      cl_int *errcode_ret)
 {
-  cl_command_queue queue = NULL;
-  cl_int err = CL_SUCCESS;
-
-  do {
-    if (!CL_OBJECT_IS_CONTEXT(context)) {
-      err = CL_INVALID_CONTEXT;
-      break;
-    }
-
-    err = cl_devices_list_include_check(context->device_num, context->devices, 1, &device);
-    if (err)
-      break;
-
-    if (properties & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE)) {
-      err = CL_INVALID_VALUE;
-      break;
-    }
-
-    if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) { /*not supported now.*/
-      err = CL_INVALID_QUEUE_PROPERTIES;
-      break;
-    }
-
-    queue = cl_create_command_queue(context, device, properties, 0, &err);
-  } while (0);
-
-  if (errcode_ret)
-    *errcode_ret = err;
-  return queue;
+  cl_queue_properties props[3];
+  props[0] = CL_QUEUE_PROPERTIES;
+  props[1] = properties;
+  props[2] = 0;
+  return clCreateCommandQueueWithProperties(context, device, props, errcode_ret);
 }
 
 /* 2.0 new API for create command queue. */

Comments

Yang, Rong R Aug. 20, 2018, 7:37 a.m.
Thanks for your patches, they looks good to me, have pushed.

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> Rebecca N. Palmer

> Sent: Sunday, July 22, 2018 3:26 AM

> To: beignet@lists.freedesktop.org

> Subject: [Beignet] [PATCH] Allow creating out-of-order queues with

> clCreateCommandQueue

> 

> clCreateCommandQueueWithProperties can already create them, but that's a

> 2.0 function.

> 

> Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>

> ---

> yes, this currently gives you out-of-order if you ask for in-order, but says "can't

> do that" if you ask for out-of-order...

> 

> --- a/src/cl_api_command_queue.c

> +++ b/src/cl_api_command_queue.c

> @@ -27,35 +27,11 @@ clCreateCommandQueue(cl_context context,

>                       cl_command_queue_properties properties,

>                       cl_int *errcode_ret)  {

> -  cl_command_queue queue = NULL;

> -  cl_int err = CL_SUCCESS;

> -

> -  do {

> -    if (!CL_OBJECT_IS_CONTEXT(context)) {

> -      err = CL_INVALID_CONTEXT;

> -      break;

> -    }

> -

> -    err = cl_devices_list_include_check(context->device_num, context->devices,

> 1, &device);

> -    if (err)

> -      break;

> -

> -    if (properties & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |

> CL_QUEUE_PROFILING_ENABLE)) {

> -      err = CL_INVALID_VALUE;

> -      break;

> -    }

> -

> -    if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) { /*not

> supported now.*/

> -      err = CL_INVALID_QUEUE_PROPERTIES;

> -      break;

> -    }

> -

> -    queue = cl_create_command_queue(context, device, properties, 0, &err);

> -  } while (0);

> -

> -  if (errcode_ret)

> -    *errcode_ret = err;

> -  return queue;

> +  cl_queue_properties props[3];

> +  props[0] = CL_QUEUE_PROPERTIES;

> +  props[1] = properties;

> +  props[2] = 0;

> +  return clCreateCommandQueueWithProperties(context, device, props,

> + errcode_ret);

>  }

> 

>  /* 2.0 new API for create command queue. */

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/beignet