From c4d1f4029965af26e7f1a0d3d22df1a8ecd4dd2e Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Tue, 6 Aug 2013 12:01:46 +0800 Subject: 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 Reviewed-by: "Xing, Homer" --- utests/compiler_vector_load_store.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'utests/compiler_vector_load_store.cpp') 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 template 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) -- cgit v1.2.1