[Beignet] [PATCH v3 8/8] Implement TILE_Y large image in clEnqueueWriteImage.

Yang, Rong R rong.r.yang at intel.com
Thu May 18 07:01:55 UTC 2017


The patchset LGTM, pushed, thanks.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> yan.wang at linux.intel.com
> Sent: Tuesday, May 16, 2017 19:04
> To: beignet at lists.freedesktop.org
> Cc: Yan Wang <yan.wang at linux.intel.com>
> Subject: [Beignet] [PATCH v3 8/8] Implement TILE_Y large image in
> clEnqueueWriteImage.
> 
> From: Yan Wang <yan.wang at linux.intel.com>
> 
> It will fail to copy data from host ptr to TILE_Y large image by memcpy.
> Use clEnqueueCopyBufferToImage to do this on GPU side.
> 
> Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
> ---
>  src/cl_api_mem.c | 46
> ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/src/cl_api_mem.c b/src/cl_api_mem.c index 91525b1..7b58236
> 100644
> --- a/src/cl_api_mem.c
> +++ b/src/cl_api_mem.c
> @@ -1954,6 +1954,47 @@ clEnqueueReadImage(cl_command_queue
> command_queue,
>    return err;
>  }
> 
> +static cl_int
> +clEnqueueWriteImageByKernel(cl_command_queue command_queue,
> +                    cl_mem mem,
> +                    cl_bool blocking_write,
> +                    const size_t *porigin,
> +                    const size_t *pregion,
> +                    size_t row_pitch,
> +                    size_t slice_pitch,
> +                    const void *ptr,
> +                    cl_uint num_events_in_wait_list,
> +                    const cl_event *event_wait_list,
> +                    cl_event *event)
> +{
> +  cl_int err = CL_SUCCESS;
> +  struct _cl_mem_image *image = NULL;
> +  size_t region[3];
> +  size_t origin[3];
> +
> +  image = cl_mem_image(mem);
> +
> +  err = check_image_region(image, pregion, region);  if (err !=
> + CL_SUCCESS)
> +    return err;
> +
> +  err = check_image_origin(image, porigin, origin);  if (err !=
> + CL_SUCCESS)
> +    return err;
> +
> +  if (image->tmp_ker_buf)
> +    clReleaseMemObject(image->tmp_ker_buf);
> +
> +  image->tmp_ker_buf = clCreateBuffer(command_queue->ctx,
> + CL_MEM_USE_HOST_PTR, mem->size, (void*)ptr, &err);  if (image-
> >tmp_ker_buf == NULL || err != CL_SUCCESS) {
> +    image->tmp_ker_buf = NULL;
> +    return err;
> +  }
> +
> +  return clEnqueueCopyBufferToImage(command_queue, image-
> >tmp_ker_buf, mem, 0, origin, region,
> +    num_events_in_wait_list, event_wait_list, event); }
> +
>  cl_int
>  clEnqueueWriteImage(cl_command_queue command_queue,
>                      cl_mem mem,
> @@ -2039,6 +2080,11 @@ clEnqueueWriteImage(cl_command_queue
> command_queue,
>        break;
>      }
> 
> +    if (image->is_ker_copy) {
> +      return clEnqueueWriteImageByKernel(command_queue, mem,
> blocking_write, origin,
> +        region, row_pitch, slice_pitch, ptr, num_events_in_wait_list,
> event_wait_list, event);
> +    }
> +
>      err = cl_event_check_waitlist(num_events_in_wait_list, event_wait_list,
>                                    event, command_queue->ctx);
>      if (err != CL_SUCCESS) {
> --
> 2.7.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list