[Piglit] [PATCH] cl: Add tests for global atomc_add()
Tom Stellard
thomas.stellard at amd.com
Fri Sep 19 11:23:02 PDT 2014
---
.../builtin/atomic/atomic_add-global.program_test | 46 ++++++++++++++
.../execute/builtin/atomic/atomic_add-local.cl | 70 ----------------------
.../builtin/atomic/atomic_add-local.program_test | 46 ++++++++++++++
.../program/execute/builtin/atomic/atomic_add.inc | 23 +++++++
4 files changed, 115 insertions(+), 70 deletions(-)
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test
delete mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add.inc
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test b/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test
new file mode 100644
index 0000000..26c6752
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test
@@ -0,0 +1,46 @@
+[config]
+name: Scalar Data Type Load (int)
+
+program_source_file: atomic_add.inc
+build_options: -D ATOMIC_ADDRSPACE=global
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -4 1
+arg_in: 1 buffer int[1] 0
+arg_in: 2 int -4
+arg_in: 3 int 5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer uint[2] 4 9
+arg_in: 1 buffer uint[1] 0
+arg_in: 2 uint 4
+arg_in: 3 uint 5
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in: 1 buffer int[1] 0
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in: 1 buffer uint[1] 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
deleted file mode 100644
index c155fbb..0000000
--- a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
+++ /dev/null
@@ -1,70 +0,0 @@
-/*!
-[config]
-name: atomic_add local
-clc_version_min: 11
-
-[test]
-name: simple int
-kernel_name: simple_int
-dimensions: 1
-global_size: 1 0 0
-local_size: 1 0 0
-arg_out: 0 buffer int[2] -4 1
-arg_in: 1 buffer int[1] NULL
-arg_in: 2 int -4
-arg_in: 3 int 5
-
-[test]
-name: simple uint
-kernel_name: simple_uint
-dimensions: 1
-global_size: 1 0 0
-local_size: 1 0 0
-arg_out: 0 buffer uint[2] 4 9
-arg_in: 1 buffer uint[1] NULL
-arg_in: 2 uint 4
-arg_in: 3 uint 5
-
-[test]
-name: threads
-kernel_name: threads_int
-dimensions: 1
-global_size: 8 0 0
-local_size: 8 0 0
-arg_out: 0 buffer int[1] 28
-arg_in: 1 buffer int[1] NULL
-
-[test]
-name: threads
-kernel_name: threads_uint
-dimensions: 1
-global_size: 8 0 0
-local_size: 8 0 0
-arg_out: 0 buffer uint[1] 28
-arg_in: 1 buffer uint[1] NULL
-
-!*/
-
-#define SIMPLE_TEST(TYPE) \
-kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
- *mem = initial; \
- TYPE a = atomic_add(mem, value); \
- out[0] = a; \
- out[1] = *mem; \
-}
-
-#define THREADS_TEST(TYPE) \
-kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
- *mem = 0; \
- barrier(CLK_LOCAL_MEM_FENCE); \
- TYPE id = get_local_id(0); \
- atomic_add(mem, id); \
- barrier(CLK_LOCAL_MEM_FENCE); \
- *out = *mem; \
-}
-
-SIMPLE_TEST(int)
-SIMPLE_TEST(uint)
-
-THREADS_TEST(int)
-THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test b/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test
new file mode 100644
index 0000000..75479d1
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test
@@ -0,0 +1,46 @@
+[config]
+name: Scalar Data Type Load (int)
+
+program_source_file: atomic_add.inc
+build_options: -D ATOMIC_ADDRSPACE=local
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -4 1
+arg_in: 1 buffer int[1] NULL
+arg_in: 2 int -4
+arg_in: 3 int 5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer uint[2] 4 9
+arg_in: 1 buffer uint[1] NULL
+arg_in: 2 uint 4
+arg_in: 3 uint 5
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in: 1 buffer int[1] NULL
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in: 1 buffer uint[1] NULL
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add.inc b/tests/cl/program/execute/builtin/atomic/atomic_add.inc
new file mode 100644
index 0000000..4db4046
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add.inc
@@ -0,0 +1,23 @@
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, ATOMIC_ADDRSPACE TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atomic_add(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, ATOMIC_ADDRSPACE TYPE *mem) { \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ atomic_add(mem, id); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
--
1.8.5.5
More information about the Piglit
mailing list