[Beignet] [PATCH 3/4] only build tests that do not need compiler when standalone compiler is provided

Guo Yejun yejun.guo at intel.com
Thu Jan 8 22:43:37 PST 2015


the built test case is load_program_from_bin_file, it demos how to
generate from source kernel compiler_ceil.cl to binary kernel
compiler_ceil.bin with the standalone compiler for a specific gen
pci id, and also demos how to load and execute the binary kernel
when the compiler is not available in the running system.

btw, please make sure compiler_ceil.bin is really updated if there is
already one there, the safe way is to delete it first.

Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
 CMakeLists.txt        |  4 ++++
 utests/CMakeLists.txt | 27 +++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3daec3..a0b8793 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -215,7 +215,11 @@ ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(backend)
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(utests)
+
+# compile benchmark only if standalone compiler is not provided
+IF (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
 ADD_SUBDIRECTORY(benchmark)
+ENDIF (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
 
 SET(CPACK_PACKAGE_VERSION_MAJOR "${LIBCL_DRIVER_VERSION_MAJOR}")
 SET(CPACK_PACKAGE_VERSION_MINOR "${LIBCL_DRIVER_VERSION_MINOR}")
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 9623dc1..4ef6bc6 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -18,8 +18,18 @@ configure_file (
 
 #XXX only need GL if required
 link_directories (${LLVM_LIBRARY_DIR} ${OPENGL_LIBDIR} ${DRM_LIBDIR})
-set (utests_sources
+
+set (utests_basic_sources
   utest_error.c
+  utest_assert.cpp
+  utest.cpp
+  utest_file_map.cpp
+  utest_helper.cpp)
+
+# the test case with binary kernel
+set (utests_binary_kernel_sources load_program_from_bin_file.cpp)
+
+set (utests_sources
   compiler_basic_arithmetic.cpp
   compiler_displacement_map_element.cpp
   compiler_mandelbrot.cpp
@@ -178,7 +188,6 @@ set (utests_sources
   compiler_simd_all.cpp
   compiler_time_stamp.cpp
   compiler_double_precision.cpp
-  load_program_from_bin_file.cpp
   load_program_from_gen_bin.cpp
   get_arg_info.cpp
   profiling_exec.cpp
@@ -196,11 +205,7 @@ set (utests_sources
   compiler_assignment_operation_in_if.cpp
   vload_bench.cpp
   runtime_use_host_ptr_buffer.cpp
-  runtime_alloc_host_ptr_buffer.cpp
-  utest_assert.cpp
-  utest.cpp
-  utest_file_map.cpp
-  utest_helper.cpp)
+  runtime_alloc_host_ptr_buffer.cpp)
 
 if (LLVM_VERSION_NODOT VERSION_GREATER 34)
   SET(utests_sources
@@ -255,11 +260,17 @@ else()
   SET(UTESTS_REQUIRED_EGL_LIB "")
 endif()
 
+if (USE_STANDALONE_GBE_COMPILER STREQUAL "true")
+  SET(utests_sources ${utests_basic_sources} ${utests_binary_kernel_sources})
+else ()
+  SET(utests_sources ${utests_basic_sources} ${utests_binary_kernel_sources} ${ADDMATHFUNC} ${utests_sources})
+endif ()
+
 if (COMPILER STREQUAL "CLANG")
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-compare")
 endif ()
 
-ADD_LIBRARY(utests SHARED ${ADDMATHFUNC} ${utests_sources})
+ADD_LIBRARY(utests SHARED ${utests_sources})
 
 TARGET_LINK_LIBRARIES(utests cl m ${OPENGL_LIBRARIES} ${UTESTS_REQUIRED_EGL_LIB} ${CMAKE_THREAD_LIBS_INIT} ${UTESTS_REQUIRED_X11_LIB})
 
-- 
1.9.1



More information about the Beignet mailing list