[neurun] Rename operand::Context as OperandContext (#4629)
author이한종/On-Device Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Mon, 11 Mar 2019 07:15:22 +0000 (16:15 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 11 Mar 2019 07:15:22 +0000 (16:15 +0900)
Rename to reduce namespace level. This class was the only class in this
namespace.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/compiler/Compiler.cc
runtimes/neurun/src/compiler/ConstantInitializer.cc
runtimes/neurun/src/compiler/ConstantInitializer.h
runtimes/neurun/src/compiler/OperandContext.cc [moved from runtimes/neurun/src/compiler/operand/Context.cc with 82% similarity]
runtimes/neurun/src/compiler/OperandContext.h [moved from runtimes/neurun/src/compiler/operand/Context.h with 89% similarity]
runtimes/neurun/src/compiler/Plan.h
runtimes/neurun/src/compiler/PlanBuilder.h
runtimes/neurun/src/exec/DataflowExecutor.cc
runtimes/neurun/src/exec/DataflowExecutor.h

index 972e429..ede417a 100644 (file)
@@ -39,7 +39,7 @@ namespace compiler
 void Compiler::compile(void)
 {
   // Compilation result will be filled in operand_context and operation_sequence
-  auto operand_context = std::make_shared<operand::Context>();
+  auto operand_context = std::make_shared<OperandContext>();
   auto operation_sequence = std::make_shared<operation::Sequence>();
 
   const auto &operands = _model->operands();
index 1455224..a19021e 100644 (file)
@@ -32,7 +32,7 @@ namespace neurun
 namespace compiler
 {
 
-ConstantInitializer::ConstantInitializer(const graph::Graph &graph, operand::Context &operands,
+ConstantInitializer::ConstantInitializer(const graph::Graph &graph, OperandContext &operands,
                                          const graph::LowerInfoMap &lower_info_map)
     : _graph{graph}, _operands{operands}, _lower_info_map{lower_info_map}
 {
index 8ecc21d..fe23366 100644 (file)
@@ -18,7 +18,7 @@
 #define __NEURUN_COMPILER_CONSTANT_INITIALIZER_H__
 
 #include "graph/Graph.h"
-#include "compiler/operand/Context.h"
+#include "compiler/OperandContext.h"
 
 namespace neurun
 {
@@ -39,7 +39,7 @@ class ConstantInitializer
 {
 public:
   // TODO Change std::shared_ptr<Model> instead of Graph
-  ConstantInitializer(const graph::Graph &graph, operand::Context &operands,
+  ConstantInitializer(const graph::Graph &graph, OperandContext &operands,
                       const graph::LowerInfoMap &lower_info_map);
 
   void operator()();
@@ -51,7 +51,7 @@ private:
 
 private:
   const graph::Graph &_graph;
-  operand::Context &_operands;
+  OperandContext &_operands;
   const graph::LowerInfoMap &_lower_info_map;
 };
 
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "Context.h"
+#include "OperandContext.h"
 
 #include <cassert>
 
@@ -22,11 +22,9 @@ namespace neurun
 {
 namespace compiler
 {
-namespace operand
-{
 
-Context &Context::set(const model::operand::Index &id,
-                      const std::shared_ptr<backend::operand::IObject> &object)
+OperandContext &OperandContext::set(const model::operand::Index &id,
+                                    const std::shared_ptr<backend::operand::IObject> &object)
 {
   // Only one object for an id
   assert(_objects.find(id) == _objects.end());
@@ -34,7 +32,7 @@ Context &Context::set(const model::operand::Index &id,
   return (*this);
 }
 
-void Context::iterate(
+void OperandContext::iterate(
     const std::function<void(const model::operand::Index &, backend::operand::IObject &)> &fn)
 {
   for (auto &e : _objects)
@@ -43,6 +41,5 @@ void Context::iterate(
   }
 }
 
-} // namespace operand
 } // namespace compiler
 } // namespace neurun
@@ -26,14 +26,12 @@ namespace neurun
 {
 namespace compiler
 {
-namespace operand
-{
 
-class Context
+class OperandContext
 {
 public:
-  Context &set(const model::operand::Index &ind,
-               const std::shared_ptr<backend::operand::IObject> &object);
+  OperandContext &set(const model::operand::Index &ind,
+                      const std::shared_ptr<backend::operand::IObject> &object);
 
 public:
   bool exist(const ::neurun::model::operand::Index &ind) const
@@ -59,7 +57,6 @@ private:
   model::operand::IndexMap<std::shared_ptr<backend::operand::IObject>> _objects;
 };
 
-} // namespace operand
 } // namespace compiler
 } // namespace neurun
 
index fed3ee8..4c5da26 100644 (file)
@@ -18,7 +18,7 @@
 #define __NEURUN_CODEGEN_PLAN_H__
 
 #include "graph/Graph.h"
-#include "compiler/operand/Context.h"
+#include "compiler/OperandContext.h"
 #include "compiler/operation/Sequence.h"
 
 namespace neurun
@@ -39,7 +39,7 @@ public:
    * @param[in] ops       Compiled operation sequence
    * @param[in] compiled  @c true if model is compiled successfully, otherwise @c false
    */
-  Plan(std::shared_ptr<operand::Context> &operands, std::shared_ptr<operation::Sequence> &ops,
+  Plan(std::shared_ptr<OperandContext> &operands, std::shared_ptr<operation::Sequence> &ops,
        bool compiled = true)
       : _operands{operands}, _ops{ops}, _compiled{compiled}
   {
@@ -47,12 +47,12 @@ public:
   }
 
 public:
-  const operand::Context &operands(void) const { return *_operands; }
+  const OperandContext &operands(void) const { return *_operands; }
   const operation::Sequence &operations(void) const { return *_ops; }
   bool isCompiled(void) const { return _compiled; }
 
 private:
-  std::shared_ptr<operand::Context> _operands{nullptr};
+  std::shared_ptr<OperandContext> _operands{nullptr};
   std::shared_ptr<operation::Sequence> _ops{nullptr};
   bool _compiled{false};
 };
index c12f4a3..88608d5 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __NEURUN_COMPILER_PLAN_BUILDER_H__
 #define __NEURUN_COMPILER_PLAN_BUILDER_H__
 
-#include "compiler/operand/Context.h"
+#include "compiler/OperandContext.h"
 #include "compiler/operation/Sequence.h"
 #include "compiler/IExecutionBuilder.h"
 #include "backend/interface/IStageGenerator.h"
@@ -50,7 +50,7 @@ private:
 class PlanBuilder
 {
 public:
-  PlanBuilder(operand::Context &operands, operation::Sequence &operations)
+  PlanBuilder(OperandContext &operands, operation::Sequence &operations)
       : _operands{operands}, _operations{operations}
   {
     // DO NOTHING
@@ -64,7 +64,7 @@ public:
   void finalize(const backend::TensorBuilderSet &tensor_builders);
 
 private:
-  operand::Context &_operands;
+  OperandContext &_operands;
   operation::Sequence &_operations;
 
 private:
index 0027342..356ec6a 100644 (file)
@@ -46,10 +46,10 @@ void DataflowExecutor::notify(const model::operand::IndexSet &operands)
   }
 }
 
-DataflowExecutor::DataflowExecutor(
-    const std::shared_ptr<const model::Model> &model,
-    std::unique_ptr<graph::LowerInfoMap> lower_info,
-    const std::shared_ptr<compiler::operand::Context> &operand_context, CodeMap &&code_map)
+DataflowExecutor::DataflowExecutor(const std::shared_ptr<const model::Model> &model,
+                                   std::unique_ptr<graph::LowerInfoMap> lower_info,
+                                   const std::shared_ptr<compiler::OperandContext> &operand_context,
+                                   CodeMap &&code_map)
     : ExecutorBase{model, nullptr, std::move(lower_info)}, _operand_context{operand_context},
       _code_map{std::move(code_map)}
 {
index 63a2d00..3677162 100644 (file)
@@ -54,13 +54,13 @@ public:
    */
   DataflowExecutor(const std::shared_ptr<const model::Model> &model,
                    std::unique_ptr<graph::LowerInfoMap> lower_info,
-                   const std::shared_ptr<compiler::operand::Context> &operand_context,
+                   const std::shared_ptr<compiler::OperandContext> &operand_context,
                    CodeMap &&code_map);
 
   void execute() override;
 
 private:
-  std::shared_ptr<compiler::operand::Context> _operand_context;
+  std::shared_ptr<compiler::OperandContext> _operand_context;
   CodeMap _code_map;
   model::operand::IndexSet _initially_ready_operands;
   std::list<std::unique_ptr<Job>> _finished_jobs;