[Piglit] [PATCH] cl: Add test program-scope-arrays.

Jan Vesely jan.vesely at rutgers.edu
Wed Nov 27 18:24:09 PST 2013


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 tests/cl/program/execute/program-scope-arrays.cl | 57 ++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 tests/cl/program/execute/program-scope-arrays.cl

diff --git a/tests/cl/program/execute/program-scope-arrays.cl b/tests/cl/program/execute/program-scope-arrays.cl
new file mode 100644
index 0000000..b9a962c
--- /dev/null
+++ b/tests/cl/program/execute/program-scope-arrays.cl
@@ -0,0 +1,57 @@
+/*!
+[config]
+name: program-scope-arrays
+dimensions: 1
+global_size: 4 0 0
+
+
+[test]
+name: simple-constant
+kernel_name: simple_constant
+arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
+
+[test]
+name: given-constant
+kernel_name: given_constant
+arg_in: 1 int 1
+arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
+
+[test]
+name: simple-gid
+kernel_name: simple_gid
+arg_out: 0 buffer float[4] 4.0 3.0 2.0 1.0
+
+[test]
+name: indirection
+kernel_name: indirection
+arg_in: 1 buffer uchar[4] 0 1 2 3
+arg_out: 0 buffer float[4] 4.0 3.0 2.0 1.0
+
+!*/
+
+__constant float arr[] = {
+4.0f,
+3.0f,
+2.0f,
+1.0f,
+};
+
+__kernel void simple_constant(__global float *out) {
+	int i = get_global_id(0);
+	out[i] = arr[1];
+}
+
+__kernel void given_constant(__global float *out, int c) {
+	int i = get_global_id(0);
+	out[i] = arr[c];
+}
+
+__kernel void simple_gid(__global float *out) {
+	int i = get_global_id(0);
+	out[i] = arr[i];
+}
+
+__kernel void indirection(__global float *out, __global uchar *in) {
+	int i = get_global_id(0);
+	out[i] = arr[in[i]];
+}
-- 
1.8.3.1



More information about the Piglit mailing list