summaryrefslogtreecommitdiff
path: root/utests/compiler_abs.cpp
diff options
context:
space:
mode:
authorGuo Yejun <yejun.guo@intel.com>2016-07-25 07:04:26 +0800
committerYang Rong <rong.r.yang@intel.com>2016-08-03 18:20:22 +0800
commitc202faf6d2d82d7783c226cdea9732f3a959edc1 (patch)
tree2864fcb56a1f39ee2830b32c6b0ab85fbd9c626a /utests/compiler_abs.cpp
parent18f4e973ab92a43e176f9c6c71e437a27b98ef71 (diff)
downloadbeignet-c202faf6d2d82d7783c226cdea9732f3a959edc1.tar.gz
utest: do not check the padding componenet for 3-component vector data types
Per OPenCL 1.2 spec 6.1.5: For 3-component vector data types, the size of the data type is 4 * sizeof(component). The spec does not explicitly say what the padding componenet will be, it should be implementation-dependent, so, do not check the padding componenet in the unit test. Signed-off-by: Guo Yejun <yejun.guo@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/compiler_abs.cpp')
-rw-r--r--utests/compiler_abs.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/utests/compiler_abs.cpp b/utests/compiler_abs.cpp
index 3f477a80..49b381db 100644
--- a/utests/compiler_abs.cpp
+++ b/utests/compiler_abs.cpp
@@ -119,6 +119,18 @@ template <typename T, typename U> static void dump_data (T* src, U* dst, int n)
}
}
+template <typename T>
+static void check_result(T* actual, T* expected)
+{
+ OCL_ASSERT(*actual == *expected);
+}
+
+template <typename T, int N>
+static void check_result(cl_vec<T, N>* actual, cl_vec<T, N>* expected)
+{
+ OCL_ASSERT(!memcmp(actual, expected, sizeof(T)*N));
+}
+
template <typename T, typename U> static void compiler_abs_with_type(void)
{
const size_t n = 16;
@@ -160,7 +172,11 @@ template <typename T, typename U> static void compiler_abs_with_type(void)
// dump_data(cpu_src, cpu_dst, n);
- OCL_ASSERT(!memcmp(buf_data[1], cpu_dst, sizeof(T) * n));
+ U* actual = (U*)buf_data[1];
+ U* expected = cpu_dst;
+ for (size_t i = 0; i < n; ++i)
+ check_result(&actual[i], &expected[i]);
+
OCL_UNMAP_BUFFER(1);
OCL_UNMAP_BUFFER(0);
}