From: 박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 Date: Mon, 9 Apr 2018 06:49:16 +0000 (+0900) Subject: Introduce nnfw kernel Initialize (#502) X-Git-Tag: 0.1~386 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65f00c41bbe02b03810a8f51b9b461894e02a112;p=platform%2Fcore%2Fml%2Fnnfw.git Introduce nnfw kernel Initialize (#502) This will introduce initialize function for nnfw acl kernels Signed-off-by: SaeHie Park --- diff --git a/include/kernel/acl/nnfw_kernel_acl.h b/include/kernel/acl/nnfw_kernel_acl.h new file mode 100644 index 0000000..c7a062c --- /dev/null +++ b/include/kernel/acl/nnfw_kernel_acl.h @@ -0,0 +1,14 @@ +#ifndef __NNFW_KERNEL_ACL_H__ +#define __NNFW_KERNEL_ACL_H__ + +namespace nnfw { +namespace kernel { +namespace acl { + +void Initialize(void); + +} // namespace acl +} // namespace kernel +} // namespace nnfw + +#endif // __NNFW_KERNEL_ACL_H__ diff --git a/src/kernel/acl/CMakeLists.txt b/src/kernel/acl/CMakeLists.txt index 6263b82..74a93f2 100644 --- a/src/kernel/acl/CMakeLists.txt +++ b/src/kernel/acl/CMakeLists.txt @@ -28,7 +28,8 @@ set(GTEST_LIBS libgtest.a libgtest_main.a pthread) link_directories(${CMAKE_INSTALL_PREFIX}/lib) # kernel library -set(KERNELACL_SRCS "src/Conv2D_acl.cpp" +set(KERNELACL_SRCS "src/Init_acl.cpp" + "src/Conv2D_acl.cpp" ) add_library(${LIB_KERNELACL} SHARED ${KERNELACL_SRCS}) diff --git a/src/kernel/acl/src/Conv2D_acl.test.cpp b/src/kernel/acl/src/Conv2D_acl.test.cpp index 2dd1d1d..19589b7 100644 --- a/src/kernel/acl/src/Conv2D_acl.test.cpp +++ b/src/kernel/acl/src/Conv2D_acl.test.cpp @@ -1,5 +1,6 @@ #include "gtest/gtest.h" #include "OperationsUtils.h" +#include namespace nnfw { namespace kernel { @@ -29,6 +30,8 @@ using namespace nnfw::kernel::acl; TEST(KernelACL_TC, convFloat32_test) { + nnfw::kernel::acl::Initialize(); + float inputData[9]; const android::nn::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 }; float filterData[9]; diff --git a/src/kernel/acl/src/Init_acl.cpp b/src/kernel/acl/src/Init_acl.cpp new file mode 100644 index 0000000..05317fb --- /dev/null +++ b/src/kernel/acl/src/Init_acl.cpp @@ -0,0 +1,16 @@ +#include +#include + +namespace nnfw { +namespace kernel { +namespace acl { + +// This will do one time initialization but can be called multiple times +void Initialize(void) +{ + arm_compute::CLScheduler::get().default_init(); +} + +} // namespace acl +} // namespace kernel +} // namespace nnfw