diff options
author | Hyeongseok Oh <hseok82.oh@samsung.com> | 2023-04-12 15:42:02 +0900 |
---|---|---|
committer | Hyeongseok Oh <hseok82.oh@samsung.com> | 2023-04-12 15:42:02 +0900 |
commit | 323663bb115ef625642391a5a8e9b35fee8b2ae3 (patch) | |
tree | 17e2a6b91535e6f53f4cacda5e4db6aa0303dd22 /runtime/onert/frontend/nnapi | |
parent | c690d52bdd137ed6a17353aa7af35e8141ece77b (diff) | |
download | nnfw-323663bb115ef625642391a5a8e9b35fee8b2ae3.tar.gz nnfw-323663bb115ef625642391a5a8e9b35fee8b2ae3.tar.bz2 nnfw-323663bb115ef625642391a5a8e9b35fee8b2ae3.zip |
Imported Upstream version 1.22.0upstream/1.22.0
Diffstat (limited to 'runtime/onert/frontend/nnapi')
6 files changed, 10 insertions, 11 deletions
diff --git a/runtime/onert/frontend/nnapi/CMakeLists.txt b/runtime/onert/frontend/nnapi/CMakeLists.txt index dafd84ccf..b66b32e89 100644 --- a/runtime/onert/frontend/nnapi/CMakeLists.txt +++ b/runtime/onert/frontend/nnapi/CMakeLists.txt @@ -24,4 +24,4 @@ target_link_libraries(test_onert_frontend_nnapi PRIVATE ${LIB_ONERT} dl) target_link_libraries(test_onert_frontend_nnapi PRIVATE gtest) target_link_libraries(test_onert_frontend_nnapi PRIVATE gtest_main) -install(TARGETS test_onert_frontend_nnapi DESTINATION unittest_standalone) +install(TARGETS test_onert_frontend_nnapi DESTINATION unittest) diff --git a/runtime/onert/frontend/nnapi/compilation.cc b/runtime/onert/frontend/nnapi/compilation.cc index 871c040ef..2c56f061a 100644 --- a/runtime/onert/frontend/nnapi/compilation.cc +++ b/runtime/onert/frontend/nnapi/compilation.cc @@ -58,7 +58,7 @@ int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation *compilation) return ANEURALNETWORKS_UNEXPECTED_NULL; } - if (compilation->state() != ::onert::compiler::State::CREATED) + if (compilation->isFinished()) { VERBOSE(NNAPI::Compilation) << "finish: Already finished" << std::endl; return ANEURALNETWORKS_BAD_STATE; @@ -87,7 +87,7 @@ int ANeuralNetworksCompilation_setPreference(ANeuralNetworksCompilation *compila return ANEURALNETWORKS_UNEXPECTED_NULL; } - if (compilation->state() != ::onert::compiler::State::CREATED) + if (compilation->isFinished()) { VERBOSE(NNAPI::Compilation) << "setPreference: Already finished" << std::endl; return ANEURALNETWORKS_BAD_STATE; diff --git a/runtime/onert/frontend/nnapi/execution.cc b/runtime/onert/frontend/nnapi/execution.cc index 19636a84d..4e1a985f3 100644 --- a/runtime/onert/frontend/nnapi/execution.cc +++ b/runtime/onert/frontend/nnapi/execution.cc @@ -37,7 +37,7 @@ int ANeuralNetworksExecution_create(ANeuralNetworksCompilation *compilation, return ANEURALNETWORKS_UNEXPECTED_NULL; } - std::shared_ptr<onert::exec::Executors> executors; + std::shared_ptr<onert::exec::IExecutors> executors; compilation->publish(executors); diff --git a/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.cc b/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.cc index bb247b97f..3b5edc180 100644 --- a/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.cc +++ b/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.cc @@ -26,9 +26,7 @@ ANeuralNetworksCompilation::ANeuralNetworksCompilation(const ANeuralNetworksMode _compiler{std::make_shared<compiler::Compiler>(_model, *_coptions)} { if (model->allowedToFp16()) - { - _compiler->enableToFp16(); - } + _coptions->enableToFp16(); } bool ANeuralNetworksCompilation::finish() noexcept @@ -36,6 +34,7 @@ bool ANeuralNetworksCompilation::finish() noexcept try { _artifact = _compiler->compile(); + _compiler = nullptr; } catch (const std::exception &e) { diff --git a/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.h b/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.h index dff5c6dc6..3898f1d5e 100644 --- a/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.h +++ b/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksCompilation.h @@ -22,7 +22,7 @@ #include "compiler/Compiler.h" #include "ir/Graph.h" #include "ir/Model.h" -#include "exec/Executors.h" +#include "exec/IExecutors.h" #include "util/TracingCtx.h" struct ANeuralNetworksCompilation @@ -32,9 +32,9 @@ public: public: bool finish() noexcept; + bool isFinished() noexcept { return _compiler == nullptr; } - onert::compiler::State state(void) noexcept { return _compiler->state(); } - void publish(std::shared_ptr<onert::exec::Executors> &executors) noexcept + void publish(std::shared_ptr<onert::exec::IExecutors> &executors) noexcept { executors = _artifact ? _artifact->_executors : nullptr; } diff --git a/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksExecution.h b/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksExecution.h index 110c7cd55..6fbc4c2e0 100644 --- a/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksExecution.h +++ b/runtime/onert/frontend/nnapi/wrapper/ANeuralNetworksExecution.h @@ -26,7 +26,7 @@ struct ANeuralNetworksExecution { public: - ANeuralNetworksExecution(const std::shared_ptr<onert::exec::Executors> &executors) + ANeuralNetworksExecution(const std::shared_ptr<onert::exec::IExecutors> &executors) : _execution{std::make_shared<onert::exec::Execution>(executors)} { // DO NOTHING |