diff options
author | Guo Yejun <yejun.guo@intel.com> | 2016-07-25 07:04:26 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-08-03 18:20:22 +0800 |
commit | c202faf6d2d82d7783c226cdea9732f3a959edc1 (patch) | |
tree | 2864fcb56a1f39ee2830b32c6b0ab85fbd9c626a /utests/compiler_abs_diff.cpp | |
parent | 18f4e973ab92a43e176f9c6c71e437a27b98ef71 (diff) | |
download | beignet-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_diff.cpp')
-rw-r--r-- | utests/compiler_abs_diff.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/utests/compiler_abs_diff.cpp b/utests/compiler_abs_diff.cpp index 15a1f90d..1df7d47d 100644 --- a/utests/compiler_abs_diff.cpp +++ b/utests/compiler_abs_diff.cpp @@ -127,6 +127,18 @@ template <typename T, typename U> static void dump_data (T* x, T* y, U* diff, in } } +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_diff_with_type(void) { const size_t n = 16; @@ -174,7 +186,10 @@ template <typename T, typename U> static void compiler_abs_diff_with_type(void) // dump_data(cpu_x, cpu_y, cpu_diff, n); - OCL_ASSERT(!memcmp(buf_data[2], cpu_diff, sizeof(T) * n)); + U* actual = (U*)buf_data[2]; + U* expected = cpu_diff; + for (size_t i = 0; i < n; ++i) + check_result(&actual[i], &expected[i]); OCL_UNMAP_BUFFER(0); OCL_UNMAP_BUFFER(1); |