[Beignet] [PATCH] fix piglit clGetKernelWorkGroupInfo fail.

Zhigang Gong zhigang.gong at linux.intel.com
Mon Sep 8 23:46:21 PDT 2014


This is not comply with the spec. Please check the OpenCL 1.2 spec
5.7.3 which contains the description of the function clGetKernelWorkGroupInfo().
You will find the following for the macro CL_KERNEL_GLOBAL_WORK_SIZE
in "Table 5.16 clGetKernelWorkGroupInfo parameter queries".

  This provides a mechanism for the
  application to query the maximum global
  size that can be used to execute a kernel
  (i.e. global_work_size argument to
  clEnqueueNDRangeKernel) on a custom
  device given by device or a built-in kernel
  on an OpenCL device given by device.

It is not used to get current global work group size.

On Tue, Sep 09, 2014 at 09:36:58AM +0800, xionghu.luo at intel.com wrote:
> From: Luo Xionghu <xionghu.luo at intel.com>
> 
> add CL_KERNEL_GLOBAL_WORK_SIZE option for clGetKernelWorkGroupInfo.
> 
> Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
> ---
>  src/cl_api.c       |    3 +++
>  src/cl_device_id.c |    1 +
>  src/cl_kernel.h    |    2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/src/cl_api.c b/src/cl_api.c
> index 2370dc0..07e8954 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -2965,6 +2965,9 @@ clEnqueueNDRangeKernel(cl_command_queue  command_queue,
>      }
>    }
>  
> +  for (i = 0; i < work_dim; ++i)
> +    kernel->global_work_sz[i] = fixed_global_sz[i];
> +
>    /* Do device specific checks are enqueue the kernel */
>    err = cl_command_queue_ND_range(command_queue,
>                                    kernel,
> diff --git a/src/cl_device_id.c b/src/cl_device_id.c
> index a0f0c99..6bd80a6 100644
> --- a/src/cl_device_id.c
> +++ b/src/cl_device_id.c
> @@ -573,6 +573,7 @@ cl_get_kernel_workgroup_info(cl_kernel kernel,
>      }
>      DECL_FIELD(COMPILE_WORK_GROUP_SIZE, kernel->compile_wg_sz)
>      DECL_FIELD(PRIVATE_MEM_SIZE, kernel->stack_size)
> +    DECL_FIELD(GLOBAL_WORK_SIZE, kernel->global_work_sz)
>      default:
>        return CL_INVALID_VALUE;
>    };
> diff --git a/src/cl_kernel.h b/src/cl_kernel.h
> index f4ed8d3..85a997d 100644
> --- a/src/cl_kernel.h
> +++ b/src/cl_kernel.h
> @@ -59,6 +59,8 @@ struct _cl_kernel {
>    cl_ulong local_mem_sz;      /* local memory size specified in kernel args. */
>    size_t compile_wg_sz[3];    /* Required workgroup size by __attribute__((reqd_work_gro
>                                   up_size(X, Y, Z))) qualifier.*/
> +  size_t global_work_sz[3];    /* maximum global size that can be used to execute a kernel
> +                                (i.e. global_work_size argument to clEnqueueNDRangeKernel.)*/
>    size_t stack_size;          /* stack size per work item. */
>    cl_argument *args;          /* To track argument setting */
>    uint32_t arg_n:31;          /* Number of arguments */
> -- 
> 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