From 7f3eb0c7c0c65e5065de29999b9128d17c87a6e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 12 Aug 2019 16:21:09 +0900 Subject: [PATCH] [neurun] Remove class `Plan` (#6450) `Plan` is nothing more than a wrapping `FunctionSequence` so it is redundant. It has been replaced with `FunctionSequence`. Signed-off-by: Hanjoung Lee --- .../neurun/core/src/compiler/ExecutorFactory.cc | 11 ++--- runtimes/neurun/core/src/compiler/Plan.cc | 27 ----------- runtimes/neurun/core/src/compiler/Plan.h | 56 ---------------------- runtimes/neurun/core/src/exec/LinearExecutor.cc | 2 +- runtimes/neurun/core/src/exec/LinearExecutor.h | 8 ++-- runtimes/neurun/core/src/exec/interp/ExecEnv.h | 4 +- 6 files changed, 11 insertions(+), 97 deletions(-) delete mode 100644 runtimes/neurun/core/src/compiler/Plan.cc delete mode 100644 runtimes/neurun/core/src/compiler/Plan.h diff --git a/runtimes/neurun/core/src/compiler/ExecutorFactory.cc b/runtimes/neurun/core/src/compiler/ExecutorFactory.cc index e34a03d..8c67e8c 100644 --- a/runtimes/neurun/core/src/compiler/ExecutorFactory.cc +++ b/runtimes/neurun/core/src/compiler/ExecutorFactory.cc @@ -167,14 +167,9 @@ exec::IExecutor *ExecutorFactory::createLinearExecutor(graph::Graph &graph) mem_mgrs->insert(tensor_builder->releaseMemoryManager()); } - auto plan = std::make_shared(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 index b7637b1..0000000 --- a/runtimes/neurun/core/src/compiler/Plan.cc +++ /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 index 7d393ca..0000000 --- a/runtimes/neurun/core/src/compiler/Plan.h +++ /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 &ops) : _ops{ops} - { - // DO NOTHING - } - -public: - exec::FunctionSequence &functions(void) const { return *_ops; } - -private: - std::shared_ptr _ops{nullptr}; -}; - -} // namespace compiler -} // namespace neurun - -#endif // __NEURUN_CODEGEN_PLAN_H__ diff --git a/runtimes/neurun/core/src/exec/LinearExecutor.cc b/runtimes/neurun/core/src/exec/LinearExecutor.cc index 8c387e0..35197a2 100644 --- a/runtimes/neurun/core/src/exec/LinearExecutor.cc +++ b/runtimes/neurun/core/src/exec/LinearExecutor.cc @@ -21,7 +21,7 @@ namespace neurun namespace exec { -void LinearExecutor::executeImpl() { _plan->functions().run(); } +void LinearExecutor::executeImpl() { _fn_seq->run(); } } // namespace exec } // namespace neurun diff --git a/runtimes/neurun/core/src/exec/LinearExecutor.h b/runtimes/neurun/core/src/exec/LinearExecutor.h index 6c4e977..25fdad8 100644 --- a/runtimes/neurun/core/src/exec/LinearExecutor.h +++ b/runtimes/neurun/core/src/exec/LinearExecutor.h @@ -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 lower_info, std::unique_ptr mem_mgrs, std::vector &&elements, - const std::shared_ptr &plan) + const std::shared_ptr &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 _plan; + std::shared_ptr _fn_seq; std::vector _elements; }; diff --git a/runtimes/neurun/core/src/exec/interp/ExecEnv.h b/runtimes/neurun/core/src/exec/interp/ExecEnv.h index 5d0d5eb..c270d72 100644 --- a/runtimes/neurun/core/src/exec/interp/ExecEnv.h +++ b/runtimes/neurun/core/src/exec/interp/ExecEnv.h @@ -21,7 +21,9 @@ #ifndef __NEURUN_EXEC_INTERP_EXEC_ENV_H_ #define __NEURUN_EXEC_INTERP_EXEC_ENV_H_ -#include "compiler/Plan.h" +#include + +#include "model/Model.h" #include "Tensor.h" namespace neurun -- 2.7.4