[Piglit] [PATCH 2/4] cl: Add tests for atan builtin
Tom Stellard
thomas.stellard at amd.com
Wed Jul 2 13:04:53 PDT 2014
---
generated_tests/genclbuiltins.py | 7 +++++--
generated_tests/generate-cl-math-builtins.py | 11 +++++++++++
tests/cl/program/program-tester.c | 1 -
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 9173cdb..da4af5a 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -311,6 +311,7 @@ def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, tss):
argTypes = getArgTypes(argType, functionDef['arg_types'])
argCount = len(argTypes)
+ tolerance = functionDef['tolerance'] if 'tolerance' in functionDef else 0
# For each argument, write a line containing its type, index, and values
for arg in range(0, argCount):
@@ -326,9 +327,11 @@ def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, tss):
# width
if (arg < 2 or not tss):
f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] +
- '[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize) +
- '\n'
+ '[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize)
)
+ if arg == 0:
+ f.write(' tolerance {} ulp'.format(tolerance))
+ f.write('\n')
else:
argInOut = 'arg_in: '
f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] + '[1] ' +
diff --git a/generated_tests/generate-cl-math-builtins.py b/generated_tests/generate-cl-math-builtins.py
index 47752e8..edf93da 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,8 +27,10 @@
import os
from genclbuiltins import gen
+from math import atan, pi
CLC_VERSION_MIN = {
+ 'atan' : 10,
'mix' : 10,
'nextafter' : 10,
'sign' : 10
@@ -41,6 +43,15 @@ F = {
}
tests = {
+ 'atan' : {
+ 'arg_types' : [F, F],
+ 'function_type': 'ttt',
+ 'values' : [
+ [atan(0.0), atan(0.12345), atan(3567147.0)], # Result
+ [0.0, 0.12345, 3567147.0]# Arg0
+ ],
+ 'tolerance' : 2
+ },
'mix' : { #x + (y - x) * a
'arg_types': [F, F, F, F],
'function_type': 'tts',
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index 51a692b..0e35826 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -903,7 +903,6 @@ get_test_arg_tolerance(struct test_arg* test_arg, const char* tolerance_str)
regmatch_t pmatch[2];
char* value_str = NULL;
- fprintf(stderr, "tolerance = %s\n", tolerance_str);
if(regex_get_matches(tolerance_str,
REGEX_ARG_TOLERANCE_ULP,
pmatch,
--
1.8.1.4
More information about the Piglit
mailing list