From b618d183a7d66520f31c2a0da9d2aafb728d7a82 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Wed, 31 Jul 2024 18:00:06 +0900 Subject: [PATCH] Remove layout info in BackendContext --- runtime/onert/core/include/backend/BackendContext.h | 3 --- .../core/include/backend/basic/BackendContextHelpers.h | 5 ----- runtime/onert/core/src/compiler/ExecutorFactory.cc | 7 ------- 3 files changed, 15 deletions(-) diff --git a/runtime/onert/core/include/backend/BackendContext.h b/runtime/onert/core/include/backend/BackendContext.h index a00f739cc3a..052809f7d11 100644 --- a/runtime/onert/core/include/backend/BackendContext.h +++ b/runtime/onert/core/include/backend/BackendContext.h @@ -42,8 +42,6 @@ struct ContextData std::vector op_order; /* Operands that are defined by other backends */ util::Set external_operands; - /* Operand layout info */ - ir::OperandIndexMap operand_layouts; /* Custom kernel builder */ std::shared_ptr custom_kernel_builder; /* Is linear executor or not */ @@ -64,7 +62,6 @@ class BackendContext const Backend *backend() const { return _backend; } const ir::Graph *graph() const { return _data.graph.get(); } const util::Set &external_operands() const { return _data.external_operands; } - const ir::OperandIndexMap &operand_layouts() const { return _data.operand_layouts; } const ContextData &data() const { return _data; } virtual ITensorRegistry *genTensors() = 0; diff --git a/runtime/onert/core/include/backend/basic/BackendContextHelpers.h b/runtime/onert/core/include/backend/basic/BackendContextHelpers.h index 590ae0b9919..79a535559e1 100644 --- a/runtime/onert/core/include/backend/basic/BackendContextHelpers.h +++ b/runtime/onert/core/include/backend/basic/BackendContextHelpers.h @@ -61,11 +61,6 @@ template void planTensors(const T_BackendContext &ct { // These tensors do not exist in any (No use and def) const auto &info = obj.info(); - // NOTE Currently we only support NHWC tensors for cpu-common tensors. - // There is no way to get the layout info from the backend context for now. - // When we support NCHW tensors as well, we also need to change tensor info to be - // permuted shape. - assert(ctx.operand_layouts().at(ind) == ir::Layout::NHWC); tensor_builder->registerTensorInfo(ind, info); } }); diff --git a/runtime/onert/core/src/compiler/ExecutorFactory.cc b/runtime/onert/core/src/compiler/ExecutorFactory.cc index 3cbe5f670eb..f8f9e6e39ad 100644 --- a/runtime/onert/core/src/compiler/ExecutorFactory.cc +++ b/runtime/onert/core/src/compiler/ExecutorFactory.cc @@ -169,9 +169,6 @@ createBackendContexts(compiler::ILoweredGraph &lgraph, bool linear_executor, init_context_data(backend); auto &partial_graph = *context_data_map[backend].graph; - auto &operand_layouts = context_data_map[backend].operand_layouts; - assert(operand_layouts.find(operand_ind) == operand_layouts.end()); - operand_layouts[operand_ind] = ir::Layout::NHWC; // Copy the operand and insert it to the partial graph auto new_operand = std::make_unique(operand); @@ -191,7 +188,6 @@ createBackendContexts(compiler::ILoweredGraph &lgraph, bool linear_executor, auto &partial_graph = *context_data_map[backend].graph; auto &external_operands = context_data_map[backend].external_operands; - auto &operand_layouts = context_data_map[backend].operand_layouts; { // Add missing operands (externals) @@ -210,8 +206,6 @@ createBackendContexts(compiler::ILoweredGraph &lgraph, bool linear_executor, UNUSED_RELEASE(new_operand_ind); assert(new_operand_ind == operand_ind); - assert(operand_layouts.find(operand_ind) == operand_layouts.end()); - operand_layouts[operand_ind] = ir::Layout::NHWC; external_operands.add(operand_ind); } @@ -708,7 +702,6 @@ exec::IExecutor *ExecutorFactory::createTrainableExecutor( tdata.tgraph = std::move(tgraph); tdata.op_order = std::move(data.op_order); tdata.external_operands = std::move(external_operands); - tdata.operand_layouts = std::move(data.operand_layouts); tdata.custom_kernel_builder = std::move(data.custom_kernel_builder); tdata.is_linear_executor = data.is_linear_executor; tdata.optim_info = training_info.optimizerInfo();