[Piglit] [PATCH] Use right comparison function for double

Vesely jv356 at scarletmail.rutgers.edu
Wed Aug 24 20:54:44 UTC 2016


On Wed, 2016-08-24 at 20:19 +0100, Ian Romanick wrote:
> The subject line should be tagged "cl:" so that people know it's an
> OpenCL related patch.

I added the prefix before pushing.

Jan

> 
> On 08/24/2016 05:33 AM, arsenm2 at gmail.com wrote:
> > 
> > From: Matt Arsenault <arsenm2 at gmail.com>
> > 
> > ---
> >  tests/cl/program/program-tester.c | 12 ++++++------
> >  tests/util/piglit-util-cl.c       |  2 +-
> >  2 files changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/tests/cl/program/program-tester.c
> > b/tests/cl/program/program-tester.c
> > index 25b677f..1a87610 100644
> > --- a/tests/cl/program/program-tester.c
> > +++ b/tests/cl/program/program-tester.c
> > @@ -2115,14 +2115,14 @@ check_test_arg_value(struct test_arg
> > test_arg,
> >  			}                                         
> >                        \
> >  		}                                                 
> >                    \
> >  		return true;
> > -#define CASEF(enum_type, type,
> > cl_type)                                      \
> > +#define CASEF(enum_type, type, cl_type, testfn)			
> > 	\
> >  	case
> > enum_type:                                                         
> >  \
> >  		for(i = 0; i < test_arg.length; i++)
> > {                               \
> >  			for(c = 0; c < test_arg.cl_size; c++)
> > {                          \
> >  				rb = i*test_arg.cl_mem_size +
> > c;                             \
> > -				if(!piglit_cl_probe_floating(((cl_
> > type*)value)[rb],          \
> > -				                             ((cl_
> > type*)test_arg.value)[rb], \
> > -				                             test_
> > arg.ulp)) {               \
> > +				if(!testfn(((cl_type*)value)[rb], 
> >          \
> > +		                           ((cl_type*)test_arg.val
> > ue)[rb], \
> > +		                           test_arg.ulp))
> > {                \
> >  					ra = i*test_arg.cl_size +
> > c;                             \
> >  					printf("Error at
> > %s[%zu]\n", type, ra);                  \
> >  					return
> > false;                                            \
> > @@ -2141,8 +2141,8 @@ check_test_arg_value(struct test_arg
> > test_arg,
> >  		CASEI(TYPE_LONG,   "long",   cl_long)
> >  		CASEU(TYPE_ULONG,  "ulong",  cl_ulong)
> >  		CASEH(TYPE_HALF,   "half",   cl_half)
> > -		CASEF(TYPE_FLOAT,  "float",  cl_float)
> > -		CASEF(TYPE_DOUBLE,  "double",  cl_double)
> > +		CASEF(TYPE_FLOAT,  "float",  cl_float,
> > piglit_cl_probe_floating)
> > +		CASEF(TYPE_DOUBLE,  "double",  cl_double,
> > piglit_cl_probe_double)
> >  	}
> >  
> >  #undef CASEF
> > diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-
> > cl.c
> > index fb32fee..dba3263 100644
> > --- a/tests/util/piglit-util-cl.c
> > +++ b/tests/util/piglit-util-cl.c
> > @@ -130,7 +130,7 @@ piglit_cl_probe_double(double value, double
> > expect, uint64_t ulp)
> >  	diff = fabsl(value - expect);
> >  
> >  	if(diff > ulp || isnan(value)) {
> > -		printf("Expecting %f (0x%lx) with tolerance %f
> > (%lu ulps), but got %f (0x%lx)\n",
> > +		printf("Expecting %f (0x%" PRIx64") with tolerance
> > %f (%lu ulps), but got %f (0x%" PRIx64")\n",
> >  		       e.f, e.u, t.f, t.u, v.f, v.u);
> >  		return false;
> >  	}
> > 
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list