On Wed, Sep 17, 2014 at 06:05:12AM +0800, [email protected] wrote:
> From: Luo <[email protected]>
> 
> the option  CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo
> should call built in kernel or custom device according to the spec,
> this patch calls the built in kernel to query the GLOBAL_WOR_SIZ.
> 

This commit message doesn't seem to match the contents of the patch.

> Signed-off-by: Luo <[email protected]>
> ---
>  tests/cl/api/get-kernel-work-group-info.c |   40 
> ++++++++++++++++++++++++++---
>  1 file changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> b/tests/cl/api/get-kernel-work-group-info.c
> index 47d09da..2b2c7ba 100644
> --- a/tests/cl/api/get-kernel-work-group-info.c
> +++ b/tests/cl/api/get-kernel-work-group-info.c
> @@ -60,6 +60,7 @@ piglit_cl_test(const int argc,
>  
>       int i;
>       cl_int errNo;
> +     cl_program built_in_prog;
>       cl_kernel kernel;
>  
>       size_t param_value_size;
> @@ -70,15 +71,47 @@ piglit_cl_test(const int argc,
>       const cl_kernel_work_group_info* kernel_work_group_infos =
>               PIGLIT_CL_ENUM_ARRAY(cl_kernel_work_group_info);
>  
> -     kernel = clCreateKernel(env->program,
> -                             "dummy_kernel",
> -                             &errNo);
> +     char* built_in_kernel_names;
> +     char* kernel_name;
> +     size_t built_in_kernels_size;
> +     size_t ret_sz;
> +
> +     errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 0, 
> 0, &built_in_kernels_size);
> +     if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> +             fprintf(stderr,
> +                     "Failed (error code: %s): Get Device Info.\n",
> +                     piglit_cl_get_error_name(errNo));
> +             return PIGLIT_FAIL;
> +     }
> +
> +     built_in_kernel_names = (char* )malloc(built_in_kernels_size * 
> sizeof(char) );
> +
> +     errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 
> built_in_kernels_size, (void*)built_in_kernel_names, &ret_sz);
> +     if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> +             fprintf(stderr,
> +                     "Failed (error code: %s): Get Device Info.\n",
> +                     piglit_cl_get_error_name(errNo));
> +             return PIGLIT_FAIL;
> +     }
> +
> +     built_in_prog = clCreateProgramWithBuiltInKernels(env->context->cl_ctx, 
> 1, &env->device_id, built_in_kernel_names, &errNo);

Won't this call fail if there are no builtin kernels?

-Tom

> +     if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> +             fprintf(stderr,
> +                     "Failed (error code: %s): Create BuiltIn Program.\n",
> +                     piglit_cl_get_error_name(errNo));
> +             return PIGLIT_FAIL;
> +     }
> +
> +     kernel_name = strtok(built_in_kernel_names, ";");
> +
> +     kernel = clCreateKernel(built_in_prog, kernel_name,  &errNo);
>       if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
>               fprintf(stderr,
>                       "Failed (error code: %s): Create kernel.\n",
>                       piglit_cl_get_error_name(errNo));
>               return PIGLIT_FAIL;
>       }
> +     free(built_in_kernel_names);
>  
>       /*** Normal usage ***/
>       for(i = 0; i < num_kernel_work_group_infos; i++) {
> @@ -188,6 +221,7 @@ piglit_cl_test(const int argc,
>       }
>  
>       clReleaseKernel(kernel);
> +     clReleaseProgram(built_in_prog);
>  
>       return result;
>  }
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Piglit mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/piglit
_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to