[Beignet] [PATCH 1/2] Implement the CL api for clGetEventProfilingInfo

Zhigang Gong zhigang.gong at linux.intel.com
Thu Oct 17 03:12:37 PDT 2013


On Wed, Oct 16, 2013 at 02:42:45PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  src/cl_api.c |   35 ++++++++++++++++++++++++++++++++---
>  1 file changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/src/cl_api.c b/src/cl_api.c
> index 5de7f6b..6d48e15 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -398,7 +398,7 @@ clCreateCommandQueue(cl_context                   context,
>    INVALID_DEVICE_IF (device != context->device);
>    INVALID_VALUE_IF (properties & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE));
>  
> -  if(properties) {
> +  if(properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {/*not supported now.*/
>      err = CL_INVALID_QUEUE_PROPERTIES;
>      goto error;
>    }
> @@ -1224,8 +1224,37 @@ clGetEventProfilingInfo(cl_event             event,
>                          void *               param_value,
>                          size_t *             param_value_size_ret)
>  {
> -  NOT_IMPLEMENTED;
> -  return 0;
> +  cl_int err = CL_SUCCESS;
> +  cl_ulong ret_val;
> +
> +  CHECK_EVENT(event);
> +
> +  if (!(event->queue->props & CL_QUEUE_PROFILING_ENABLE) ||
> +          event->type == CL_COMMAND_USER ||
> +          event->status != CL_COMPLETE) {
> +    err = CL_PROFILING_INFO_NOT_AVAILABLE;
> +    goto error;
> +  }
> +
> +  if ((param_name != CL_PROFILING_COMMAND_QUEUED &&
> +          param_name != CL_PROFILING_COMMAND_SUBMIT &&
> +          param_name != CL_PROFILING_COMMAND_START &&
> +          param_name != CL_PROFILING_COMMAND_END) ||
> +          (param_value && param_value_size < sizeof(cl_ulong))) {
> +    err = CL_INVALID_VALUE;
> +    goto error;
> +  }
> +
> +  err = cl_event_profiling(event, param_name, &ret_val);

Where is the implementation of new function cl_event_profiling()? Did you forget something or I miss anything?

> +
> +  if (err == CL_SUCCESS) {
> +    if (param_value)
> +      *(cl_ulong*)param_value = ret_val;
> +    if (param_value_size_ret)
> +      *param_value_size_ret = sizeof(cl_ulong);
> +  }
> +error:
> +  return err;
>  }
>  
>  cl_int
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list