[Piglit] [PATCH] cl: Add sqrt tests

Aaron Watry awatry at gmail.com
Sat Oct 26 15:03:42 CEST 2013


On Fri, Oct 25, 2013 at 11:08 PM, Tom Stellard <tom at stellard.net> wrote:
> On Fri, Oct 25, 2013 at 05:40:47PM -0500, Aaron Watry wrote:
>> Pretty basic, but we didn't have any tests for this before...
>>
>> Tested on r600g w/ CEDAR.
>> ---
>>  generated_tests/generate-cl-math-builtins.py | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/generated_tests/generate-cl-math-builtins.py b/generated_tests/generate-cl-math-builtins.py
>> index b6b4e43..150c412 100644
>> --- a/generated_tests/generate-cl-math-builtins.py
>> +++ b/generated_tests/generate-cl-math-builtins.py
>> @@ -57,6 +57,14 @@ tests = {
>>              [1.0, -1.0, 0.0, -0.0, 0.0],
>>              [0.5, -0.5, 0.0, -0.0, float("nan")]
>>          ]
>> +    },
>> +    'sqrt' : {
>> +        'arg_types': [F, F],
>> +        'function_type': 'ttt',
>> +        'values': [
>> +            [1.0, 2.0,  6.0, 2.5 , float("nan"), 4.0], # Result
>> +            [1.0, 4.0, 36.0, 6.25, float("nan"), 16.0], # Arg1
>
> I think you should also add one or more cases here that require a lot of
> precision.  I'm pretty sure we get this wrong on r600g, since we are
> using the instruction that calculates the approximate sqrt.
>

Alright.

> Also, I think it would be good to add a TODO somewhere in the python
> script for checking that the results of the builtins satisfy the ulp
> requirements for the spec.

Yeah, I wasn't sure how to specify tolerances in a cl test case, so I
had specifically chosen values that I knew would come out exact given
my limited understanding of floating point encoding.  We definitely
need to test the precision of float instructions, and I'll add a TODO
for that.

I realized that I also forgot to send the hunk that sets
CLC_VERSION_MIN for sqrt to 10.  I'll make sure to include that bit
when I push.

--Aaron

>
> With these changes, the patch is:
> Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
>
>> +        ]
>>      }
>>  }
>>
>> --
>> 1.8.3.2
>>
>> _______________________________________________
>> Piglit mailing list
>> Piglit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list