From: 이한종/동작제어Lab(SR)/Engineer/삼성전자 Date: Fri, 27 Jul 2018 04:27:55 +0000 (+0900) Subject: [neurun] Build acl_cl kernel as a separate lib (#2095) X-Git-Tag: 0.2~383 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cefd29822d917f544c95c884f6fd890a0dc6932c;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Build acl_cl kernel as a separate lib (#2095) Build acl_cl kernel as a separate static lib `libkernel_acl_cl.a`. Likewise #2084 for cpu kernel. Signed-off-by: Hanjoung Lee --- diff --git a/runtimes/neurun/CMakeLists.txt b/runtimes/neurun/CMakeLists.txt index e253fb3..c494c17 100644 --- a/runtimes/neurun/CMakeLists.txt +++ b/runtimes/neurun/CMakeLists.txt @@ -4,6 +4,7 @@ set(NEURUN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) # Build kernels set(LIB_NEURUN_KERNEL_CPU neurun_kernel_cpu) +set(LIB_NEURUN_KERNEL_ACL_CL neurun_kernel_acl_cl) add_subdirectory(src/kernel) # Build backends @@ -13,7 +14,6 @@ add_subdirectory(src/backend) file(GLOB SOURCES "src/*.cc") file(GLOB_RECURSE SOURCES_INTERNAL "src/internal/*.cc") -file(GLOB_RECURSE SOURCES_KERNEL "src/kernel/acl_cl/*.cc") # TODO should be built as a separate lib set(SOURCES ${SOURCES} ${SOURCES_INTERNAL} ${SOURCES_KERNEL}) diff --git a/runtimes/neurun/src/backend/acl_cl/CMakeLists.txt b/runtimes/neurun/src/backend/acl_cl/CMakeLists.txt index c233c0d..4cc5d18 100644 --- a/runtimes/neurun/src/backend/acl_cl/CMakeLists.txt +++ b/runtimes/neurun/src/backend/acl_cl/CMakeLists.txt @@ -8,6 +8,7 @@ target_include_directories(${LIB_NEURUN_BACKEND_ACL_CL} PUBLIC ${CMAKE_SOURCE_DI target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} arm_compute) target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} nnfw_support_nnapi) +target_link_libraries(${LIB_NEURUN_BACKEND_ACL_CL} ${LIB_NEURUN_KERNEL_ACL_CL}) set_target_properties(${LIB_NEURUN_BACKEND_ACL_CL} PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(${LIB_NEURUN_BACKEND_ACL_CL} PROPERTIES OUTPUT_NAME backend_acl_cl) diff --git a/runtimes/neurun/src/kernel/CMakeLists.txt b/runtimes/neurun/src/kernel/CMakeLists.txt index 641d1f2..3ae2476 100644 --- a/runtimes/neurun/src/kernel/CMakeLists.txt +++ b/runtimes/neurun/src/kernel/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(cpufallback) +add_subdirectory(acl_cl) diff --git a/runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt b/runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt new file mode 100644 index 0000000..857fe6f --- /dev/null +++ b/runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt @@ -0,0 +1,15 @@ +file(GLOB SOURCES "*.cc") + +add_library(${LIB_NEURUN_KERNEL_ACL_CL} STATIC ${SOURCES}) + +target_include_directories(${LIB_NEURUN_KERNEL_ACL_CL} PUBLIC ${NNFW_INCLUDE_DIR}) +target_include_directories(${LIB_NEURUN_KERNEL_ACL_CL} PUBLIC ${NEURUN_INCLUDE_DIR}) +target_include_directories(${LIB_NEURUN_KERNEL_ACL_CL} PUBLIC ${CMAKE_SOURCE_DIR}/externals/tensorflow) # TODO We should not need this + +target_link_libraries(${LIB_NEURUN_KERNEL_ACL_CL} arm_compute) +target_link_libraries(${LIB_NEURUN_KERNEL_ACL_CL} tensorflow-lite) # TODO We should not need this +target_link_libraries(${LIB_NEURUN_KERNEL_ACL_CL} ${LIB_NEURUN_KERNEL_CPU}) # TODO We should not need this + +set_target_properties(${LIB_NEURUN_KERNEL_ACL_CL} PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_target_properties(${LIB_NEURUN_KERNEL_ACL_CL} PROPERTIES OUTPUT_NAME kernel_acl_cl) +install(TARGETS ${LIB_NEURUN_KERNEL_ACL_CL} DESTINATION lib/neurun) diff --git a/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h b/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h index 4182faa..bf12f46 100644 --- a/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h +++ b/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h @@ -23,6 +23,9 @@ #include #include "internal/Model.h" + +// TODO Remove this unnecessary dependency. This is only for OperandType. +// If we remove this, we can also remove cpu kernel library dependency #include "kernel/cpufallback/OperationUtils.h" using namespace internal::kernel::cpu;