[neurun] Remove class `Plan` (#6450)
author이한종/On-Device Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Mon, 12 Aug 2019 07:21:09 +0000 (16:21 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 12 Aug 2019 07:21:09 +0000 (16:21 +0900)
`Plan` is nothing more than a wrapping `FunctionSequence` so it is
redundant. It has been replaced with `FunctionSequence`.

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

index e34a03d..8c67e8c 100644 (file)
@@ -167,14 +167,9 @@ exec::IExecutor *ExecutorFactory::createLinearExecutor(graph::Graph &graph)
     mem_mgrs->insert(tensor_builder->releaseMemoryManager());
   }
 
-  auto plan = std::make_shared<Plan>(function_sequence);
-  return new exec::LinearExecutor{graph.shareModel(),
-                                  linear->releaseSubgraphs(),
-                                  operand_context,
-                                  linear->releaseLowerInfo(),
-                                  std::move(mem_mgrs),
-                                  linear->releaseElements(),
-                                  plan};
+  return new exec::LinearExecutor{
+      graph.shareModel(),  linear->releaseSubgraphs(), operand_context,  linear->releaseLowerInfo(),
+      std::move(mem_mgrs), linear->releaseElements(),  function_sequence};
 }
 
 exec::IExecutor *ExecutorFactory::createDataflowExecutor(graph::Graph &graph, bool parallel)
diff --git a/runtimes/neurun/core/src/compiler/Plan.cc b/runtimes/neurun/core/src/compiler/Plan.cc
deleted file mode 100644 (file)
index b7637b1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-
-#include "Plan.h"
-
-namespace neurun
-{
-namespace codegen
-{
-
-// NO IMPLEMENTATION YET
-
-} // namespace codegen
-} // namespace neurun
diff --git a/runtimes/neurun/core/src/compiler/Plan.h b/runtimes/neurun/core/src/compiler/Plan.h
deleted file mode 100644 (file)
index 7d393ca..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2018 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_CODEGEN_PLAN_H__
-#define __NEURUN_CODEGEN_PLAN_H__
-
-#include "graph/Graph.h"
-#include "exec/FunctionSequence.h"
-#include "compiler/OperandContext.h"
-
-namespace neurun
-{
-namespace compiler
-{
-
-class Plan
-{
-public:
-  /**
-   * @brief Construct a new Plan object for not compiled model
-   */
-  Plan() = default;
-  /**
-   * @brief     Construct a new Plan object
-   * @param[in] operands  Compiled operand context
-   * @param[in] ops       Compiled operation sequence
-   */
-  Plan(std::shared_ptr<exec::FunctionSequence> &ops) : _ops{ops}
-  {
-    // DO NOTHING
-  }
-
-public:
-  exec::FunctionSequence &functions(void) const { return *_ops; }
-
-private:
-  std::shared_ptr<exec::FunctionSequence> _ops{nullptr};
-};
-
-} // namespace compiler
-} // namespace neurun
-
-#endif // __NEURUN_CODEGEN_PLAN_H__
index 8c387e0..35197a2 100644 (file)
@@ -21,7 +21,7 @@ namespace neurun
 namespace exec
 {
 
-void LinearExecutor::executeImpl() { _plan->functions().run(); }
+void LinearExecutor::executeImpl() { _fn_seq->run(); }
 
 } // namespace exec
 } // namespace neurun
index 6c4e977..25fdad8 100644 (file)
@@ -23,8 +23,8 @@
 #define __NEURUN_EXEC_EXECUTOR_H_
 
 #include "ExecutorBase.h"
-#include "compiler/Plan.h"
 #include "compiler/Linear.h"
+#include "exec/FunctionSequence.h"
 
 namespace neurun
 {
@@ -48,10 +48,10 @@ public:
                  std::unique_ptr<graph::LowerInfoMap> lower_info,
                  std::unique_ptr<backend::MemoryManagerSet> mem_mgrs,
                  std::vector<compiler::Linear::Element> &&elements,
-                 const std::shared_ptr<const neurun::compiler::Plan> &plan)
+                 const std::shared_ptr<exec::FunctionSequence> &fn_seq)
       : ExecutorBase{model, std::move(subgraphs), operand_context, std::move(lower_info),
                      std::move(mem_mgrs)},
-        _plan{plan}, _elements{std::move(elements)}
+        _fn_seq{fn_seq}, _elements{std::move(elements)}
   {
   }
 
@@ -59,7 +59,7 @@ public:
   void executeImpl(void) override;
 
 private:
-  std::shared_ptr<const compiler::Plan> _plan;
+  std::shared_ptr<exec::FunctionSequence> _fn_seq;
   std::vector<compiler::Linear::Element> _elements;
 };
 
index 5d0d5eb..c270d72 100644 (file)
@@ -21,7 +21,9 @@
 #ifndef __NEURUN_EXEC_INTERP_EXEC_ENV_H_
 #define __NEURUN_EXEC_INTERP_EXEC_ENV_H_
 
-#include "compiler/Plan.h"
+#include <unordered_set>
+
+#include "model/Model.h"
 #include "Tensor.h"
 
 namespace neurun