[Piglit] [PATCH v2] cl: fix clGetKernelWorkGroupInfo
Jan Vesely
jan.vesely at rutgers.edu
Mon Nov 3 15:09:26 PST 2014
On Sun, 2014-11-02 at 14:35 +0100, EdB wrote:
> If there is only one device associed with the kernel and device arg is NULL
typo "associated"
> you don't have to trigger CL_INVALID_DEVICE
Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu>
>
> v2:
> Test for CL_SUCCESS instead of disabling it (Jan Vesely)
> ---
> tests/cl/api/get-kernel-work-group-info.c | 28 +++++++++++++++++++++-------
> 1 file changed, 21 insertions(+), 7 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..a38cdf0 100644
> --- a/tests/cl/api/get-kernel-work-group-info.c
> +++ b/tests/cl/api/get-kernel-work-group-info.c
> @@ -61,6 +61,7 @@ piglit_cl_test(const int argc,
> int i;
> cl_int errNo;
> cl_kernel kernel;
> + cl_uint* dev_count_ptr;
>
> size_t param_value_size;
> void* param_value;
> @@ -168,24 +169,37 @@ piglit_cl_test(const int argc,
> piglit_cl_get_error_name(errNo));
> piglit_merge_result(&result, PIGLIT_FAIL);
> }
> -
> +
> /*
> * CL_INVALID_DEVICE if device is not in the list of devices associated with
> * kernel or if device is NULL but there is more than one device associated
> - * with kernel.
> + * with kernel
> + * or
> + * CL_SUCCESS if device is NULL but there is only one device associated with kernel.
> */
> + dev_count_ptr = piglit_cl_get_program_info(env->program, CL_PROGRAM_NUM_DEVICES);
> errNo = clGetKernelWorkGroupInfo(kernel,
> NULL,
> CL_KERNEL_WORK_GROUP_SIZE,
> 0,
> NULL,
> ¶m_value_size);
> - if(!piglit_cl_check_error(errNo, CL_INVALID_DEVICE)) {
> - fprintf(stderr,
> - "Failed (error code: %s): Trigger CL_INVALID_DEVICE if device is NULL but there is more than one device associated with kernel.\n",
> - piglit_cl_get_error_name(errNo));
> - piglit_merge_result(&result, PIGLIT_FAIL);
> + if (*dev_count_ptr == 1) {
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Trigger CL_SUCCESS if device is NULL but there is only one device associated with kernel.\n",
> + piglit_cl_get_error_name(errNo));
> + piglit_merge_result(&result, PIGLIT_FAIL);
> + }
> + } else {
> + if(!piglit_cl_check_error(errNo, CL_INVALID_DEVICE)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Trigger CL_INVALID_DEVICE if device is NULL but there is more than one device associated with kernel.\n",
> + piglit_cl_get_error_name(errNo));
> + piglit_merge_result(&result, PIGLIT_FAIL);
> + }
> }
> + free(dev_count_ptr);
>
> clReleaseKernel(kernel);
>
--
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20141103/08e6842b/attachment.sig>
More information about the Piglit
mailing list