From: Zhigang Gong Date: Tue, 29 Oct 2013 03:19:36 +0000 (+0800) Subject: Runtime: fixed an incorrect error checking for CL_INVALID_GLOBAL_OFFSET. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bd3433143d5c9f6ce166f4b34e60d7b71f6fc29;p=contrib%2Fbeignet.git Runtime: fixed an incorrect error checking for CL_INVALID_GLOBAL_OFFSET. 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 Reviewed-by: "Xing, Homer" --- 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; }