From 0d8839b22240d867c19c172db5bd03a45875403d Mon Sep 17 00:00:00 2001 From: Aaron Watry Date: Tue, 18 Jun 2013 10:18:54 -0700 Subject: [PATCH] cl: Add test cases from fdo bug 65822 https://bugs.freedesktop.org/show_bug.cgi?id=65822 --- tests/cl/program/execute/add-then-div-looped.cl | 22 ++++++++++++++++++++++ tests/cl/program/execute/add-then-div.cl | 19 +++++++++++++++++++ tests/cl/program/execute/code-in-else.cl | 21 +++++++++++++++++++++ tests/cl/program/execute/divide-uint.cl | 20 ++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 tests/cl/program/execute/add-then-div-looped.cl create mode 100644 tests/cl/program/execute/add-then-div.cl create mode 100644 tests/cl/program/execute/code-in-else.cl create mode 100644 tests/cl/program/execute/divide-uint.cl diff --git a/tests/cl/program/execute/add-then-div-looped.cl b/tests/cl/program/execute/add-then-div-looped.cl new file mode 100644 index 0000000..ce6a3f2 --- /dev/null +++ b/tests/cl/program/execute/add-then-div-looped.cl @@ -0,0 +1,22 @@ +/*! +[config] +name: (a+b) div 3 run 10 times +kernel_name: test2 +clc_version_min: 10 + +dimensions: 1 +global_size: 8 0 0 + +[test] +arg_in: 0 buffer int[80] repeat 1 2 3 4 5 6 7 8 +arg_in: 1 buffer int[80] repeat 2 4 6 8 10 12 14 16 +arg_out: 2 buffer int[80] repeat 1 2 3 4 5 6 7 8 + +!*/ +__kernel void test2(__global const uint *a, __global const uint *b, __global uint *c){ + size_t id=get_global_id(0); + for(ulong i=0;i<10;i++){ + c[8*i+id]=(a[id]+b[id])/3; + } +} + diff --git a/tests/cl/program/execute/add-then-div.cl b/tests/cl/program/execute/add-then-div.cl new file mode 100644 index 0000000..08cf41a --- /dev/null +++ b/tests/cl/program/execute/add-then-div.cl @@ -0,0 +1,19 @@ +/*! +[config] +name: (a+b) div 3 +kernel_name: test1 +clc_version_min: 10 + +dimensions: 1 +global_size: 8 0 0 + +[test] +arg_in: 0 buffer int[8] 1 2 3 4 5 6 7 8 +arg_in: 1 buffer int[8] 2 4 6 8 10 12 14 16 +arg_out: 2 buffer int[8] 1 2 3 4 5 6 7 8 + +!*/ +__kernel void test1(__global const uint *a, __global const uint *b, __global uint *c){ + size_t id=get_global_id(0); + c[id]=(a[id]+b[id])/3; +} diff --git a/tests/cl/program/execute/code-in-else.cl b/tests/cl/program/execute/code-in-else.cl new file mode 100644 index 0000000..1b57f91 --- /dev/null +++ b/tests/cl/program/execute/code-in-else.cl @@ -0,0 +1,21 @@ +/*! +[config] +name: code in else block +kernel_name: test4 +clc_version_min: 10 + +dimensions: 1 +global_size: 8 0 0 + +[test] +arg_in: 0 buffer int[8] 1 2 3 4 5 6 7 8 +arg_in: 1 buffer int[8] 2 4 6 8 10 12 14 16 +arg_out: 2 buffer int[8] 3 6 9 12 15 18 21 24 + +!*/ +__kernel void test4(__global const uint *a, __global const uint *b, __global uint *c){ + size_t id=get_global_id(0); + if(b[id]==0) c[id]=0; + else c[id]=a[id]+b[id]; +} + diff --git a/tests/cl/program/execute/divide-uint.cl b/tests/cl/program/execute/divide-uint.cl new file mode 100644 index 0000000..b6097cc --- /dev/null +++ b/tests/cl/program/execute/divide-uint.cl @@ -0,0 +1,20 @@ +/*! +[config] +name: a div b +kernel_name: test3 +clc_version_min: 10 + +dimensions: 1 +global_size: 8 0 0 + +[test] +arg_in: 0 buffer int[8] 1 2 3 4 5 6 7 8 +arg_in: 1 buffer int[8] 2 4 6 8 10 12 14 16 +arg_out: 2 buffer int[8] 2 2 2 2 2 2 2 2 + +!*/ +__kernel void test3(__global const uint *a, __global const uint *b, __global uint *c){ + size_t id=get_global_id(0); + c[id]=b[id]/a[id]; +} + -- 1.7.11.4