Fix several warnings (#6242)
authorVladimir Plazun/AI Tools Lab /SRR/Engineer/삼성전자 <v.plazun@samsung.com>
Thu, 8 Aug 2019 03:42:02 +0000 (06:42 +0300)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 8 Aug 2019 03:42:02 +0000 (12:42 +0900)
* Fix several warnings

Make class/struct definitions consistent( forward declararation with different type from definition )
Remove pessimising moves of temporary objects
Change `info` symbol in library_info.cc into non-static

Signed-off-by: Vladimir Plazun <v.plazun@samsung.com>
runtimes/neurun/core/include/backend/Backend.h
runtimes/neurun/core/src/compiler/ExecutorFactory.cc
runtimes/neurun/core/src/exec/Execution.cc
runtimes/neurun/core/src/library_info.cc

index ba7eb3e..4b0ee08 100644 (file)
@@ -33,8 +33,9 @@ class IKernelGenerator;
 class IShapeFixer;
 struct ITensorBuilder;
 
-struct BackendContext
+class BackendContext
 {
+public:
   const Backend *backend;
   std::shared_ptr<ITensorBuilder> tensor_builder;
   std::shared_ptr<IConstantInitializer> constant_initializer;
@@ -42,8 +43,9 @@ struct BackendContext
   std::shared_ptr<IShapeFixer> shape_fixer;
 };
 
-struct Backend
+class Backend
 {
+public:
   virtual ~Backend() = default;
   virtual std::shared_ptr<neurun::backend::IConfig> config() const = 0;
   virtual std::unique_ptr<BackendContext> newContext(const model::Operands &operands) const = 0;
index 597aea9..33e1680 100644 (file)
@@ -164,7 +164,7 @@ exec::IExecutor *ExecutorFactory::createLinearExecutor(graph::Graph &graph)
   auto mem_mgrs = nnfw::cpp14::make_unique<backend::MemoryManagerSet>();
   for (auto &tensor_builder : tensor_builders)
   {
-    mem_mgrs->insert(std::move(tensor_builder->releaseMemoryManager()));
+    mem_mgrs->insert(tensor_builder->releaseMemoryManager());
   }
 
   auto plan = std::make_shared<Plan>(function_sequence);
@@ -297,20 +297,20 @@ exec::IExecutor *ExecutorFactory::createDataflowExecutor(graph::Graph &graph, bo
   auto mem_mgrs = nnfw::cpp14::make_unique<backend::MemoryManagerSet>();
   for (auto &tensor_builder : tensor_builders)
   {
-    mem_mgrs->insert(std::move(tensor_builder->releaseMemoryManager()));
+    mem_mgrs->insert(tensor_builder->releaseMemoryManager());
   }
 
   if (parallel)
   {
     return new exec::ParallelExecutor{
-        graph.shareModel(),  std::move(graph.releaseSubgraphs()),
+        graph.shareModel(),  graph.releaseSubgraphs(),
         operand_context,     std::move(lower_info),
         std::move(mem_mgrs), std::move(execution_builder->releaseCodeMap())};
   }
   else
   {
     auto exec = new exec::DataflowExecutor{
-        graph.shareModel(),  std::move(graph.releaseSubgraphs()),
+        graph.shareModel(),  graph.releaseSubgraphs(),
         operand_context,     std::move(lower_info),
         std::move(mem_mgrs), std::move(execution_builder->releaseCodeMap())};
     if (util::getConfigBool(util::config::PROFILING_MODE))
index 1f025d4..26835ef 100644 (file)
@@ -39,8 +39,7 @@ void Execution::setInput(const model::IOIndex &index, const void *buffer, size_t
     throw std::runtime_error{"Too small length"};
   }
 
-  _io_desc.inputs.at(index.value()) =
-      std::move(nnfw::cpp14::make_unique<InputDesc>(info, buffer, length));
+  _io_desc.inputs.at(index.value()) = nnfw::cpp14::make_unique<InputDesc>(info, buffer, length);
 }
 
 void Execution::setInput(const model::IOIndex &index, const model::TypeInfo &type,
@@ -53,8 +52,7 @@ void Execution::setInput(const model::IOIndex &index, const model::TypeInfo &typ
     throw std::runtime_error{"Too small length"};
   }
 
-  _io_desc.inputs.at(index.value()) =
-      std::move(nnfw::cpp14::make_unique<InputDesc>(info, buffer, length));
+  _io_desc.inputs.at(index.value()) = nnfw::cpp14::make_unique<InputDesc>(info, buffer, length);
 }
 
 void Execution::setOutput(const model::IOIndex &index, void *buffer, size_t length)
@@ -67,8 +65,7 @@ void Execution::setOutput(const model::IOIndex &index, void *buffer, size_t leng
     throw std::runtime_error{"Too small length"};
   }
 
-  _io_desc.outputs.at(index.value()) =
-      std::move(nnfw::cpp14::make_unique<OutputDesc>(info, buffer, length));
+  _io_desc.outputs.at(index.value()) = nnfw::cpp14::make_unique<OutputDesc>(info, buffer, length);
 }
 
 void Execution::setOutput(const model::IOIndex &index, const model::TypeInfo &type,
@@ -81,8 +78,7 @@ void Execution::setOutput(const model::IOIndex &index, const model::TypeInfo &ty
     throw std::runtime_error{"Too small length"};
   }
 
-  _io_desc.outputs.at(index.value()) =
-      std::move(nnfw::cpp14::make_unique<OutputDesc>(info, buffer, length));
+  _io_desc.outputs.at(index.value()) = nnfw::cpp14::make_unique<OutputDesc>(info, buffer, length);
 }
 
 void Execution::execute()
index 4adf704..601d091 100644 (file)
@@ -14,4 +14,4 @@
  * limitations under the License.
  */
 
-volatile static const char info[] = "library information : runtime=neurun";
+volatile const char info[] = "library information : runtime=neurun";