[neurun] Build acl_cl kernel as a separate lib (#2095)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Fri, 27 Jul 2018 04:27:55 +0000 (13:27 +0900)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Fri, 27 Jul 2018 04:27:55 +0000 (13:27 +0900)
Build acl_cl kernel as a separate static lib `libkernel_acl_cl.a`.
Likewise #2084 for cpu kernel.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/CMakeLists.txt
runtimes/neurun/src/backend/acl_cl/CMakeLists.txt
runtimes/neurun/src/kernel/CMakeLists.txt
runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt [new file with mode: 0644]
runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h

index e253fb3..c494c17 100644 (file)
@@ -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})
 
index c233c0d..4cc5d18 100644 (file)
@@ -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/acl_cl/CMakeLists.txt b/runtimes/neurun/src/kernel/acl_cl/CMakeLists.txt
new file mode 100644 (file)
index 0000000..857fe6f
--- /dev/null
@@ -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)
index 4182faa..bf12f46 100644 (file)
@@ -23,6 +23,9 @@
 #include <arm_compute/runtime/IFunction.h>
 
 #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;