summaryrefslogtreecommitdiff
path: root/utests/compiler_vector_load_store.cpp
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@gmail.com>2013-08-06 12:01:46 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-08-07 21:51:17 +0800
commitc4d1f4029965af26e7f1a0d3d22df1a8ecd4dd2e (patch)
treecda7cf7bf7bd3b896db64ef0ce9e1e52a7039db3 /utests/compiler_vector_load_store.cpp
parent6b602cce53a1795fe1d03edce23cd982c8fb23ae (diff)
downloadbeignet-c4d1f4029965af26e7f1a0d3d22df1a8ecd4dd2e.tar.gz
GBE: enable double vector load/store support.
We have some accurate problem for double calculation on GPU side. I have to change the test case for double type to add a tolerate error when check the double data result. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: "Xing, Homer" <homer.xing@intel.com>
Diffstat (limited to 'utests/compiler_vector_load_store.cpp')
-rw-r--r--utests/compiler_vector_load_store.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/utests/compiler_vector_load_store.cpp b/utests/compiler_vector_load_store.cpp
index 79f284f8..7deb7cbe 100644
--- a/utests/compiler_vector_load_store.cpp
+++ b/utests/compiler_vector_load_store.cpp
@@ -1,4 +1,5 @@
#include "utest_helper.hpp"
+#include <string.h>
template<typename T>
static void compiler_vector_load_store(int elemNum, const char *kernelName)
{
@@ -9,8 +10,8 @@ static void compiler_vector_load_store(int elemNum, const char *kernelName)
buf_data[0] = (T*) malloc(sizeof(T) * n);
for (uint32_t i = 0; i < n; ++i)
((T*)buf_data[0])[i] = i;
- OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(float), buf_data[0]);
- OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(float), NULL);
+ OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(T), buf_data[0]);
+ OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(T), NULL);
free(buf_data[0]);
buf_data[0] = NULL;
@@ -27,7 +28,10 @@ static void compiler_vector_load_store(int elemNum, const char *kernelName)
for (uint32_t i = 0; i < n; ++i)
{
int shift = ((i % elemNum) + 1);
- OCL_ASSERT(((T*)buf_data[1])[i] == (T)(((T*)buf_data[0])[i] + shift));
+ if (strstr(kernelName, "double") == NULL)
+ OCL_ASSERT(((T*)buf_data[1])[i] == (T)(((T*)buf_data[0])[i] + shift));
+ else
+ OCL_ASSERT((((T*)buf_data[1])[i] - ((T)((T*)buf_data[0])[i] + shift)) < 1e-5);
}
OCL_UNMAP_BUFFER(0);
OCL_UNMAP_BUFFER(1);
@@ -54,6 +58,6 @@ test_all_vector(uint16_t, ushort)
test_all_vector(int32_t, int)
test_all_vector(uint32_t, uint)
test_all_vector(float, float)
-//test_all_vector(double, double)
+test_all_vector(double, double)
//test_all_vector(int64_t, long)
//test_all_vector(uint64_t, ulong)