From 0d2f07f31edc1e96e6c7398653065baceb0d13ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ivan=20Vagin/AI=20Tools=20Lab=20/SRR/Engineer/=EC=82=BC?= =?utf8?q?=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 23 Jan 2019 23:57:29 +0300 Subject: [PATCH] [nnc] Allocate ACL elementwise op output and temporary tensors (#2914) Allocate ACL elementwise op output and temporary tensors Signed-off-by: Ivan Vagin --- contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp b/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp index 8f69740..a93af66 100644 --- a/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp +++ b/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp @@ -637,6 +637,7 @@ void AclCppOpGenerator::visit(ops::TanhOp& op) { void AclCppOpGenerator::visit(ops::ElementwiseOp& op) { // Create the output tensor in the DOM and obtain its identifier. auto out = genTensor(op, op.getOutputShape(0)); + addToPersistentTensors(out); auto& prev_nodes = op.getPrevNodes(); assert(prev_nodes.size() >= 2); @@ -675,11 +676,11 @@ void AclCppOpGenerator::visit(ops::DeConv2DOp& op) { } void AclCppOpGenerator::visit(ops::EluOp&) { - throw AclCppException("Not supported by the ACL library yet."); + throw AclCppException("EluOp not supported by the ACL library yet."); } void AclCppOpGenerator::visit(ops::PadOp&) { - throw AclCppException("Not supported by the ACL library yet."); + throw AclCppException("PadOp not supported by the ACL library yet."); } template @@ -832,12 +833,14 @@ shared_ptr AclCppOpGenerator::genMultiplication(const string& prefix // Create a unit tensor in the DOM. auto unit = genTensor(operation_name + "_unit", ir_unit_shape); + addToPersistentTensors(unit); // Fill the unit tensor with the 1 value. fillTensor(unit, "1"); // Create a tmp tensor in the DOM to store the result of 1 / in2. auto tmp = genTensor(operation_name + "_tmp", ir_shape); + genTensorAllocation(_infBlock, tmp); // Create an instance of the CLArithmeticDivision class as a member of the artifact class. auto arithmetic_div_layer_var1 = _artifactClass->var(false, "arm_compute::CLArithmeticDivision", @@ -863,6 +866,8 @@ shared_ptr AclCppOpGenerator::genMultiplication(const string& prefix // Generate the call: arithmetic_div_layer2.run(); _infBlock->call("run", {}, arithmetic_div_layer2); + genTensorDeallocation(_infBlock, tmp); + return out; } -- 2.7.4