[Beignet] [PATCH] GBE: fixed one bug for vector relational builtin functions.

Yang, Rong R rong.r.yang at intel.com
Wed Oct 30 03:20:43 CET 2013


I think it is a piglit bug.

The test using following kernel and input/output.
[test]
name: isnan float2
kernel_name: test_2_isnan_float
arg_out: 0 buffer int[2] 1 1
arg_in: 1 buffer float[2] nan nan

kernel void test_2_isnan_float(global int* out, global float* in0){
  vstore2(isnan(vload2(0, in0)), 0, out);
}

But per openCL spec:
The functions isequal, isnotequal, isgreater, isgreaterequal, isless, islessequal, islessgreater,
isfinite, isinf, isnan, isnormal, isordered, isunordered and signbit shall return a 0 if the
specified relation is false and a 1 if the specified relation is true for scalar argument types. These
functions shall return a 0 if the specified relation is false and a -1 (i.e. all bits set) if the specified
relation is true for vector argument types.

Because the argument type is vector, the arg_out should be -1 -1.

-----Original Message-----
From: Sun, Yi 
Sent: Tuesday, October 29, 2013 4:35 PM
To: Yang, Rong R; Zhigang Gong; beignet at lists.freedesktop.org
Cc: Jin, Gordon
Subject: RE: [Beignet] [PATCH] GBE: fixed one bug for vector relational builtin functions.

It seems this patch introduced a regression issue:
./piglit-run.py -t float-isnan-1.0.generated tests/all_cl.tests t

Thanks
  --Sun, Yi

> -----Original Message-----
> From: beignet-bounces+yi.sun=intel.com at lists.freedesktop.org
> [mailto:beignet-bounces+yi.sun=intel.com at lists.freedesktop.org] On 
> Behalf Of Yang, Rong R
> Sent: Tuesday, October 29, 2013 3:44 PM
> To: Zhigang Gong; beignet at lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] GBE: fixed one bug for vector 
> relational builtin functions.
> 
> LGTM, thanks.
> 
> -----Original Message-----
> From: beignet-bounces at lists.freedesktop.org
> [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang 
> Gong
> Sent: Tuesday, October 29, 2013 3:07 PM
> To: beignet at lists.freedesktop.org
> Cc: Zhigang Gong
> Subject: [Beignet] [PATCH] GBE: fixed one bug for vector relational 
> builtin functions.
> 
> For most vector relational builtin functions, we need to return -1 if 
> the element result is true, return 0 if the element result is 0. So we 
> can simply put a - in front of the scalar version of function for each element.
> 
> Reported by Yang Rong.
> 
> Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
> ---
>  backend/src/gen_builtin_vector.py |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/backend/src/gen_builtin_vector.py
> b/backend/src/gen_builtin_vector.py
> index 0a30738..d7336af 100755
> --- a/backend/src/gen_builtin_vector.py
> +++ b/backend/src/gen_builtin_vector.py
> @@ -293,6 +293,8 @@ class builtinProto():
>                  if j % 2 == 0:
>                      formatStr = self.append(formatStr, 
> self.indentSpace())
> 
> +            if self.prefix == 'relational' and self.functionName != 'bitselect'
> and self.functionName != 'select':
> +                formatStr += '-'
>              formatStr += '{}('.format(self.functionName)
>              for n in range(0, self.paramCount):
>                  if n != 0:
> --
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list