HSW: align buffer's size to DWORD.
authorYang Rong <rong.r.yang@intel.com>
Mon, 19 May 2014 05:52:18 +0000 (13:52 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Mon, 19 May 2014 04:46:15 +0000 (12:46 +0800)
HSW: Byte scattered Read/Write require that the buffer size must be a multiple of 4 bytes.
     So simply alignment all buffer size to 4. Pass utest compiler_function_constant0.

Because it is very light work around, align it without not check device.

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Junyan He <junyan.he@inbox.com>
src/cl_mem.c

index 5faef4b..6b8ca7c 100644 (file)
@@ -334,6 +334,10 @@ cl_mem_new_buffer(cl_context ctx,
     goto error;
   }
 
+  /* HSW: Byte scattered Read/Write has limitation that
+     the buffer size must be a multiple of 4 bytes. */
+  sz = ALIGN(sz, 4);
+
   /* Create the buffer in video memory */
   mem = cl_mem_allocate(CL_MEM_BUFFER_TYPE, ctx, flags, sz, CL_FALSE, &err);
   if (mem == NULL || err != CL_SUCCESS)