From 7f769fb1445af1f1f0dc04817bc93d724366e4d3 Mon Sep 17 00:00:00 2001 From: Homer Hsing Date: Tue, 20 Nov 2012 09:51:03 +0800 Subject: [PATCH] Test case for OpenCL 1.1 supported data types --- kernels/compiler_data_types.cl | 49 ++++++++++++++++++++++++++++++++++++++++++ utests/compiler_data_types.cpp | 9 ++++++++ 2 files changed, 58 insertions(+) create mode 100644 kernels/compiler_data_types.cl create mode 100644 utests/compiler_data_types.cpp diff --git a/kernels/compiler_data_types.cl b/kernels/compiler_data_types.cl new file mode 100644 index 0000000..b23877d --- /dev/null +++ b/kernels/compiler_data_types.cl @@ -0,0 +1,49 @@ +/* OpenCL 1.1 Supported Data Types */ +__kernel void compiler_data_types() +{ + // built-in scalar data types (section 6.1.1) + bool b; + char c; + unsigned char uc; + uchar uc_2; + short s; + unsigned short us; + ushort us_2; + int i; + unsigned int ui; + uint ui_2; + long l; + unsigned long ul; + ulong ul_2; + float f; + half h; + size_t sz; + ptrdiff_t pt; + intptr_t it; + uintptr_t uit; + + // built-in vector data types (section 6.1.2) + // supported values of $n$ are 2, 3, 4, 8, 16 for all vector data types +#define VEC(sz) char##sz c##sz; \ + uchar##sz uc##sz; \ + short##sz s##sz; \ + ushort##sz us##sz;\ + int##sz i##sz; \ + uint##sz ui##sz; \ + long##sz l##sz; \ + ulong##sz ul##sz; \ + float##sz f##sz; +#if 0 + VEC(2); + VEC(3); + VEC(4); + VEC(8); + VEC(16); +#endif + + // Other built-in data types (section 6.1.3) + image2d_t i2dt; + image3d_t i3dt; + sampler_t st; + event_t et; +} diff --git a/utests/compiler_data_types.cpp b/utests/compiler_data_types.cpp new file mode 100644 index 0000000..c686cc7 --- /dev/null +++ b/utests/compiler_data_types.cpp @@ -0,0 +1,9 @@ +#include "utest_helper.hpp" + +void compiler_data_types(void) +{ + OCL_CREATE_KERNEL("compiler_data_types"); +} + +MAKE_UTEST_FROM_FUNCTION(compiler_data_types); + -- 2.7.4