From 2a2dbc668ddf8520634313ed6aa2b459f2c20d80 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Thu, 1 Aug 2024 17:24:25 +0900 Subject: [PATCH] [onert] Simplify OperationLowerInfo usage (#13572) This commit removes OperationLowerInfo and use Backend directly. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- runtime/onert/backend/ruy/BackendContext.h | 8 +-- .../core/include/backend/BackendContext.h | 2 +- runtime/onert/core/include/compiler/CodeMap.h | 14 ++--- .../core/include/compiler/GraphLowerInfo.h | 12 ++--- .../include/compiler/OperationLowerInfo.h | 52 ------------------- .../include/compiler/train/TrainableCodeMap.h | 11 ++-- .../core/src/backend/builtin/BackendContext.h | 7 +-- .../core/src/compiler/ExecutorFactory.cc | 26 +++++----- .../onert/core/src/compiler/LoweredGraph.cc | 5 +- .../core/src/compiler/OperationLowerInfo.cc | 31 ----------- .../compiler/pass/ConstantInsertionPass.cc | 6 +-- .../src/compiler/pass/ConstantLoweringPass.cc | 6 +-- .../compiler/pass/PermutationInsertionPass.cc | 11 ++-- .../compiler/train/LoweredTrainableGraph.cc | 3 +- .../pass/TrainableConstantInsertionPass.cc | 6 +-- .../onert/core/src/dumper/dot/DotDumper.cc | 8 +-- .../onert/core/src/exec/DataflowExecutor.cc | 2 +- runtime/onert/core/src/exec/LinearExecutor.cc | 2 +- .../onert/core/src/exec/ParallelExecutor.cc | 9 ++-- .../core/src/exec/train/TrainableExecutor.cc | 4 +- 20 files changed, 66 insertions(+), 159 deletions(-) delete mode 100644 runtime/onert/core/include/compiler/OperationLowerInfo.h delete mode 100644 runtime/onert/core/src/compiler/OperationLowerInfo.cc diff --git a/runtime/onert/backend/ruy/BackendContext.h b/runtime/onert/backend/ruy/BackendContext.h index 0dc30f557e7..e29f2685fa4 100644 --- a/runtime/onert/backend/ruy/BackendContext.h +++ b/runtime/onert/backend/ruy/BackendContext.h @@ -17,10 +17,12 @@ #ifndef __ONERT_BACKEND_RUY_BACKEND_CONTEXT_H__ #define __ONERT_BACKEND_RUY_BACKEND_CONTEXT_H__ -#include -#include "TensorBuilder.h" -#include "KernelGenerator.h" #include "ExternalContext.h" +#include "KernelGenerator.h" +#include "TensorBuilder.h" + +#include +#include namespace onert { diff --git a/runtime/onert/core/include/backend/BackendContext.h b/runtime/onert/core/include/backend/BackendContext.h index 654aee9266f..a00f739cc3a 100644 --- a/runtime/onert/core/include/backend/BackendContext.h +++ b/runtime/onert/core/include/backend/BackendContext.h @@ -21,8 +21,8 @@ #include "ir/Graph.h" #include "ir/OperationIndexMap.h" #include "ir/OperandIndexMap.h" -#include "compiler/GraphLowerInfo.h" #include "exec/FunctionSequence.h" +#include "util/Set.h" namespace onert { diff --git a/runtime/onert/core/include/compiler/CodeMap.h b/runtime/onert/core/include/compiler/CodeMap.h index 93fe43cfdb6..72157f4eeed 100644 --- a/runtime/onert/core/include/compiler/CodeMap.h +++ b/runtime/onert/core/include/compiler/CodeMap.h @@ -17,11 +17,12 @@ #ifndef __ONERT_COMPILER_CODE_MAP_H__ #define __ONERT_COMPILER_CODE_MAP_H__ -#include +#include "backend/Backend.h" +#include "exec/FunctionSequence.h" #include "ir/Index.h" #include "ir/IOperation.h" -#include "exec/FunctionSequence.h" -#include "OperationLowerInfo.h" + +#include namespace onert { @@ -32,13 +33,12 @@ struct CodeAndInfo { ir::OperationIndex op_ind; const ir::IOperation *op; - const OperationLowerInfo *lower_info; + const backend::Backend *op_backend; std::unique_ptr fn_seq; CodeAndInfo(const ir::OperationIndex op_ind, const ir::IOperation *op, - const OperationLowerInfo *lower_info, - std::unique_ptr &&fn_seq) - : op_ind{op_ind}, op{op}, lower_info{lower_info}, fn_seq{std::move(fn_seq)} + const backend::Backend *op_backend, std::unique_ptr &&fn_seq) + : op_ind{op_ind}, op{op}, op_backend{op_backend}, fn_seq{std::move(fn_seq)} { } }; diff --git a/runtime/onert/core/include/compiler/GraphLowerInfo.h b/runtime/onert/core/include/compiler/GraphLowerInfo.h index b679891d6ac..0d4eee9a717 100644 --- a/runtime/onert/core/include/compiler/GraphLowerInfo.h +++ b/runtime/onert/core/include/compiler/GraphLowerInfo.h @@ -17,13 +17,13 @@ #ifndef __ONERT_COMPILER_GRAPH_LOWER_INFO_H__ #define __ONERT_COMPILER_GRAPH_LOWER_INFO_H__ -#include -#include - +#include "backend/Backend.h" #include "compiler/OperandLowerInfo.h" -#include "compiler/OperationLowerInfo.h" -#include "util/ObjectManager.h" #include "ir/Index.h" +#include "util/ObjectManager.h" + +#include +#include namespace onert { @@ -32,7 +32,7 @@ namespace compiler struct GraphLowerInfo { - util::ObjectManager operation; + std::unordered_map operation; util::ObjectManager operand; }; diff --git a/runtime/onert/core/include/compiler/OperationLowerInfo.h b/runtime/onert/core/include/compiler/OperationLowerInfo.h deleted file mode 100644 index 20ca12952c6..00000000000 --- a/runtime/onert/core/include/compiler/OperationLowerInfo.h +++ /dev/null @@ -1,52 +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 __ONERT_COMPILER_OP_SEQUENCE_LOWER_INFO_H__ -#define __ONERT_COMPILER_OP_SEQUENCE_LOWER_INFO_H__ - -#include - -#include -#include - -namespace onert -{ -namespace backend -{ -class Backend; -} // namespace backend -} // namespace onert - -namespace onert -{ -namespace compiler -{ - -class OperationLowerInfo -{ -public: - OperationLowerInfo(const backend::Backend *backend, ir::Layout layout); - const backend::Backend *backend() const { return _permute_factor.backend(); } - ir::Layout layout() const { return _permute_factor.layout(); } - -private: - PermuteFactor _permute_factor; -}; - -} // namespace compiler -} // namespace onert - -#endif // __ONERT_COMPILER_OP_SEQUENCE_LOWER_INFO_H__ diff --git a/runtime/onert/core/include/compiler/train/TrainableCodeMap.h b/runtime/onert/core/include/compiler/train/TrainableCodeMap.h index 1069a47c98a..0e0ab861914 100644 --- a/runtime/onert/core/include/compiler/train/TrainableCodeMap.h +++ b/runtime/onert/core/include/compiler/train/TrainableCodeMap.h @@ -17,11 +17,12 @@ #ifndef __ONERT_COMPILER_TRAIN_TRAINABLE_CODE_MAP_H__ #define __ONERT_COMPILER_TRAIN_TRAINABLE_CODE_MAP_H__ -#include -#include "compiler/OperationLowerInfo.h" +#include "backend/Backend.h" #include "exec/train/TrainableFnSequence.h" #include "ir/train/ITrainableOperation.h" +#include + namespace onert { namespace compiler @@ -33,14 +34,14 @@ struct TrainableCodeAndInfo { ir::OperationIndex op_ind; const ir::train::ITrainableOperation *op; - const OperationLowerInfo *lower_info; + const backend::Backend *op_backend; // TODO Change to TrainableFnSequence std::unique_ptr tn_seq; TrainableCodeAndInfo(const ir::OperationIndex op_ind, const ir::train::ITrainableOperation *op, - const OperationLowerInfo *lower_info, + const backend::Backend *op_backend, std::unique_ptr &&tn_seq) - : op_ind{op_ind}, op{op}, lower_info{lower_info}, tn_seq{std::move(tn_seq)} + : op_ind{op_ind}, op{op}, op_backend{op_backend}, tn_seq{std::move(tn_seq)} { } }; diff --git a/runtime/onert/core/src/backend/builtin/BackendContext.h b/runtime/onert/core/src/backend/builtin/BackendContext.h index 93e8252397e..2ec1be01e7a 100644 --- a/runtime/onert/core/src/backend/builtin/BackendContext.h +++ b/runtime/onert/core/src/backend/builtin/BackendContext.h @@ -17,10 +17,11 @@ #ifndef __ONERT_BACKEND_BUILTIN_BACKEND_CONTEXT_H__ #define __ONERT_BACKEND_BUILTIN_BACKEND_CONTEXT_H__ -#include -#include "TensorBuilder.h" -#include "KernelGenerator.h" #include "ExternalContext.h" +#include "KernelGenerator.h" +#include "TensorBuilder.h" +#include "backend/BackendContext.h" +#include "compiler/GraphLowerInfo.h" namespace onert { diff --git a/runtime/onert/core/src/compiler/ExecutorFactory.cc b/runtime/onert/core/src/compiler/ExecutorFactory.cc index 82ef1054c56..5bf0c434bec 100644 --- a/runtime/onert/core/src/compiler/ExecutorFactory.cc +++ b/runtime/onert/core/src/compiler/ExecutorFactory.cc @@ -186,7 +186,7 @@ createBackendContexts(compiler::ILoweredGraph &lgraph, bool linear_executor, whole_graph.operations().iterate( [&](const ir::OperationIndex &op_ind, const ir::IOperation &operation) { auto &op_li = lgraph.lower_info().operation; - auto backend = op_li.at(op_ind).backend(); + const auto backend = op_li.at(op_ind); if (context_data_map.find(backend) == context_data_map.end()) init_context_data(backend); @@ -315,8 +315,8 @@ void ExecutorFactory::prepareMigrantTensors(compiler::ILoweredGraph &lowered_gra lowered_graph.graph().operations().iterate( [&](const ir::OperationIndex &op_ind, const ir::IOperation &op) { - auto lower_info = lowered_graph.lower_info().operation.getRawPtr(op_ind); - auto &backend_ctx = backend_contexts.at(lower_info->backend()); + const auto backend = lowered_graph.lower_info().operation.at(op_ind); + auto &backend_ctx = backend_contexts.at(backend); for (auto &&ind : (op.getInputs() + op.getOutputs()) | ir::Remove::DUPLICATED | ir::Remove::UNDEFINED) { @@ -471,12 +471,12 @@ ExecutorFactory::createLinearExecutor(std::unique_ptr lo for (auto &&[op_ind, fn_seq] : codes) { auto &op = lowered_graph->graph().operations().at(op_ind); - auto lower_info = lowered_graph->lower_info().operation.getRawPtr(op_ind); + const auto backend = lowered_graph->lower_info().operation.at(op_ind); if (options->he_profiling_mode) - fn_seq->wrap(lower_info->backend()->config()); + fn_seq->wrap(backend->config()); if (!dealloc_list_map[op_ind].empty()) fn_seq->append(std::make_unique(dealloc_list_map[op_ind])); - builder.append(op_ind, {op_ind, &op, lower_info, std::move(fn_seq)}); + builder.append(op_ind, {op_ind, &op, backend, std::move(fn_seq)}); } } @@ -542,10 +542,10 @@ ExecutorFactory::createDataflowExecutor(std::unique_ptr for (auto &&[op_ind, fn_seq] : codes) { auto &op = lowered_graph->graph().operations().at(op_ind); - auto lower_info = lowered_graph->lower_info().operation.getRawPtr(op_ind); + const auto backend = lowered_graph->lower_info().operation.at(op_ind); if (options->he_profiling_mode) - fn_seq->wrap(lower_info->backend()->config()); - builder.append(op_ind, {op_ind, &op, lower_info, std::move(fn_seq)}); + fn_seq->wrap(backend->config()); + builder.append(op_ind, {op_ind, &op, backend, std::move(fn_seq)}); } } @@ -608,8 +608,8 @@ void ExecutorFactory::prepareMigrantTensors( lowered_graph.graph().operations().iterate( [&](const ir::OperationIndex &op_ind, const ir::IOperation &op) { - auto lower_info = lowered_graph.lower_info().operation.getRawPtr(op_ind); - auto &backend_ctx = backend_contexts.at(lower_info->backend()); + const auto backend = lowered_graph.lower_info().operation.at(op_ind); + auto &backend_ctx = backend_contexts.at(backend); for (auto &&ind : (op.getInputs() + op.getOutputs()) | ir::Remove::DUPLICATED | ir::Remove::UNDEFINED) { @@ -856,11 +856,11 @@ exec::IExecutor *ExecutorFactory::createTrainableExecutor( for (auto &&[op_ind, tn_seq] : codes) { auto &op = lowered_graph->trainable_graph().operation(op_ind); - auto lower_info = lowered_graph->lower_info().operation.getRawPtr(op_ind); + const auto backend = lowered_graph->lower_info().operation.at(op_ind); assert(code_map.find(op_ind) == code_map.end()); code_map.insert( - {op_ind, train::TrainableCodeAndInfo{op_ind, &op, lower_info, std::move(tn_seq)}}); + {op_ind, train::TrainableCodeAndInfo{op_ind, &op, backend, std::move(tn_seq)}}); } } diff --git a/runtime/onert/core/src/compiler/LoweredGraph.cc b/runtime/onert/core/src/compiler/LoweredGraph.cc index b0b73319f1a..7d60b3485d3 100644 --- a/runtime/onert/core/src/compiler/LoweredGraph.cc +++ b/runtime/onert/core/src/compiler/LoweredGraph.cc @@ -121,7 +121,7 @@ void LoweredGraph::makeLowerInfo(const compiler::BackendResolver &backend_resolv // Set operand lower info using assigned backends to operations _graph.operations().iterate([&](const ir::OperationIndex &op_ind, const ir::IOperation &) { const ir::IOperation &op = _graph.operations().at(op_ind); - auto backend = backend_resolver.getBackend(op_ind); + const auto backend = backend_resolver.getBackend(op_ind); if (!backend) { throw std::runtime_error{"Fail to find backend for " + op.name() + " operation"}; @@ -140,8 +140,7 @@ void LoweredGraph::makeLowerInfo(const compiler::BackendResolver &backend_resolv auto &operand_li = lower_info().operand.at(ind); operand_li.addDefPermuteFactor(PermuteFactor{backend, backend_layout}); } - lower_info().operation.set( - op_ind, std::make_unique(backend, backend_layout)); + lower_info().operation.emplace(op_ind, backend); }); // Handle graph inputs and outputs diff --git a/runtime/onert/core/src/compiler/OperationLowerInfo.cc b/runtime/onert/core/src/compiler/OperationLowerInfo.cc deleted file mode 100644 index e8a4381306b..00000000000 --- a/runtime/onert/core/src/compiler/OperationLowerInfo.cc +++ /dev/null @@ -1,31 +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 "compiler/OperationLowerInfo.h" - -namespace onert -{ -namespace compiler -{ - -OperationLowerInfo::OperationLowerInfo(const backend::Backend *backend, ir::Layout layout) - : _permute_factor{backend, layout} -{ - // DO NOTHING -} - -} // namespace compiler -} // namespace onert diff --git a/runtime/onert/core/src/compiler/pass/ConstantInsertionPass.cc b/runtime/onert/core/src/compiler/pass/ConstantInsertionPass.cc index 7834e3bf280..e2224eaf3fc 100644 --- a/runtime/onert/core/src/compiler/pass/ConstantInsertionPass.cc +++ b/runtime/onert/core/src/compiler/pass/ConstantInsertionPass.cc @@ -30,10 +30,8 @@ namespace pass void ConstantInsertionPass::callback(const ir::OperationIndex &node_index, ir::IOperation &node) { - const auto op_lower_info = _lowered_graph.lower_info().operation.getRawPtr(node_index); - const auto backend = op_lower_info->backend(); - const auto layout = op_lower_info->layout(); - const auto factor = PermuteFactor{backend, layout}; + const auto backend = _lowered_graph.lower_info().operation.at(node_index); + const auto factor = PermuteFactor{backend, ir::Layout::NHWC}; for (const auto &input : node.getInputs() | ir::Remove::DUPLICATED | ir::Remove::UNDEFINED) { diff --git a/runtime/onert/core/src/compiler/pass/ConstantLoweringPass.cc b/runtime/onert/core/src/compiler/pass/ConstantLoweringPass.cc index 32e32d0efb6..8d2abfcf037 100644 --- a/runtime/onert/core/src/compiler/pass/ConstantLoweringPass.cc +++ b/runtime/onert/core/src/compiler/pass/ConstantLoweringPass.cc @@ -31,10 +31,8 @@ namespace pass void ConstantLoweringPass::callback(const ir::OperationIndex &node_index, ir::IOperation &node) { - const auto op_lower_info = _lowered_graph.lower_info().operation.getRawPtr(node_index); - const auto backend = op_lower_info->backend(); - const auto layout = op_lower_info->layout(); - const auto factor = PermuteFactor{backend, layout}; + const auto backend = _lowered_graph.lower_info().operation.at(node_index); + const auto factor = PermuteFactor{backend, ir::Layout::NHWC}; // Now this runtime does not support the node making output of operation as constant for (const auto &input : node.getInputs() | ir::Remove::DUPLICATED | ir::Remove::UNDEFINED) diff --git a/runtime/onert/core/src/compiler/pass/PermutationInsertionPass.cc b/runtime/onert/core/src/compiler/pass/PermutationInsertionPass.cc index f5ad7e636ad..c147baa23e2 100644 --- a/runtime/onert/core/src/compiler/pass/PermutationInsertionPass.cc +++ b/runtime/onert/core/src/compiler/pass/PermutationInsertionPass.cc @@ -19,7 +19,6 @@ #include "../../backend/builtin/Config.h" -#include "compiler/OperationLowerInfo.h" #include "ir/operation/Permute.h" #include "util/logging.h" @@ -82,14 +81,11 @@ void PermutationInsertionPass::callback(const ir::OperandIndex &index, ir::Opera continue; auto &operation = _graph.operations().at(use); - auto op_li = _lowered_graph.lower_info().operation.getRawPtr(use); - assert(op_li); - const auto op_layout = op_li->layout(); - const backend::Backend *backend = op_li->backend(); + const auto backend = _lowered_graph.lower_info().operation.at(use); assert(backend); assert(operation.getInputs().contains(index)); - auto new_index = factor_to_index.at({backend, op_layout}); + auto new_index = factor_to_index.at({backend, ir::Layout::NHWC}); if (index != new_index) { // Update from operation @@ -194,8 +190,7 @@ ir::OperationIndex PermutationInsertionPass::insertPermute(const ir::OperandInde // Operation LowerInfo { auto &operation_li_map = _lowered_graph.lower_info().operation; - operation_li_map.set(node_index, std::make_unique( - permute_node_backend, permute_node_layout)); + operation_li_map.emplace(node_index, permute_node_backend); } // Update Use/Def info diff --git a/runtime/onert/core/src/compiler/train/LoweredTrainableGraph.cc b/runtime/onert/core/src/compiler/train/LoweredTrainableGraph.cc index dda0655795e..cc8f735a2ca 100644 --- a/runtime/onert/core/src/compiler/train/LoweredTrainableGraph.cc +++ b/runtime/onert/core/src/compiler/train/LoweredTrainableGraph.cc @@ -170,8 +170,7 @@ void LoweredTrainableGraph::makeLowerInfo(const compiler::BackendResolver &backe auto &operand_li = lower_info().operand.at(ind); operand_li.addDefPermuteFactor(PermuteFactor{backend, backend_layout}); } - lower_info().operation.set( - op_ind, std::make_unique(backend, backend_layout)); + lower_info().operation.emplace(op_ind, backend); }); // Handle graph inputs and outputs diff --git a/runtime/onert/core/src/compiler/train/pass/TrainableConstantInsertionPass.cc b/runtime/onert/core/src/compiler/train/pass/TrainableConstantInsertionPass.cc index 00a3adaa3d9..d825ccd3ffa 100644 --- a/runtime/onert/core/src/compiler/train/pass/TrainableConstantInsertionPass.cc +++ b/runtime/onert/core/src/compiler/train/pass/TrainableConstantInsertionPass.cc @@ -69,10 +69,8 @@ void TrainableConstantInsertionPass::updateUseDef(const ir::OperandIndex &old_in const ir::OperandIndex &new_index, const ir::OperationIndex &node_index) { - const auto op_lower_info = _lowered_graph.lower_info().operation.getRawPtr(node_index); - const auto backend = op_lower_info->backend(); - const auto layout = op_lower_info->layout(); - const auto factor = PermuteFactor{backend, layout}; + const auto backend = _lowered_graph.lower_info().operation.at(node_index); + const auto factor = PermuteFactor{backend, ir::Layout::NHWC}; // Update the same inputs of a node at once because inputs of an operation have the same // PermuteFactor diff --git a/runtime/onert/core/src/dumper/dot/DotDumper.cc b/runtime/onert/core/src/dumper/dot/DotDumper.cc index 98524d8d134..d7b83f86dca 100644 --- a/runtime/onert/core/src/dumper/dot/DotDumper.cc +++ b/runtime/onert/core/src/dumper/dot/DotDumper.cc @@ -158,11 +158,11 @@ void update_lower_info(const compiler::ILoweredGraph &lowered_graph, { const auto &operations = lowered_graph.graph().operations(); operations.iterate([&](const ir::OperationIndex &index, const ir::IOperation &) { - const auto lower_info = lowered_graph.lower_info().operation.getRawPtr(index); - if (lower_info) + const auto backend = lowered_graph.lower_info().operation.at(index); + if (backend) { - auto fillcolor = backend_to_fillcolor(lower_info->backend()); - std::string backend_label = "[" + lower_info->backend()->config()->id() + "]"; + auto fillcolor = backend_to_fillcolor(backend); + std::string backend_label = "[" + backend->config()->id() + "]"; auto itr = dot_operations->find(index); if (itr != dot_operations->end()) { diff --git a/runtime/onert/core/src/exec/DataflowExecutor.cc b/runtime/onert/core/src/exec/DataflowExecutor.cc index 80013c8b9b1..127337f2ffc 100644 --- a/runtime/onert/core/src/exec/DataflowExecutor.cc +++ b/runtime/onert/core/src/exec/DataflowExecutor.cc @@ -153,7 +153,7 @@ void DataflowExecutor::executeImpl(const ExecutionObservee &subject) VERBOSE(DataflowExecutor) << "Run job " << job_index << std::endl; auto op_ind = _job_to_op[job_index]; - const backend::Backend *backend = _lowered_graph->lower_info().operation.at(op_ind).backend(); + const auto backend = _lowered_graph->lower_info().operation.at(op_ind); subject.notifyJobBegin(this, profiling_subg_index, op_ind, backend); diff --git a/runtime/onert/core/src/exec/LinearExecutor.cc b/runtime/onert/core/src/exec/LinearExecutor.cc index 228c4d3c0ee..89d1a00ff4c 100644 --- a/runtime/onert/core/src/exec/LinearExecutor.cc +++ b/runtime/onert/core/src/exec/LinearExecutor.cc @@ -33,7 +33,7 @@ void LinearExecutor::executeImpl(const ExecutionObservee &subject) subject.notifySubgraphBegin(profiling_subg_index); for (auto &&code : _code) { - const auto backend = code.lower_info->backend(); + const auto backend = code.op_backend; // TODO : Move ruy profiler into ExecutionObserver #ifdef RUY_PROFILER ruy::profiler::ScopeLabel label(code.op->name()); diff --git a/runtime/onert/core/src/exec/ParallelExecutor.cc b/runtime/onert/core/src/exec/ParallelExecutor.cc index 152fa7cd3ee..16c8460fa29 100644 --- a/runtime/onert/core/src/exec/ParallelExecutor.cc +++ b/runtime/onert/core/src/exec/ParallelExecutor.cc @@ -77,10 +77,9 @@ void ParallelExecutor::executeImpl(const ExecutionObservee &subject) // Init scheduler // TODO Consider to have distinct backend set in GraphLowerInfo BackendSet backends; - _lowered_graph->lower_info().operation.iterate( - [&](const ir::OperationIndex &, const compiler::OperationLowerInfo &lower_info) { - backends.add(lower_info.backend()); - }); + for (const auto &[idx, backend] : _lowered_graph->lower_info().operation) + backends.add(backend); + _scheduler = std::make_unique(backends); assert(noWaitingJobs()); @@ -127,7 +126,7 @@ void ParallelExecutor::executeImpl(const ExecutionObservee &subject) auto job_index = job->index(); auto op_ind = _job_to_op[job_index]; - auto backend = _lowered_graph->lower_info().operation.at(op_ind).backend(); + const auto backend = _lowered_graph->lower_info().operation.at(op_ind); auto setup = [&, op_ind, backend]() { subject.notifyJobBegin(this, profiling_subg_index, op_ind, backend); }; diff --git a/runtime/onert/core/src/exec/train/TrainableExecutor.cc b/runtime/onert/core/src/exec/train/TrainableExecutor.cc index 5d7c4f3f7fd..a3e5b9f501b 100644 --- a/runtime/onert/core/src/exec/train/TrainableExecutor.cc +++ b/runtime/onert/core/src/exec/train/TrainableExecutor.cc @@ -105,7 +105,7 @@ void TrainableExecutor::forwardImpl(const ExecutionObservee &subject, bool train for (auto &&index : _forward_order) { const auto &code = _code_map.at(index); - const auto backend = code.lower_info->backend(); + const auto backend = code.op_backend; // TODO : Move ruy profiler into ExecutionObserver #ifdef RUY_PROFILER ruy::profiler::ScopeLabel label(code.op->name()); @@ -162,7 +162,7 @@ void TrainableExecutor::backwardImpl(const ExecutionObservee &subject, uint32_t { continue; } - const auto backend = code.lower_info->backend(); + const auto backend = code.op_backend; // TODO : Move ruy profiler into ExecutionObserver #ifdef RUY_PROFILER ruy::profiler::ScopeLabel label(code.op->name());