[Beignet] [PATCH] Libocl: Fix get_sub_group_size bug

Yang, Rong R rong.r.yang at intel.com
Wed Aug 31 08:28:17 UTC 2016


The patch LGTM, but another question in inline comment.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Xiuli Pan
> Sent: Wednesday, August 24, 2016 16:17
> To: beignet at lists.freedesktop.org
> Cc: Pan, Xiuli <xiuli.pan at intel.com>; Zhu, Zhe <zhe.zhu at intel.com>
> Subject: [Beignet] [PATCH] Libocl: Fix get_sub_group_size bug
> 
> From: Pan Xiuli <xiuli.pan at intel.com>
> 
> If last sub group has the max sub group size, it will return 0 instead of max
> sub group size. Fix the bug.
> 
> Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
> ---
>  backend/src/libocl/tmpl/ocl_simd.tmpl.cl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/backend/src/libocl/tmpl/ocl_simd.tmpl.cl
> b/backend/src/libocl/tmpl/ocl_simd.tmpl.cl
> index 9c09b21..f0ef7c0 100644
> --- a/backend/src/libocl/tmpl/ocl_simd.tmpl.cl
> +++ b/backend/src/libocl/tmpl/ocl_simd.tmpl.cl
> @@ -31,7 +31,7 @@ uint get_sub_group_size(void)
>    uint threadn = get_num_sub_groups();
>    uint threadid = get_sub_group_id();
>    if((threadid == (threadn - 1)) && (threadn > 1))

Why threadn > 1? How about thread = 1?


> -    return (get_local_size(0)*get_local_size(1)*get_local_size(2)) %
> get_max_sub_group_size();
> +    return (get_local_size(0)*get_local_size(1)*get_local_size(2) -1) %
> + get_max_sub_group_size() + 1;
>    else
>      return get_max_sub_group_size();
>  }
> --
> 2.7.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list