summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
author서상민/동작제어Lab(SR)/Senior Engineer/삼성전자 <sangmin7.seo@samsung.com>2018-05-11 14:29:07 +0900
committerGitHub Enterprise <noreply-CODE@samsung.com>2018-05-11 14:29:07 +0900
commit8476d3699372d6b9b6a2cb283dffde1418eca194 (patch)
treec2db3429c9e4ce2b5179297f3b10ca9934c641c6 /contrib
parentbcd1a5196c8124f518fbd89ba9cfa9a75112bf54 (diff)
downloadnnfw-8476d3699372d6b9b6a2cb283dffde1418eca194.tar.gz
nnfw-8476d3699372d6b9b6a2cb283dffde1418eca194.tar.bz2
nnfw-8476d3699372d6b9b6a2cb283dffde1418eca194.zip
Use NeuralNetworks.h instead of nnapi.h (#1176)
For issue #980 This patch replaces use of nnapi.h with NeuralNetworks.h. Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/bindacl/CMakeLists.txt6
-rw-r--r--contrib/bindacl/src/nnapi_acl.cc44
-rw-r--r--contrib/convacl/CMakeLists.txt6
-rw-r--r--contrib/convacl/src/nnapi_acl_conv.cc44
-rw-r--r--contrib/kerneltesting/CMakeLists.txt4
5 files changed, 42 insertions, 62 deletions
diff --git a/contrib/bindacl/CMakeLists.txt b/contrib/bindacl/CMakeLists.txt
index 9e56db02a..200cc176a 100644
--- a/contrib/bindacl/CMakeLists.txt
+++ b/contrib/bindacl/CMakeLists.txt
@@ -1,13 +1,9 @@
file(GLOB_RECURSE NNAPI_BINDACL_SRCS "src/*.cc")
-# TODO: fix nnapi.h location
-set(NNAPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/nnapi_bindings/include)
-
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
add_library(exp_bindacl SHARED ${NNAPI_BINDACL_SRCS})
-target_include_directories(exp_bindacl PUBLIC ${NNAPI_INCLUDE_DIR}
- ${NNFW_INCLUDE_DIR}
+target_include_directories(exp_bindacl PUBLIC ${NNFW_INCLUDE_DIR}
${NNFW_ACL_INCLUDES})
target_link_libraries(exp_bindacl nnfw_util ${NNFW_ACL_LIBS})
diff --git a/contrib/bindacl/src/nnapi_acl.cc b/contrib/bindacl/src/nnapi_acl.cc
index bc2ffe90c..7997960cb 100644
--- a/contrib/bindacl/src/nnapi_acl.cc
+++ b/contrib/bindacl/src/nnapi_acl.cc
@@ -38,7 +38,7 @@
* SOFTWARE.
*/
-#include <nnapi.h>
+#include <NeuralNetworks.h>
#include <stdexcept>
#include <iostream>
#include <string>
@@ -59,15 +59,14 @@ struct ANeuralNetworksEvent
{
};
-ResultCode ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event)
+int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksEvent_free(ANeuralNetworksEvent* event)
+void ANeuralNetworksEvent_free(ANeuralNetworksEvent* event)
{
delete event;
- return ANEURALNETWORKS_NO_ERROR;
}
//
@@ -79,16 +78,15 @@ struct ANeuralNetworksMemory
// 2nd approach - Store metadata only, and defer data loading as much as possible
};
-ResultCode ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset, ANeuralNetworksMemory** memory)
+int ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset, ANeuralNetworksMemory** memory)
{
*memory = new ANeuralNetworksMemory;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory)
+void ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory)
{
delete memory;
- return ANEURALNETWORKS_NO_ERROR;
}
//
@@ -106,45 +104,44 @@ struct ANeuralNetworksModel
}
};
-ResultCode ANeuralNetworksModel_create(ANeuralNetworksModel** model)
+int ANeuralNetworksModel_create(ANeuralNetworksModel** model)
{
*model = new ANeuralNetworksModel;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_free(ANeuralNetworksModel* model)
+void ANeuralNetworksModel_free(ANeuralNetworksModel* model)
{
delete model;
- return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_addOperand(ANeuralNetworksModel* model, const ANeuralNetworksOperandType *type)
+int ANeuralNetworksModel_addOperand(ANeuralNetworksModel* model, const ANeuralNetworksOperandType *type)
{
model->numOperands += 1;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel* model, int32_t index, const void* buffer, size_t length)
+int ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel* model, int32_t index, const void* buffer, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel* model, int32_t index, const ANeuralNetworksMemory* memory, size_t offset, size_t length)
+int ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel* model, int32_t index, const ANeuralNetworksMemory* memory, size_t offset, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_addOperation(ANeuralNetworksModel* model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
+int ANeuralNetworksModel_addOperation(ANeuralNetworksModel* model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
+int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_finish(ANeuralNetworksModel* model)
+int ANeuralNetworksModel_finish(ANeuralNetworksModel* model)
{
return ANEURALNETWORKS_NO_ERROR;
}
@@ -157,13 +154,13 @@ struct ANeuralNetworksCompilation
// ANeuralNetworksCompilation should hold a compiled IR
};
-ResultCode ANeuralNetworksCompilation_create(ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation)
+int ANeuralNetworksCompilation_create(ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation)
{
*compilation = new ANeuralNetworksCompilation;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation)
+int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation)
{
return ANEURALNETWORKS_NO_ERROR;
}
@@ -208,7 +205,7 @@ bool DummyOutputAccessor::access_tensor(arm_compute::ITensor&)
return false;
}
-ResultCode ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilation, ANeuralNetworksExecution** execution)
+int ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilation, ANeuralNetworksExecution** execution)
{
std::cout << __FUNCTION__ << " +++" << std::endl;
*execution = new ANeuralNetworksExecution;
@@ -238,17 +235,17 @@ ResultCode ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilati
}
// ANeuralNetworksExecution_setInput and ANeuralNetworksExecution_setOutput specify HOST buffer for input/output
-ResultCode ANeuralNetworksExecution_setInput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
+int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
+int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event)
+int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event)
{
std::cout << __FUNCTION__ << " +++" << std::endl;
*event = new ANeuralNetworksEvent;
@@ -262,8 +259,7 @@ ResultCode ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execu
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution)
+void ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution)
{
delete execution;
- return ANEURALNETWORKS_NO_ERROR;
}
diff --git a/contrib/convacl/CMakeLists.txt b/contrib/convacl/CMakeLists.txt
index 51de3f947..ff2920579 100644
--- a/contrib/convacl/CMakeLists.txt
+++ b/contrib/convacl/CMakeLists.txt
@@ -1,13 +1,9 @@
file(GLOB_RECURSE NNAPI_CONVACL_SRCS "src/*.cc")
-# TODO: fix nnapi.h location
-set(NNAPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/nnapi_bindings/include)
-
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
add_library(exp_convacl SHARED ${NNAPI_CONVACL_SRCS})
-target_include_directories(exp_convacl PUBLIC ${NNAPI_INCLUDE_DIR}
- ${NNFW_INCLUDE_DIR}
+target_include_directories(exp_convacl PUBLIC ${NNFW_INCLUDE_DIR}
${NNFW_ACL_INCLUDES})
target_link_libraries(exp_convacl nnfw_util ${NNFW_ACL_LIBS})
diff --git a/contrib/convacl/src/nnapi_acl_conv.cc b/contrib/convacl/src/nnapi_acl_conv.cc
index d47d0418b..38ebb6895 100644
--- a/contrib/convacl/src/nnapi_acl_conv.cc
+++ b/contrib/convacl/src/nnapi_acl_conv.cc
@@ -37,7 +37,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include <nnapi.h>
+#include <NeuralNetworks.h>
#include <stdexcept>
#include <iostream>
#include <string>
@@ -59,15 +59,14 @@ struct ANeuralNetworksEvent
{
};
-ResultCode ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event)
+int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksEvent_free(ANeuralNetworksEvent* event)
+void ANeuralNetworksEvent_free(ANeuralNetworksEvent* event)
{
delete event;
- return ANEURALNETWORKS_NO_ERROR;
}
//
@@ -79,16 +78,15 @@ struct ANeuralNetworksMemory
// 2nd approach - Store metadata only, and defer data loading as much as possible
};
-ResultCode ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset, ANeuralNetworksMemory** memory)
+int ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset, ANeuralNetworksMemory** memory)
{
*memory = new ANeuralNetworksMemory;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory)
+void ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory)
{
delete memory;
- return ANEURALNETWORKS_NO_ERROR;
}
//
@@ -106,45 +104,44 @@ struct ANeuralNetworksModel
}
};
-ResultCode ANeuralNetworksModel_create(ANeuralNetworksModel** model)
+int ANeuralNetworksModel_create(ANeuralNetworksModel** model)
{
*model = new ANeuralNetworksModel;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_free(ANeuralNetworksModel* model)
+void ANeuralNetworksModel_free(ANeuralNetworksModel* model)
{
delete model;
- return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_addOperand(ANeuralNetworksModel* model, const ANeuralNetworksOperandType *type)
+int ANeuralNetworksModel_addOperand(ANeuralNetworksModel* model, const ANeuralNetworksOperandType *type)
{
model->numOperands += 1;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel* model, int32_t index, const void* buffer, size_t length)
+int ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel* model, int32_t index, const void* buffer, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel* model, int32_t index, const ANeuralNetworksMemory* memory, size_t offset, size_t length)
+int ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel* model, int32_t index, const ANeuralNetworksMemory* memory, size_t offset, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_addOperation(ANeuralNetworksModel* model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
+int ANeuralNetworksModel_addOperation(ANeuralNetworksModel* model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
+int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, const uint32_t* outputs)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksModel_finish(ANeuralNetworksModel* model)
+int ANeuralNetworksModel_finish(ANeuralNetworksModel* model)
{
return ANEURALNETWORKS_NO_ERROR;
}
@@ -157,13 +154,13 @@ struct ANeuralNetworksCompilation
// ANeuralNetworksCompilation should hold a compiled IR
};
-ResultCode ANeuralNetworksCompilation_create(ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation)
+int ANeuralNetworksCompilation_create(ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation)
{
*compilation = new ANeuralNetworksCompilation;
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation)
+int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation)
{
return ANEURALNETWORKS_NO_ERROR;
}
@@ -178,7 +175,7 @@ struct ANeuralNetworksExecution
arm_compute::graph::Graph graph;
};
-ResultCode ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilation, ANeuralNetworksExecution** execution)
+int ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilation, ANeuralNetworksExecution** execution)
{
std::cout << __FUNCTION__ << " +++" << std::endl;
*execution = new ANeuralNetworksExecution;
@@ -214,17 +211,17 @@ ResultCode ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilati
}
// ANeuralNetworksExecution_setInput and ANeuralNetworksExecution_setOutput specify HOST buffer for input/output
-ResultCode ANeuralNetworksExecution_setInput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
+int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
+int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, size_t length)
{
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event)
+int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event)
{
std::cout << __FUNCTION__ << " +++" << std::endl;
*event = new ANeuralNetworksEvent;
@@ -238,8 +235,7 @@ ResultCode ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execu
return ANEURALNETWORKS_NO_ERROR;
}
-ResultCode ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution)
+void ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution)
{
delete execution;
- return ANEURALNETWORKS_NO_ERROR;
}
diff --git a/contrib/kerneltesting/CMakeLists.txt b/contrib/kerneltesting/CMakeLists.txt
index 436aa91f5..08ea071d2 100644
--- a/contrib/kerneltesting/CMakeLists.txt
+++ b/contrib/kerneltesting/CMakeLists.txt
@@ -1,11 +1,7 @@
function(add_kerneltesting TESTNAME SRC_FILES)
- # TODO: fix nnapi.h location
- set(NNAPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/nnapi_bindings/include)
-
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
add_executable(${TESTNAME} ${SRC_FILES})
target_include_directories(${TESTNAME} PUBLIC
- ${NNAPI_INCLUDE_DIR}
${NNFW_INCLUDE_DIR}
${NNFW_ACL_INCLUDES})
if (${TARGET_OS} STREQUAL "tizen")