[Piglit] [PATCH 4/5] cl: Add isnotequal(float, float) relational tests

Bruno Jimenez brunojimen at gmail.com
Fri Jun 13 01:52:46 PDT 2014


On Thu, 2014-06-12 at 19:32 -0400, Tom Stellard wrote:
> On Wed, Jun 11, 2014 at 02:14:14PM -0500, Aaron Watry wrote:
> > Signed-off-by: Aaron Watry <awatry at gmail.com>
> > ---
> >  generated_tests/generate-cl-relational-builtins.py | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/generated_tests/generate-cl-relational-builtins.py b/generated_tests/generate-cl-relational-builtins.py
> > index 97e6be6..f22f5d1 100644
> > --- a/generated_tests/generate-cl-relational-builtins.py
> > +++ b/generated_tests/generate-cl-relational-builtins.py
> > @@ -32,7 +32,8 @@ from genclbuiltins import gen, TRUE
> >  CLC_VERSION_MIN = {
> >      'isnan' : 10,
> >      'isgreater' : 10,
> > -    'isgreaterequal' : 10
> > +    'isgreaterequal' : 10,
> > +    'isnotequal' : 10,
> >  }
> >  
> >  DATA_TYPES = ['float']
> > @@ -71,6 +72,15 @@ tests = {
> >              [0.0,  float("nan"), 1.0,  1,            float("nan"), float("inf"), 1.0,  0.5 ], # Arg0
> >              [0.0,  float("nan"), 1.0,  float("nan"), 1,            float("inf"), 0.5,  1.0 ]  # Arg1
> >          ]
> > +    },
> > +    'isnotequal' : {
> > +        'arg_types': [I, F, F],
> > +        'function_type': 'ttt',
> > +        'values': [
> > +            [0,    TRUE,         0,    TRUE,         TRUE,         0,            TRUE, TRUE],    # Result
> 
> I think comparisons involving nan are always false, so the three nan
> cases should be changed to 0.  You might want to double check this,
> though.

Hi,

That's not entirely true, there's an exception here (too many exceptions
i'm finding in this language) According to the spec for OpenCL 1.2
section 6.12.6 "Relational Functions"

"The relational functions isequal, isgreater, isgreaterequal, isless,
islessequal, and islessgreater always return 0 if either argument is not
a number (NAN) [ok here]. isnotequal returns 1 if one or both arguments
are not a number (NAN) and the argument type is a scalar and returns -1
if one or both arguments are not a number (NAN) and the argument type is
a vector. [exceptions...]"

Bruno
> 
> -Tom
> 
> > +            [0.0,  float("nan"), 1.0,  1,            float("nan"), float("inf"), 1.0,  0.5 ], # Arg0
> > +            [0.0,  float("nan"), 1.0,  float("nan"), 1,            float("inf"), 0.5,  1.0 ]  # Arg1
> > +        ]
> >      }
> >  }
> >  
> > -- 
> > 1.9.1
> > 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit




More information about the Piglit mailing list