[Piglit] [PATCH] CL: Add support for generating double-precision tests

Aaron Watry awatry at gmail.com
Wed Dec 17 20:52:09 PST 2014


The tests are skipped for devices that don't support doubles, and
when the primary data type for a file is double, we enable the cl_khr_fp64 pragma
before writing any kernels.

Signed-off-by: Aaron Watry <awatry at gmail.com>
---
 generated_tests/genclbuiltins.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 7e85a51..9a8e85e 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -395,8 +395,13 @@ def gen(types, minVersions, functions, testDefs, dirName):
                     '[config]\n' +
                     'name: Test '+dataType+' '+fnName+' built-in on CL 1.1\n' +
                     'clc_version_min: '+str(clcVersionMin)+'\n' +
-                    'dimensions: 1\n\n'
+                    'dimensions: 1\n'
             )
+            if (dataType == 'double'):
+                f.write('require_device_extensions: cl_khr_fp64\n')
+
+            # Blank line  to provide separation between config header and tests
+            f.write('\n')
 
             # Write all tests for the built-in function
             tests = functionDef['values']
@@ -416,6 +421,9 @@ def gen(types, minVersions, functions, testDefs, dirName):
             # Terminate the header section
             f.write('!*/\n\n')
 
+            if (dataType == 'double'):
+                f.write('#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n\n')
+
             # Generate the actual kernels
             generate_kernels(f, dataType, fnName, functionDef)
 
-- 
2.2.0



More information about the Piglit mailing list