[Beignet] [PATCH] Fix a bug of 1d image array test case.
Zhigang Gong
zhigang.gong at linux.intel.com
Wed Feb 4 02:11:46 PST 2015
LGTM, pushed, thanks.
On Wed, Feb 04, 2015 at 12:51:04PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
>
> Because of the HW limitation, vertical stride is at
> least aligned to 2. For 1D array image, the data has interval.
> The image size is just twice as big as the buffer size we think.
> Use clEnqueueWriteImage is safe and fix this bug.
>
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
> utests/compiler_fill_image_1d_array.cpp | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/utests/compiler_fill_image_1d_array.cpp b/utests/compiler_fill_image_1d_array.cpp
> index cc7cf0a..67f9643 100644
> --- a/utests/compiler_fill_image_1d_array.cpp
> +++ b/utests/compiler_fill_image_1d_array.cpp
> @@ -10,6 +10,11 @@ static void compiler_fill_image_1d_array(void)
> size_t origin[3] = { };
> size_t region[3];
> uint32_t* dst;
> + uint32_t* src;
> +
> + region[0] = w;
> + region[1] = array;
> + region[2] = 1;
>
> memset(&desc, 0x0, sizeof(cl_image_desc));
> memset(&format, 0x0, sizeof(cl_image_format));
> @@ -26,9 +31,9 @@ static void compiler_fill_image_1d_array(void)
>
> OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL);
>
> - OCL_MAP_BUFFER_GTT(0);
> - memset(buf_data[0], 0, sizeof(uint32_t) * w * array);
> - OCL_UNMAP_BUFFER_GTT(0);
> + src = (uint32_t*)malloc(w*array*sizeof(uint32_t));
> + memset(src, 0, sizeof(uint32_t) * w * array);
> + OCL_WRITE_IMAGE(buf[0], origin, region, src);
>
> // Run the kernel
> OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
> @@ -39,9 +44,6 @@ static void compiler_fill_image_1d_array(void)
> OCL_NDRANGE(2);
>
> // Check result
> - region[0] = w;
> - region[1] = array;
> - region[2] = 1;
> dst = (uint32_t*)malloc(w*array*sizeof(uint32_t));
> OCL_READ_IMAGE(buf[0], origin, region, dst);
>
> --
> 1.9.1
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list