From cefd29822d917f544c95c884f6fd890a0dc6932c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Fri, 27 Jul 2018 13:27:55 +0900 Subject: [PATCH] [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 --- runtimes/neurun/CMakeLists.txt | 2 +- runtimes/neurun/src/backend/acl_cl/CMakeLists.txt | 1 + runtimes/neurun/src/kernel/CMakeLists.txt | 1 + runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt | 15 +++++++++++++++ runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt 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; -- 2.7.4