[Beignet] [PATCH 1/2] Refine error check in clCreateCommandQueue()

Ruiling Song ruiling.song at intel.com
Wed Jun 12 18:40:16 PDT 2013


Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 src/cl_api.c     |    9 +++++++++
 src/cl_context.c |    5 +----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index a813c65..fd707e5 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -287,6 +287,15 @@ clCreateCommandQueue(cl_context                   context,
   cl_command_queue queue = NULL;
   cl_int err = CL_SUCCESS;
   CHECK_CONTEXT (context);
+
+  INVALID_DEVICE_IF (device != context->device);
+  INVALID_VALUE_IF (properties & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE));
+
+  if(properties) {
+    err = CL_INVALID_QUEUE_PROPERTIES;
+    goto error;
+  }
+
   queue = cl_context_create_queue(context, device, properties, &err);
 error:
   if (errcode_ret)
diff --git a/src/cl_context.c b/src/cl_context.c
index 6cde988..fa4c7e0 100644
--- a/src/cl_context.c
+++ b/src/cl_context.c
@@ -192,10 +192,7 @@ cl_context_create_queue(cl_context ctx,
   cl_command_queue queue = NULL;
   cl_int err = CL_SUCCESS;
 
-  if (UNLIKELY(device != ctx->device)) {
-    err = CL_INVALID_DEVICE;
-    goto error;
-  }
+
 
   /* We create the command queue and store it in the context list of queues */
   TRY_ALLOC (queue, cl_command_queue_new(ctx));
-- 
1.7.9.5



More information about the Beignet mailing list