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

Xing, Homer homer.xing at intel.com
Tue Oct 29 06:28:56 CET 2013


This patch looks good to me.

-----Original Message-----
From: beignet-bounces at lists.freedesktop.org [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Tuesday, October 29, 2013 11:22 AM
To: beignet at lists.freedesktop.org
Cc: Zhigang Gong
Subject: [Beignet] [PATCH] 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 <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

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list