[Beignet] [PATCH] fix clEnqueueMarkerWithWaitList bug when input event is null.

Zhigang Gong zhigang.gong at linux.intel.com
Tue Jun 17 02:16:48 PDT 2014


This patch LGTM, pushed.
BTW, please don't forget your signature in the future patches. Thanks.

On Tue, Jun 17, 2014 at 10:59:05AM +0800, xionghu.luo at intel.com wrote:
> From: Luo <xionghu.luo at intel.com>
> 
> ---
>  src/cl_api.c   |  5 +----
>  src/cl_event.c | 11 ++++++++---
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/src/cl_api.c b/src/cl_api.c
> index 2f287e3..c4a8730 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -2992,10 +2992,7 @@ clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
>  {
>    cl_int err = CL_SUCCESS;
>    CHECK_QUEUE(command_queue);
> -  if(event == NULL) {
> -    err = CL_INVALID_VALUE;
> -    goto error;
> -  }
> +
>    TRY(cl_event_check_waitlist, num_events_in_wait_list, event_wait_list, event, command_queue->ctx);
>  
>    cl_event_marker_with_wait_list(command_queue, num_events_in_wait_list, event_wait_list, event);
> diff --git a/src/cl_event.c b/src/cl_event.c
> index c93d245..76d6760 100644
> --- a/src/cl_event.c
> +++ b/src/cl_event.c
> @@ -476,11 +476,16 @@ cl_int cl_event_marker_with_wait_list(cl_command_queue queue,
>                  cl_event* event)
>  {
>    enqueue_data data = { 0 };
> +  cl_event e;
>  
> -  *event = cl_event_new(queue->ctx, queue, CL_COMMAND_MARKER, CL_TRUE);
> -  if(event == NULL)
> +  e = cl_event_new(queue->ctx, queue, CL_COMMAND_MARKER, CL_TRUE);
> +  if(e == NULL)
>      return CL_OUT_OF_HOST_MEMORY;
>  
> +  if(event != NULL ){
> +    *event = e;
> +  }
> +
>  //enqueues a marker command which waits for either a list of events to complete, or if the list is
>  //empty it waits for all commands previously enqueued in command_queue to complete before it  completes.
>    if(num_events_in_wait_list > 0){
> @@ -499,7 +504,7 @@ cl_int cl_event_marker_with_wait_list(cl_command_queue queue,
>      cl_gpgpu_event_update_status(queue->last_event->gpgpu_event, 1);
>    }
>  
> -  cl_event_set_status(*event, CL_COMPLETE);
> +  cl_event_set_status(e, CL_COMPLETE);
>    return CL_SUCCESS;
>  }
>  
> -- 
> 1.8.1.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list