From: 오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 8 Nov 2018 02:44:39 +0000 (+0900) Subject: Concat elimination in codegen (#3518) X-Git-Tag: 0.3~447 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5190dd46a253904e0f304179a88019221ce92a42;p=platform%2Fcore%2Fml%2Fnnfw.git Concat elimination in codegen (#3518) Concat elimination in codegen: check output tensor is parent of inputs and do nothing if true Signed-off-by: Hyeongseok Oh --- diff --git a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc index b8e5181..b173d5a 100644 --- a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc +++ b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc @@ -400,6 +400,22 @@ Stage StageGenerator::generate(const graph::operation::ConcatNode &node) auto tensors = _tensor_builder; return [tensors, param](IExecutionBuilder &builder) { + // If tensor allocator allocate as subtensor + bool canEliminate = true; + for (auto ifm_ind : param.input_indexes) + { + if (!tensors->isSubTensorOf(param.output_index, ifm_ind)) + { + canEliminate = false; + break; + } + } + if (canEliminate) + { + // If concat eliminated, return with nothing to do + return; + } + auto output_alloc = tensors->at(param.output_index).get(); std::vector<::arm_compute::ICLTensor *> input_allocs;