Runtime: fixed an incorrect error checking for CL_INVALID_GLOBAL_OFFSET.
authorZhigang Gong <zhigang.gong@linux.intel.com>
Tue, 29 Oct 2013 03:19:36 +0000 (11:19 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Tue, 29 Oct 2013 05:39:31 +0000 (13:39 +0800)
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@linux.intel.com>
Reviewed-by: "Xing, Homer" <homer.xing@intel.com>
src/cl_api.c

index f668ec6..173810b 100644 (file)
@@ -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;
       }