[Beignet] [PATCH] Runtime: fixed an incorrect error checking for CL_INVALID_GLOBAL_OFFSET.

Zhigang Gong zhigang.gong at linux.intel.com
Tue Oct 29 04:21:51 CET 2013


According to OpenCL spec:

CL_INVALID_GLOBAL_OFFSET if the value specified in global_work_size + the
corresponding values in global_work_offset for any dimensions is greater than the
sizeof(size t) for the device on which the kernel execution will be enqueued.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/cl_api.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index f668ec6..173810b 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2336,7 +2336,7 @@ clEnqueueNDRangeKernel(cl_command_queue  command_queue,
 
   if (global_work_offset != NULL)
     for (i = 0; i < work_dim; ++i) {
-      if (UNLIKELY(~0LL - global_work_offset[i] > global_work_size[i])) {
+      if (UNLIKELY(global_work_offset[i] + global_work_size[i] > (size_t)-1)) {
         err = CL_INVALID_GLOBAL_OFFSET;
         goto error;
       }
-- 
1.7.9.5



More information about the Beignet mailing list