[Piglit] [PATCH v2 3/3] cl: Replace handwritten vload tests with a generator
Jan Vesely
jan.vesely at rutgers.edu
Thu Aug 17 00:39:42 UTC 2017
v2: simplify
mark local storage volatile
Passes on beignet(IVB), and intel CPU
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
clover on carrizo passes as well, apart from vload_half tests, because
the function is missing in libclc
generated_tests/CMakeLists.txt | 4 +
generated_tests/gen_cl_vload_tests.py | 212 +++++++++++++++++++++++++
tests/cl.py | 2 +
tests/cl/program/execute/vload-constant-int.cl | 64 --------
tests/cl/program/execute/vload-int.cl | 175 --------------------
tests/cl/program/execute/vload-local-int.cl | 105 ------------
tests/cl/program/execute/vload-private-int.cl | 105 ------------
7 files changed, 218 insertions(+), 449 deletions(-)
create mode 100644 generated_tests/gen_cl_vload_tests.py
delete mode 100644 tests/cl/program/execute/vload-constant-int.cl
delete mode 100644 tests/cl/program/execute/vload-int.cl
delete mode 100644 tests/cl/program/execute/vload-local-int.cl
delete mode 100644 tests/cl/program/execute/vload-private-int.cl
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 44572bdf6..fe82ccfa4 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -214,6 +214,9 @@ piglit_make_generated_tests(
cl_vstore_tests.list
gen_cl_vstore_tests.py)
piglit_make_generated_tests(
+ cl_vload_tests.list
+ gen_cl_vload_tests.py)
+piglit_make_generated_tests(
builtin_cl_math_tests.list
gen_cl_math_builtins.py)
piglit_make_generated_tests(
@@ -271,6 +274,7 @@ add_custom_target(gen-cl-tests
builtin_cl_common_tests.list
cl_store_tests.list
cl_vstore_tests.list
+ cl_vload_tests.list
)
# Add a "gen-tests" target that can be used to generate all the
diff --git a/generated_tests/gen_cl_vload_tests.py b/generated_tests/gen_cl_vload_tests.py
new file mode 100644
index 000000000..7ebb20fa7
--- /dev/null
+++ b/generated_tests/gen_cl_vload_tests.py
@@ -0,0 +1,212 @@
+# Copyright 2016 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+from __future__ import print_function, division, absolute_import
+import os
+import textwrap
+import random
+
+from six.moves import range
+
+from modules import utils
+
+TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'half', 'float', 'double']
+VEC_SIZES = ['2', '4', '8', '16']
+
+dirName = os.path.join("cl", "vload")
+
+
+def gen_array(size):
+ random.seed(size)
+ return [str(random.randint(0, 255)) for i in range(size)]
+
+
+def ext_req(type_name):
+ if type_name[:6] == "double":
+ return "require_device_extensions: cl_khr_fp64"
+ if type_name[:6] == "half":
+ return "require_device_extensions: cl_khr_fp16"
+ return ""
+
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+ fileName = os.path.join(dirName, 'vload'+ suffix + '-' + type_name + '-' + addr_space + '.cl')
+ print(fileName)
+ f = open(fileName, 'w')
+ f.write(textwrap.dedent(("""
+ /*!
+ [config]
+ name: Vector load{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)))
+ for s in vec_sizes:
+ size = int(s) if s != '' else 1
+ data_array = gen_array(size)
+ ty_name = type_name + s
+ f.write(textwrap.dedent("""
+ [test]
+ name: vector load{suffix} {addr_space} {type_name}
+ kernel_name: vload{suffix}{n}_{addr_space}
+ arg_in: 0 buffer {mem_type}[{size}] 0 {gen_array}
+ arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
+
+ [test]
+ name: vector load{suffix} {addr_space} offset {type_name}
+ kernel_name: vload{suffix}{n}_{addr_space}_offset
+ arg_in: 0 buffer {mem_type}[{offset_size}] {zeros}{gen_array}
+ arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
+ """.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=' '.join(data_array), suffix=suffix,
+ addr_space=addr_space,
+ first_array="0 " + ' '.join(data_array[:-1]))))
+
+ f.write(textwrap.dedent("""
+ !*/
+ """))
+ if type_name == "double":
+ f.write(textwrap.dedent("""
+ #pragma OPENCL EXTENSION cl_khr_fp64: enable
+ """))
+ if type_name == "half":
+ f.write(textwrap.dedent("""
+ #pragma OPENCL EXTENSION cl_khr_fp16: enable
+ """))
+ return f
+
+def gen_test_constant_global(suffix, t, mem_type, vec_sizes, addr_space):
+ f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+ for s in vec_sizes:
+ type_name = t + s
+ f.write(textwrap.dedent("""
+ kernel void vload{suffix}{n}_{addr_space}({addr_space} {mem_type} *in,
+ global {type_name} *out) {{
+ out[0] = vload{suffix}{n}(0, in);
+ out[1] = vload{suffix}{n}(0, in + 1);
+ }}
+
+ kernel void vload{suffix}{n}_{addr_space}_offset({addr_space} {mem_type} *in,
+ global {type_name} *out) {{
+ out[0] = vload{suffix}{n}(1, in);
+ out[1] = vload{suffix}{n}(1, in + 1);
+ }}
+ """.format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix,
+ addr_space=addr_space)))
+
+ f.close()
+
+def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space):
+ f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+ for s in vec_sizes:
+ size = int(s) if s != '' else 1
+ type_name = t + s
+ f.write(textwrap.dedent("""
+ kernel void vload{suffix}{n}_{addr_space}(global {mem_type} *in,
+ global {type_name} *out) {{
+ volatile {addr_space} {mem_type} loc[{size}];
+ for (int i = 0; i < {size}; ++i)
+ loc[i] = in[i];
+
+ out[0] = vload{suffix}{n}(0, ({addr_space} {mem_type}*)loc);
+ out[1] = vload{suffix}{n}(0, ({addr_space} {mem_type}*)loc + 1);
+ }}
+
+ kernel void vload{suffix}{n}_{addr_space}_offset(global {mem_type} *in,
+ global {type_name} *out) {{
+ volatile {addr_space} {mem_type} loc[{offset_size}];
+ for (int i = 0; i < {offset_size}; ++i)
+ loc[i] = in[i];
+
+ out[0] = vload{suffix}{n}(1, ({addr_space} {mem_type}*)loc);
+ out[1] = vload{suffix}{n}(1, ({addr_space} {mem_type}*)loc + 1);
+ }}
+ """.format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix,
+ offset_size=size*2 + 1, size=size + 1, addr_space=addr_space)))
+
+ f.close()
+
+# vload_half is special, becuase CLC won't allow us to use half type without
+# cl_khr_fp16
+def gen_test_local_private_half(suffix, t, vec_sizes, addr_space):
+ f = begin_test(suffix, t, 'half', vec_sizes, addr_space)
+ for s in vec_sizes:
+ size = int(s) if s != '' else 1
+ type_name = t + s
+ f.write(textwrap.dedent("""
+ kernel void vload{suffix}{n}_{addr_space}(global half *in,
+ global {type_name} *out) {{
+ volatile {addr_space} short loc[{size}];
+ for (int i = 0; i < {size}; ++i)
+ loc[i] = ((global short *)in)[i];
+
+ out[0] = vload{suffix}{n}(0, ({addr_space} half*)loc);
+ out[1] = vload{suffix}{n}(0, ({addr_space} half*)loc + 1);
+ }}
+
+ kernel void vload{suffix}{n}_{addr_space}_offset(global half *in,
+ global {type_name} *out) {{
+ volatile {addr_space} short loc[{offset_size}];
+ for (int i = 0; i < {offset_size}; ++i)
+ loc[i] = ((global short *)in)[i];
+
+ out[0] = vload{suffix}{n}(1, ({addr_space} half*)loc);
+ out[1] = vload{suffix}{n}(1, ({addr_space} half*)loc + 1);
+ }}
+ """.format(type_name=type_name, n=s, suffix=suffix,
+ offset_size=size*2 + 1, size=size + 1, addr_space=addr_space)))
+
+def gen_test_local(suffix, t, mem_type, vec_sizes):
+ if (mem_type == 'half'):
+ gen_test_local_private_half(suffix, t, vec_sizes, 'local')
+ else:
+ gen_test_local_private(suffix, t, mem_type, vec_sizes, 'local')
+
+def gen_test_private(suffix, t, mem_type, vec_sizes):
+ if (mem_type == 'half'):
+ gen_test_local_private_half(suffix, t, vec_sizes, 'private')
+ else:
+ gen_test_local_private(suffix, t, mem_type, vec_sizes, 'private')
+
+def gen_test_global(suffix, t, mem_type, vec_sizes):
+ gen_test_constant_global(suffix, t, mem_type, vec_sizes, 'global')
+
+def gen_test_constant(suffix, t, mem_type, vec_sizes):
+ gen_test_constant_global(suffix, t, mem_type, vec_sizes, 'constant')
+
+def main():
+ utils.safe_makedirs(dirName)
+ for t in TYPES:
+ gen_test_constant('', t, t, VEC_SIZES);
+ gen_test_global('', t, t, VEC_SIZES);
+ gen_test_local('', t, t, VEC_SIZES);
+ gen_test_private('', t, t, VEC_SIZES);
+
+ # There's no vload_half for double type
+ gen_test_constant('_half', 'float', 'half', [''] + VEC_SIZES);
+ gen_test_global('_half', 'float', 'half', [''] + VEC_SIZES);
+ gen_test_local('_half', 'float', 'half', [''] + VEC_SIZES);
+ gen_test_private('_half', 'float', 'half', [''] + VEC_SIZES);
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/cl.py b/tests/cl.py
index f06b3f638..ffaefb574 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -143,3 +143,5 @@ add_program_test_dir(grouptools.join('program', 'execute', 'store'),
os.path.join(GENERATED_TESTS_DIR, 'cl', 'store'))
add_program_test_dir(grouptools.join('program', 'execute', 'vstore'),
os.path.join(GENERATED_TESTS_DIR, 'cl', 'vstore'))
+add_program_test_dir(grouptools.join('program', 'execute', 'vload'),
+ os.path.join(GENERATED_TESTS_DIR, 'cl', 'vload'))
diff --git a/tests/cl/program/execute/vload-constant-int.cl b/tests/cl/program/execute/vload-constant-int.cl
deleted file mode 100644
index c568d7770..000000000
--- a/tests/cl/program/execute/vload-constant-int.cl
+++ /dev/null
@@ -1,64 +0,0 @@
-/*!
-[config]
-name: constant vload int4
-clc_version_min: 10
-
-dimensions: 1
-global_size: 1 0 0
-
-[test]
-name: vector load2
-kernel_name: vecload2
-arg_out: 0 buffer int[2] 1 2
-arg_in: 1 buffer int[2] 1 2
-
-[test]
-name: vector load3
-kernel_name: vecload3
-arg_out: 0 buffer int[3] 1 2 3
-arg_in: 1 buffer int[3] 1 2 3
-
-[test]
-name: vector load4
-kernel_name: vecload4
-arg_out: 0 buffer int[4] 1 2 3 4
-arg_in: 1 buffer int[4] 1 2 3 4
-
-[test]
-name: vector load8
-kernel_name: vecload8
-arg_out: 0 buffer int[8] 1 2 3 4 5 6 7 8
-arg_in: 1 buffer int[8] 1 2 3 4 5 6 7 8
-
-[test]
-name: vector load16
-kernel_name: vecload16
-arg_out: 0 buffer int[16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-arg_in: 1 buffer int[16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-
-
-!*/
-
-kernel void load1(global int* out, constant int* input) {
- out[0] = input[0];
-}
-
-kernel void vecload2(global int* out, constant int* input) {
- vstore2(vload2(0, input), 0, out);
-}
-
-kernel void vecload3(global int* out, constant int* input) {
- vstore3(vload3(0, input), 0, out);
-}
-
-kernel void vecload4(global int* out, constant int* input) {
- vstore4(vload4(0, input), 0, out);
-}
-
-kernel void vecload8(global int* out, constant int* input) {
- vstore8(vload8(0, input), 0, out);
-}
-
-kernel void vecload16(global int* out, constant int* input) {
- vstore16(vload16(0, input), 0, out);
-}
diff --git a/tests/cl/program/execute/vload-int.cl b/tests/cl/program/execute/vload-int.cl
deleted file mode 100644
index 44cf8861b..000000000
--- a/tests/cl/program/execute/vload-int.cl
+++ /dev/null
@@ -1,175 +0,0 @@
-/*!
-[config]
-name: Vector load int2,3,4,8,16
-clc_version_min: 10
-
-dimensions: 1
-global_size: 1 0 0
-
-[test]
-name: vector load int2
-kernel_name: vload2_test
-arg_out: 0 buffer int[2] 56 65
-arg_in: 1 buffer int[2] 56 65
-
-[test]
-name: vector load int2 with offset
-kernel_name: vload2_offset
-arg_out: 0 buffer int[2] 56 65
-arg_in: 1 buffer int[4] 0 0 56 65
-
-[test]
-name: vector load int3
-kernel_name: vload3_test
-arg_out: 0 buffer int[3] 56 65 12
-arg_in: 1 buffer int[3] 56 65 12
-
-[test]
-name: vector load int3 with offset
-kernel_name: vload3_offset
-arg_out: 0 buffer int[3] 56 65 12
-arg_in: 1 buffer int[6] 0 0 0 56 65 12
-
-[test]
-name: vector load int4
-kernel_name: vload4_test
-arg_out: 0 buffer int[4] 56 65 18 81
-arg_in: 1 buffer int[4] 56 65 18 81
-
-[test]
-name: vector load int4 with offset
-kernel_name: vload4_offset
-arg_out: 0 buffer int[4] 56 65 18 81
-arg_in: 1 buffer int[8] 0 0 0 0 56 65 18 81
-
-[test]
-name: vector load int8
-kernel_name: vload8_test
-arg_out: 0 buffer int[8] 56 65 18 81 12 21 34 43
-arg_in: 1 buffer int[8] 56 65 18 81 12 21 34 43
-
-[test]
-name: vector load int8 with offset
-kernel_name: vload8_offset
-arg_out: 0 buffer int[8] 56 65 18 81 12 21 34 43
-arg_in: 1 buffer int[16] 0 0 0 0 0 0 0 0 56 65 18 81 12 21 34 43
-
-[test]
-name: vector load int16
-kernel_name: vload16_test
-arg_out: 0 buffer int[16] 56 65 18 81 12 21 34 43 23 32 67 76 78 87 89 98
-arg_in: 1 buffer int[16] 56 65 18 81 12 21 34 43 23 32 67 76 78 87 89 98
-
-[test]
-name: vector load int16 with offset
-kernel_name: vload16_offset
-arg_out: 0 buffer int[16] 56 65 18 81 12 21 34 43 23 32 67 76 78 87 89 98
-arg_in: 1 buffer int[32] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
- 56 65 18 81 12 21 34 43 23 32 67 76 78 87 89 98
-!*/
-
-kernel void vload2_test(global int* out, global int* in) {
- int2 val = vload2(0, in);
- out[0] = val.s0;
- out[1] = val.s1;
-}
-
-kernel void vload2_offset(global int* out, global int* in) {
- int2 val = vload2(1, in);
- out[0] = val.s0;
- out[1] = val.s1;
-}
-
-kernel void vload3_test(global int* out, global int* in) {
- int3 val = vload3(0, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
-}
-
-kernel void vload3_offset(global int* out, global int* in) {
- int3 val = vload3(1, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
-}
-
-kernel void vload4_test(global int* out, global int* in) {
- int4 val = vload4(0, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
- out[3] = val.s3;
-}
-
-kernel void vload4_offset(global int* out, global int* in) {
- int4 val = vload4(1, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
- out[3] = val.s3;
-}
-
-kernel void vload8_test(global int* out, global int* in) {
- int8 val = vload8(0, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
- out[3] = val.s3;
- out[4] = val.s4;
- out[5] = val.s5;
- out[6] = val.s6;
- out[7] = val.s7;
-}
-
-kernel void vload8_offset(global int* out, global int* in) {
- int8 val = vload8(1, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
- out[3] = val.s3;
- out[4] = val.s4;
- out[5] = val.s5;
- out[6] = val.s6;
- out[7] = val.s7;
-}
-
-kernel void vload16_test(global int* out, global int* in) {
- int16 val = vload16(0, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
- out[3] = val.s3;
- out[4] = val.s4;
- out[5] = val.s5;
- out[6] = val.s6;
- out[7] = val.s7;
- out[8] = val.s8;
- out[9] = val.s9;
- out[10] = val.sa;
- out[11] = val.sb;
- out[12] = val.sc;
- out[13] = val.sd;
- out[14] = val.se;
- out[15] = val.sf;
-}
-
-kernel void vload16_offset(global int* out, global int* in) {
- int16 val = vload16(1, in);
- out[0] = val.s0;
- out[1] = val.s1;
- out[2] = val.s2;
- out[3] = val.s3;
- out[4] = val.s4;
- out[5] = val.s5;
- out[6] = val.s6;
- out[7] = val.s7;
- out[8] = val.s8;
- out[9] = val.s9;
- out[10] = val.sa;
- out[11] = val.sb;
- out[12] = val.sc;
- out[13] = val.sd;
- out[14] = val.se;
- out[15] = val.sf;
-}
diff --git a/tests/cl/program/execute/vload-local-int.cl b/tests/cl/program/execute/vload-local-int.cl
deleted file mode 100644
index 55f0dd8f3..000000000
--- a/tests/cl/program/execute/vload-local-int.cl
+++ /dev/null
@@ -1,105 +0,0 @@
-/*!
-[config]
-name: local_memory
-
-dimensions: 1
-global_size: 1 0 0
-local_size: 1 0 0
-
-[test]
-name: Scalar (sanity) test
-kernel_name: scalar_test
-arg_out: 0 buffer int[1] 1
-
-
-[test]
-name: vload2 local
-kernel_name: vecload2
-arg_out: 0 buffer int[2] 1 2
-
-[test]
-name: vload3 local
-kernel_name: vecload3
-arg_out: 0 buffer int[3] 1 2 3
-
-[test]
-name: vload4 local
-kernel_name: vecload4
-arg_out: 0 buffer int[4] 1 2 3 4
-
-[test]
-name: vload8 local
-kernel_name: vecload8
-arg_out: 0 buffer int[8] 1 2 3 4 5 6 7 8
-
-[test]
-name: vload16 local
-kernel_name: vecload16
-arg_out: 0 buffer int[16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-
-
-!*/
-
-kernel void scalar_test(global int* out){
- local int local_mem[1];
- local_mem[0] = 1;
- out[0] = local_mem[0];
-}
-
-kernel void vecload2(global int *out) {
- local int local_mem[2];
- local_mem[0] = 1;
- local_mem[1] = 2;
- vstore2(vload2(0, local_mem), 0, out);
-}
-
-kernel void vecload3(global int *out) {
- local int local_mem[3];
- local_mem[0] = 1;
- local_mem[1] = 2;
- local_mem[2] = 3;
- vstore3(vload3(0, local_mem), 0, out);
-}
-
-kernel void vecload4(global int *out) {
- local int local_mem[4];
- local_mem[0] = 1;
- local_mem[1] = 2;
- local_mem[2] = 3;
- local_mem[3] = 4;
- vstore4(vload4(0, local_mem), 0, out);
-}
-
-kernel void vecload8(global int *out) {
- local int local_mem[8];
- local_mem[0] = 1;
- local_mem[1] = 2;
- local_mem[2] = 3;
- local_mem[3] = 4;
- local_mem[4] = 5;
- local_mem[5] = 6;
- local_mem[6] = 7;
- local_mem[7] = 8;
- vstore8(vload8(0, local_mem), 0, out);
-}
-
-kernel void vecload16(global int *out) {
- local int local_mem[16];
- local_mem[0] = 1;
- local_mem[1] = 2;
- local_mem[2] = 3;
- local_mem[3] = 4;
- local_mem[4] = 5;
- local_mem[5] = 6;
- local_mem[6] = 7;
- local_mem[7] = 8;
- local_mem[8] = 9;
- local_mem[9] = 10;
- local_mem[10] = 11;
- local_mem[11] = 12;
- local_mem[12] = 13;
- local_mem[13] = 14;
- local_mem[14] = 15;
- local_mem[15] = 16;
- vstore16(vload16(0, local_mem), 0, out);
-}
diff --git a/tests/cl/program/execute/vload-private-int.cl b/tests/cl/program/execute/vload-private-int.cl
deleted file mode 100644
index aeea01b47..000000000
--- a/tests/cl/program/execute/vload-private-int.cl
+++ /dev/null
@@ -1,105 +0,0 @@
-/*!
-[config]
-name: private_memory
-
-dimensions: 1
-global_size: 1 0 0
-local_size: 1 0 0
-
-[test]
-name: Scalar (sanity) test
-kernel_name: scalar_test
-arg_out: 0 buffer int[1] 1
-
-
-[test]
-name: vload2 private
-kernel_name: vecload2
-arg_out: 0 buffer int[2] 1 2
-
-[test]
-name: vload3 private
-kernel_name: vecload3
-arg_out: 0 buffer int[3] 1 2 3
-
-[test]
-name: vload4 private
-kernel_name: vecload4
-arg_out: 0 buffer int[4] 1 2 3 4
-
-[test]
-name: vload8 private
-kernel_name: vecload8
-arg_out: 0 buffer int[8] 1 2 3 4 5 6 7 8
-
-[test]
-name: vload16 private
-kernel_name: vecload16
-arg_out: 0 buffer int[16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-
-
-!*/
-
-kernel void scalar_test(global int* out){
- private int private_mem[1];
- private_mem[0] = 1;
- out[0] = private_mem[0];
-}
-
-kernel void vecload2(global int *out) {
- private int private_mem[2];
- private_mem[0] = 1;
- private_mem[1] = 2;
- vstore2(vload2(0, private_mem), 0, out);
-}
-
-kernel void vecload3(global int *out) {
- private int private_mem[3];
- private_mem[0] = 1;
- private_mem[1] = 2;
- private_mem[2] = 3;
- vstore3(vload3(0, private_mem), 0, out);
-}
-
-kernel void vecload4(global int *out) {
- private int private_mem[4];
- private_mem[0] = 1;
- private_mem[1] = 2;
- private_mem[2] = 3;
- private_mem[3] = 4;
- vstore4(vload4(0, private_mem), 0, out);
-}
-
-kernel void vecload8(global int *out) {
- private int private_mem[8];
- private_mem[0] = 1;
- private_mem[1] = 2;
- private_mem[2] = 3;
- private_mem[3] = 4;
- private_mem[4] = 5;
- private_mem[5] = 6;
- private_mem[6] = 7;
- private_mem[7] = 8;
- vstore8(vload8(0, private_mem), 0, out);
-}
-
-kernel void vecload16(global int *out) {
- private int private_mem[16];
- private_mem[0] = 1;
- private_mem[1] = 2;
- private_mem[2] = 3;
- private_mem[3] = 4;
- private_mem[4] = 5;
- private_mem[5] = 6;
- private_mem[6] = 7;
- private_mem[7] = 8;
- private_mem[8] = 9;
- private_mem[9] = 10;
- private_mem[10] = 11;
- private_mem[11] = 12;
- private_mem[12] = 13;
- private_mem[13] = 14;
- private_mem[14] = 15;
- private_mem[15] = 16;
- vstore16(vload16(0, private_mem), 0, out);
-}
--
2.13.5
More information about the Piglit
mailing list