[neurun] Rename compiler::Element (#6430)
author이한종/On-Device Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Fri, 9 Aug 2019 05:04:57 +0000 (14:04 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 9 Aug 2019 05:04:57 +0000 (14:04 +0900)
Move `compiler::Element` to `compiler::Linear::Element`. This removes
`Element.h` and make it to be an inner class of `Linear`.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/core/src/compiler/Element.h [deleted file]
runtimes/neurun/core/src/compiler/ExecutorFactory.cc
runtimes/neurun/core/src/compiler/Linear.cc
runtimes/neurun/core/src/compiler/Linear.h
runtimes/neurun/core/src/exec/LinearExecutor.h

diff --git a/runtimes/neurun/core/src/compiler/Element.h b/runtimes/neurun/core/src/compiler/Element.h
deleted file mode 100644 (file)
index 098c0f8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __NEURUN_COMPILER_ELEMENT_H__
-#define __NEURUN_COMPILER_ELEMENT_H__
-
-#include "model/Subgraph.h"
-#include "graph/LowerInfoMap.h"
-
-// TODO Put this in class Linear (as an inner class)
-namespace neurun
-{
-namespace compiler
-{
-
-struct Element
-{
-  const model::Subgraph *subgraph;
-  const graph::operation::LowerInfo *lower_info;
-
-  Element(const model::Subgraph *subgraph, const graph::operation::LowerInfo *lower_info)
-      : subgraph{subgraph}, lower_info{lower_info}
-  {
-    // DO NOTHING
-  }
-};
-
-} // namespace compiler
-} // namespace neurun
-
-#endif // __NEURUN_COMPILER_ELEMENT_H__
index 728c80f..e34a03d 100644 (file)
@@ -96,7 +96,7 @@ exec::IExecutor *ExecutorFactory::createLinearExecutor(graph::Graph &graph)
    ***********************/
 
   // Fix shapes
-  linear->iterate([&](const compiler::Element &element) {
+  linear->iterate([&](const compiler::Linear::Element &element) {
     auto backend = element.lower_info->backend();
     auto shape_fixer = linear->getBackendContext(backend)->shape_fixer;
     shape_fixer->fix(*element.subgraph);
@@ -140,7 +140,7 @@ exec::IExecutor *ExecutorFactory::createLinearExecutor(graph::Graph &graph)
   auto execution_builder = nnfw::cpp14::make_unique<ExecutionBuilder>(*function_sequence);
 
   // Generate kernels
-  linear->iterate([&](const compiler::Element &element) {
+  linear->iterate([&](const compiler::Linear::Element &element) {
     auto backend = element.lower_info->backend();
     auto kernel_gen = linear->getBackendContext(backend)->kernel_gen;
     kernel_gen->generate(*element.subgraph, execution_builder.get());
index a4fca3d..83efb96 100644 (file)
@@ -322,7 +322,7 @@ void Linear::iterate(const std::function<void(const Element &element)> &fn) cons
 
 void Linear::generateConstantInitializers(void) const
 {
-  iterate([&](const compiler::Element &element) {
+  iterate([&](const compiler::Linear::Element &element) {
     auto backend = element.lower_info->backend();
 
     auto constant_initializer = _backend_resolver->getBackendContext(backend)->constant_initializer;
index 28869db..5f87aae 100644 (file)
@@ -20,7 +20,6 @@
 #include <vector>
 #include <memory>
 
-#include "Element.h"
 #include "model/Model.h"
 #include "model/Subgraphs.h"
 #include "backend/ITensorBuilder.h"
@@ -46,6 +45,19 @@ namespace compiler
 class Linear
 {
 public:
+  struct Element
+  {
+    const model::Subgraph *subgraph;
+    const graph::operation::LowerInfo *lower_info;
+
+    Element(const model::Subgraph *subgraph, const graph::operation::LowerInfo *lower_info)
+        : subgraph{subgraph}, lower_info{lower_info}
+    {
+      // DO NOTHING
+    }
+  };
+
+public:
   Linear(const std::shared_ptr<const model::Model> &model,
          std::unique_ptr<model::Subgraphs> subgraphs,
          std::unique_ptr<graph::LowerInfoMap> lower_info_map,
index 9be1f12..42cbad4 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "ExecutorBase.h"
 #include "compiler/Plan.h"
-#include "compiler/Element.h"
+#include "compiler/Linear.h"
 
 namespace neurun
 {
@@ -47,7 +47,7 @@ public:
                  const std::shared_ptr<compiler::OperandContext> &operand_context,
                  std::unique_ptr<graph::LowerInfoMap> lower_info,
                  std::unique_ptr<backend::MemoryManagerSet> mem_mgrs,
-                 std::unique_ptr<std::vector<compiler::Element>> elements,
+                 std::unique_ptr<std::vector<compiler::Linear::Element>> elements,
                  const std::shared_ptr<const neurun::compiler::Plan> &plan)
       : ExecutorBase{model, std::move(subgraphs), operand_context, std::move(lower_info),
                      std::move(mem_mgrs)},
@@ -60,7 +60,7 @@ public:
 
 private:
   std::shared_ptr<const compiler::Plan> _plan;
-  std::unique_ptr<std::vector<compiler::Element>> _elements;
+  std::unique_ptr<std::vector<compiler::Linear::Element>> _elements;
 };
 
 } // namespace exec