[Beignet] [PATCH] refine utest of cl_mem_use_host_ptr

Guo Yejun yejun.guo at intel.com
Thu Nov 27 18:23:29 PST 2014


>From application perspective, userptr is transparent. App does not
need to know if userptr is enabled or not, just invokes standard
OpenCL APIs.

Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
 utests/CMakeLists.txt                  | 5 -----
 utests/runtime_use_host_ptr_buffer.cpp | 8 +-------
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 4ad80f0..69a93aa 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -223,11 +223,6 @@ else(GEN_PCI_ID)
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../backend/src/gbe_bin_generater ${kernel_bin}.cl)
 endif(GEN_PCI_ID)
 
-if (DRM_INTEL_USERPTR)
-  SET(CMAKE_CXX_FLAGS "-DHAS_USERPTR ${CMAKE_CXX_FLAGS}")
-  SET(CMAKE_C_FLAGS "-DHAS_USERPTR ${CMAKE_C_FLAGS}")
-endif (DRM_INTEL_USERPTR)
-
 ADD_CUSTOM_TARGET(kernel_bin.bin
     DEPENDS ${kernel_bin}.bin)
 
diff --git a/utests/runtime_use_host_ptr_buffer.cpp b/utests/runtime_use_host_ptr_buffer.cpp
index 4603f90..79273c3 100644
--- a/utests/runtime_use_host_ptr_buffer.cpp
+++ b/utests/runtime_use_host_ptr_buffer.cpp
@@ -20,17 +20,11 @@ static void runtime_use_host_ptr_buffer(void)
   OCL_NDRANGE(1);
 
   // Check result
-
-#ifdef HAS_USERPTR
-  OCL_FINISH();
-#else
   void* mapptr = (int*)clEnqueueMapBuffer(queue, buf[0], CL_TRUE, CL_MAP_READ, 0, n*sizeof(uint32_t), 0, NULL, NULL, NULL);
   OCL_ASSERT(mapptr == buf_data[0]);
-  clEnqueueUnmapMemObject(queue, buf[0], mapptr, 0, NULL, NULL);
-#endif
-
   for (uint32_t i = 0; i < n; ++i)
     OCL_ASSERT(((uint32_t*)buf_data[0])[i] == i / 2);
+  clEnqueueUnmapMemObject(queue, buf[0], mapptr, 0, NULL, NULL);
 
   free(buf_data[0]);
   buf_data[0] = NULL;
-- 
1.9.1



More information about the Beignet mailing list