[Beignet] [Patch v2 2/4] CL: prepare to support ICD if the system has ocl-icd..
Igor Gnatenko
i.gnatenko.brain at gmail.com
Mon Jan 13 22:58:09 PST 2014
On Tue, 2014-01-14 at 09:45 +0800, Zhigang Gong wrote:
> v2:
> Only install the intel-beignet.icd if the system has ocl-icd
> support.
>
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain at gmail.com>
> ---
> CMake/FindGBE.cmake | 37 -------------------------------------
> CMakeLists.txt | 15 ++++++---------
> backend/src/CMakeLists.txt | 15 +++++++--------
> backend/src/ocl_stdlib.tmpl.h | 2 +-
> intel-beignet.icd.in | 1 +
> src/CMakeLists.txt | 2 +-
> 6 files changed, 16 insertions(+), 56 deletions(-)
> delete mode 100644 CMake/FindGBE.cmake
> create mode 100644 intel-beignet.icd.in
>
> diff --git a/CMake/FindGBE.cmake b/CMake/FindGBE.cmake
> deleted file mode 100644
> index db938c7..0000000
> --- a/CMake/FindGBE.cmake
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -#
> -# Try to find X library and include path.
> -# Once done this will define
> -#
> -# GBE_FOUND
> -# GBE_INCLUDE_PATH
> -# GBE_LIBRARY
> -#
> -
> -FIND_PATH(GBE_INCLUDE_PATH gen/program.h
> - ~/include/
> - /usr/include/
> - /usr/local/include/
> - /sw/include/
> - /opt/local/include/
> - DOC "The directory where gen/program.h resides")
> -FIND_LIBRARY(GBE_LIBRARY
> - NAMES GBE gbe
> - PATHS
> - ~/lib/
> - /usr/lib64
> - /usr/lib
> - /usr/local/lib64
> - /usr/local/lib
> - /sw/lib
> - /opt/local/lib
> - DOC "The GBE library")
> -
> -IF(GBE_INCLUDE_PATH)
> - INCLUDE_DIRECTORIES(${GBE_INCLUDE_PATH})
> - SET(GBE_FOUND 1 CACHE STRING "Set to 1 if GBE is found, 0 otherwise")
> -ELSE(GBE_INCLUDE_PATH)
> - SET(GBE_FOUND 0 CACHE STRING "Set to 1 if GBE is found, 0 otherwise")
> -ENDIF(GBE_INCLUDE_PATH)
> -
> -MARK_AS_ADVANCED(GBE_FOUND)
> -
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index b44e7a6..c2dac5e 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -18,6 +18,7 @@ configure_file (
> "src/OCLConfig.h"
> )
>
> +
> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
>
> SET(CMAKE_VERBOSE_MAKEFILE "false")
> @@ -111,14 +112,6 @@ ELSE(XFIXES_FOUND)
> MESSAGE(STATUS "Looking for Xfixes - not found")
> ENDIF(XFIXES_FOUND)
>
> -# Gen-backend (compiler)
> -Find_Package(GBE)
> -IF(GBE_FOUND)
> - MESSAGE(STATUS "Looking for Gen-Backend - found")
> -ELSE(GBE_FOUND)
> - MESSAGE(STATUS "Looking for Gen-Backend - not found")
> -ENDIF(GBE_FOUND)
> -
> Find_Package(EGL)
> IF(EGL_FOUND)
> MESSAGE(STATUS "Looking for EGL - found")
> @@ -135,6 +128,11 @@ ENDIF(MESA_SOURCE_FOUND)
> Find_Package(OCLIcd)
> IF(OCLIcd_FOUND)
> MESSAGE(STATUS "Looking for OCL ICD header file - found")
> + configure_file (
> + "intel-beignet.icd.in"
> + "intel-beignet.icd"
> + )
> + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/intel-beignet.icd DESTINATION /etc/OpenCL/vendors)
> ELSE(OCLIcd_FOUND)
> MESSAGE(STATUS "Looking for OCL ICD header file - not found")
> ENDIF(OCLIcd_FOUND)
> @@ -145,4 +143,3 @@ ADD_SUBDIRECTORY(include)
> ADD_SUBDIRECTORY(backend)
> ADD_SUBDIRECTORY(src)
> ADD_SUBDIRECTORY(utests)
> -
> diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt
> index fa69321..b93133f 100644
> --- a/backend/src/CMakeLists.txt
> +++ b/backend/src/CMakeLists.txt
> @@ -76,7 +76,6 @@ macro(ll_add_library ll_lib ll_sources)
> )
> add_custom_target(${ll_lib}
> DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ll_lib})
> - message(${ll_lib}, ${ll_objects})
> endmacro(ll_add_library)
>
> if (GBE_USE_BLOB)
> @@ -162,7 +161,7 @@ endif (GBE_USE_BLOB)
> include_directories (.)
> link_directories (${LLVM_LIBRARY_DIRS})
> include_directories(${LLVM_INCLUDE_DIRS})
> -add_library (gbe SHARED ${GBE_SRC})
> +add_library (gbe STATIC ${GBE_SRC})
>
> # for pre compiled module library.
> set (pcm_lib "beignet.bc")
> @@ -184,13 +183,13 @@ link_directories (${LLVM_LIBRARY_DIR})
> ADD_EXECUTABLE(gbe_bin_generater gbe_bin_generater.cpp)
> TARGET_LINK_LIBRARIES(gbe_bin_generater gbe)
>
> -install (TARGETS gbe LIBRARY DESTINATION lib)
> -install (FILES ${pch_object} DESTINATION lib)
> -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcm_lib} DESTINATION lib)
> -install (FILES backend/program.h DESTINATION include/gen)
> +#install (TARGETS gbe LIBRARY DESTINATION lib)
> +#install (FILES backend/program.h DESTINATION include/gen)
> +install (FILES ${pch_object} DESTINATION lib/beignet)
> +install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcm_lib} DESTINATION lib/beignet)
>
> -set (PCH_OBJECT_DIR "${pch_object};${CMAKE_INSTALL_PREFIX}/lib/ocl_stdlib.h.pch")
> -set (PCM_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/${pcm_lib};${CMAKE_INSTALL_PREFIX}/lib/${pcm_lib}")
> +set (PCH_OBJECT_DIR "${pch_object};${CMAKE_INSTALL_PREFIX}/lib/beignet/ocl_stdlib.h.pch")
> +set (PCM_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/${pcm_lib};${CMAKE_INSTALL_PREFIX}/lib/beignet/${pcm_lib}")
> configure_file (
> "GBEConfig.h.in"
> "GBEConfig.h"
> diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
> index 07a4fd9..9b70514 100755
> --- a/backend/src/ocl_stdlib.tmpl.h
> +++ b/backend/src/ocl_stdlib.tmpl.h
> @@ -1717,7 +1717,7 @@ INLINE float __gen_ocl_asin_util(float x) {
> float w = p / q;
> return x + x*w;
> }
> -float __gen_ocl_scalbnf (float x, int n){
> +INLINE float __gen_ocl_scalbnf (float x, int n){
> float two25 = 3.355443200e+07, /* 0x4c000000 */
> twom25 = 2.9802322388e-08, /* 0x33000000 */
> huge = 1.0e+30,
> diff --git a/intel-beignet.icd.in b/intel-beignet.icd.in
> new file mode 100644
> index 0000000..caf3b42
> --- /dev/null
> +++ b/intel-beignet.icd.in
> @@ -0,0 +1 @@
> + at CMAKE_INSTALL_PREFIX@/lib/beignet/libcl.so
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index b997f94..cf53a69 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -79,4 +79,4 @@ target_link_libraries(
> ${DRM_LIBRARY}
> ${OPENGL_LIBRARIES}
> ${OPTIONAL_EGL_LIBRARY})
> -install (TARGETS cl LIBRARY DESTINATION lib)
> +install (TARGETS cl LIBRARY DESTINATION lib/beignet)
--
-Igor Gnatenko
More information about the Beignet
mailing list