[Beignet] [PATCH] Fix a bug for event error status.

Yang, Rong R rong.r.yang at intel.com
Thu Sep 29 03:39:54 UTC 2016


One comment.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> junyan.he at inbox.com
> Sent: Wednesday, August 3, 2016 19:12
> To: beignet at lists.freedesktop.org
> Subject: [Beignet] [PATCH] Fix a bug for event error status.
> 
> From: Junyan He <junyan.he at intel.com>
> 
> Signed-off-by: Junyan He <junyan.he at intel.com>
> ---
>  src/cl_api.c   |  5 +++--
>  src/cl_event.c | 16 +++++++++-------
>  2 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/src/cl_api.c b/src/cl_api.c index 91ba5c5..33e5d93 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -1280,6 +1280,7 @@ clGetEventInfo(cl_event      event,
>                 size_t *      param_value_size_ret)
>  {
>    cl_int err = CL_SUCCESS;
> +  cl_int status;
>    CHECK_EVENT(event);
> 
>    if (param_name == CL_EVENT_COMMAND_QUEUE) {
> @@ -1289,8 +1290,8 @@ clGetEventInfo(cl_event      event,
>    } else if (param_name == CL_EVENT_COMMAND_TYPE) {
>      FILL_GETINFO_RET (cl_command_type, 1, &event->event_type,
> CL_SUCCESS);
>    } else if (param_name == CL_EVENT_COMMAND_EXECUTION_STATUS) {
> -    cl_event_get_status(event);
> -    FILL_GETINFO_RET (cl_int, 1, &event->status, CL_SUCCESS);
> +    status = cl_event_get_status(event);
> +    FILL_GETINFO_RET (cl_int, 1, &status, CL_SUCCESS);
>    } else if (param_name == CL_EVENT_REFERENCE_COUNT) {
>      cl_uint ref = CL_OBJECT_GET_REF(event);
>      FILL_GETINFO_RET (cl_int, 1, &ref, CL_SUCCESS); diff --git a/src/cl_event.c
> b/src/cl_event.c index c13ab0e..1021755 100644
> --- a/src/cl_event.c
> +++ b/src/cl_event.c
> @@ -433,6 +433,8 @@ cl_event_wait_for_events_list(cl_uint num_events,
> const cl_event *event_list)
>      while (e->status > CL_COMPLETE) {
>        CL_OBJECT_WAIT_ON_COND(e);
>      }
> +
> +    assert(e->status <= CL_COMPLETE);
>      /* Iff some error happened, return the error. */
>      if (e->status < CL_COMPLETE) {
>        ret = CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
> @@ -469,11 +471,6 @@ cl_event_check_waitlist(cl_uint
> num_events_in_wait_list, const cl_event *event_w
>          break;
>        }
> 
> -      if (cl_event_get_status(event_wait_list[i]) < CL_COMPLETE) {
> -        err = CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
> -        break;
> -      }
> -
clWaitForEvents also call this function, and clWaitForEvents need this check.
Need move it to function clWaitForEvents instead of remove.

>        if (event == event_wait_list + i) { /* Pointer of element of the wait list */
>          err = CL_INVALID_EVENT_WAIT_LIST;
>          break;
> @@ -538,16 +535,21 @@ cl_event_is_ready(cl_event event)  {
>    int i;
>    int status;
> +  int ret_status = CL_COMPLETE;
> 
>    for (i = 0; i < event->depend_event_num; i++) {
>      status = cl_event_get_status(event->depend_events[i]);
> 
> -    if (status != CL_COMPLETE) {
> +    if (status > CL_COMPLETE) { // Find some not ready, just OK
>        return status;
>      }
> +
> +    if (status < CL_COMPLETE) { // Record some error.
> +      ret_status = status;
> +    }
>    }
> 
> -  return CL_COMPLETE;
> +  return ret_status;
>  }
> 
>  LOCAL cl_event
> --
> 2.7.4
> 
> __________________________________________________________
> __
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
> Check it out at http://www.inbox.com/earth
> 
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list