[Piglit] [PATCH 1/2] cl: prepare vstore generator for additional address space tests
Jan Vesely
jan.vesely at rutgers.edu
Wed Aug 16 21:09:35 UTC 2017
The generated test are identical apart from the addr space added to test names
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
generated_tests/gen_cl_vstore_tests.py | 36 +++++++++++++++++-----------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/generated_tests/gen_cl_vstore_tests.py b/generated_tests/gen_cl_vstore_tests.py
index 8e37de585..d84541f29 100644
--- a/generated_tests/gen_cl_vstore_tests.py
+++ b/generated_tests/gen_cl_vstore_tests.py
@@ -46,54 +46,54 @@ def ext_req(type_name):
return "require_device_extensions: cl_khr_fp16"
return ""
-def begin_test(suffix, type_name, addr_space):
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
fileName = os.path.join(dirName, 'vstore'+ suffix + '-' + type_name + '-' + addr_space + '.cl')
print(fileName)
f = open(fileName, 'w')
f.write(textwrap.dedent(("""
/*!
[config]
- name: Vector store{suffix} {type_name}2,4,8,16
+ name: Vector store{suffix} {addr_space} {type_name}2,4,8,16
clc_version_min: 10
dimensions: 1
global_size: 1 0 0
""" + ext_req(type_name))
.format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
- return f
-
-def gen_test(suffix, t, mem_type, vec_sizes):
- f = begin_test(suffix, t, 'global')
for s in vec_sizes:
size = int(s) if s != '' else 1
- type_name = t + s
+ ty_name = type_name + s
f.write(textwrap.dedent("""
[test]
- name: vector store{suffix} global {type_name}
- kernel_name: vstore{suffix}{n}_global
+ name: vector store{suffix} {addr_space} {type_name}
+ kernel_name: vstore{suffix}{n}_{addr_space}
arg_out: 0 buffer {mem_type}[{size}] 0 {gen_array}
arg_in: 1 buffer {type_name}[1] {gen_array}
[test]
- name: vector store{suffix} global offset {type_name}
- kernel_name: vstore{suffix}{n}_global_offset
+ name: vector store{suffix} {addr_space} offset {type_name}
+ kernel_name: vstore{suffix}{n}_{addr_space}_offset
arg_out: 0 buffer {mem_type}[{offset_size}] {zeros} {gen_array}
arg_in: 1 buffer {type_name}[1] {gen_array}
- """.format(type_name=type_name, mem_type=mem_type, size=size + 1,
+ """.format(type_name=ty_name, mem_type=mem_type, size=size + 1,
zeros=("0 " * (size + 1)), offset_size=size*2 + 1, n=s,
- gen_array=gen_array(size), suffix=suffix)))
+ gen_array=gen_array(size), suffix=suffix, addr_space=addr_space)))
f.write(textwrap.dedent("""
!*/
"""))
- if t == "double":
+ if type_name == "double":
f.write(textwrap.dedent("""
#pragma OPENCL EXTENSION cl_khr_fp64: enable
"""))
- if t == "half":
+ if type_name == "half":
f.write(textwrap.dedent("""
#pragma OPENCL EXTENSION cl_khr_fp16: enable
"""))
+ return f
+
+def gen_test_global(suffix, t, mem_type, vec_sizes):
+ f = begin_test(suffix, t, mem_type, vec_sizes, 'global')
for s in vec_sizes:
type_name = t + s
f.write(textwrap.dedent("""
@@ -120,10 +120,10 @@ def gen_test(suffix, t, mem_type, vec_sizes):
def main():
utils.safe_makedirs(dirName)
for t in TYPES:
- gen_test('', t, t, VEC_SIZES);
+ gen_test_global('', t, t, VEC_SIZES);
- gen_test('_half', 'float', 'half', [''] + VEC_SIZES);
- gen_test('_half', 'double', 'half', [''] + VEC_SIZES);
+ gen_test_global('_half', 'float', 'half', [''] + VEC_SIZES);
+ gen_test_global('_half', 'double', 'half', [''] + VEC_SIZES);
if __name__ == '__main__':
main()
--
2.13.5
More information about the Piglit
mailing list