summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>2019-09-03 08:11:22 (GMT)
committerChunseok Lee <chunseok.lee@samsung.com>2019-09-04 02:09:54 (GMT)
commit4c60b91490e144a7a43468e8421eb25e79e7b4db (patch)
tree454ff72a14045297328fb386377fa72446557617
parentf3ee35eb8d04aefa52cef46dc52a8a09cf8f1f4d (diff)
downloadnnfw-tizen_5.5_m2_bak.zip
nnfw-tizen_5.5_m2_bak.tar.gz
nnfw-tizen_5.5_m2_bak.tar.bz2
Enable acl neon backend mul operation (#7105)submit/tizen/20190904.021009tizen_5.5_m2_bak
Update acl neon backend ShapeFixer's mul Remove exception in kernel generator for mul Change-Id: I3a104694e3ded74b1ac9a5cea013e65a47f0476d Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com> Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
-rw-r--r--runtimes/neurun/backend/acl_neon/KernelGenerator.cc6
-rw-r--r--runtimes/neurun/backend/acl_neon/ShapeFixer.cc14
-rw-r--r--tests/nnapi/nnapi_gtest.skip.armv7l-linux.acl_neon1
3 files changed, 6 insertions, 15 deletions
diff --git a/runtimes/neurun/backend/acl_neon/KernelGenerator.cc b/runtimes/neurun/backend/acl_neon/KernelGenerator.cc
index 9da0139..9e86783 100644
--- a/runtimes/neurun/backend/acl_neon/KernelGenerator.cc
+++ b/runtimes/neurun/backend/acl_neon/KernelGenerator.cc
@@ -598,9 +598,6 @@ void KernelGenerator::visit(const model::operation::FullyConnectedNode &node)
void KernelGenerator::visit(const model::operation::MulNode &node)
{
- // TODO: fix, tests are failing
- throw std::runtime_error("NYI");
-
const auto ofm_index{node.getOutputs().at(0)};
const auto lhs_index{node.getInputs().at(model::operation::MulNode::Input::LHS)};
const auto rhs_index{node.getInputs().at(model::operation::MulNode::Input::RHS)};
@@ -615,8 +612,9 @@ void KernelGenerator::visit(const model::operation::MulNode &node)
auto l = nnfw::cpp14::make_unique<::arm_compute::NEPixelWiseMultiplication>();
+ // RoundingPolicy for scale:1.0 is only allowed RoundingPolicy::TO_ZERO
l->configure(lhs_alloc->handle(), rhs_alloc->handle(), ofm_alloc->handle(), 1.0, // scale
- arm_compute::ConvertPolicy::SATURATE, arm_compute::RoundingPolicy::TO_NEAREST_EVEN);
+ arm_compute::ConvertPolicy::SATURATE, arm_compute::RoundingPolicy::TO_ZERO);
fn = std::move(l);
diff --git a/runtimes/neurun/backend/acl_neon/ShapeFixer.cc b/runtimes/neurun/backend/acl_neon/ShapeFixer.cc
index 90753c6..7901ba0 100644
--- a/runtimes/neurun/backend/acl_neon/ShapeFixer.cc
+++ b/runtimes/neurun/backend/acl_neon/ShapeFixer.cc
@@ -105,17 +105,11 @@ void ShapeFixer::visit(const model::operation::MulNode &node)
{
const auto broadcast_rank =
std::max(_ctx.at(lhs_index).shape().rank(), _ctx.at(rhs_index).shape().rank());
- auto lhs_shape = _ctx.at(lhs_index).shape();
- auto rhs_shape = _ctx.at(rhs_index).shape();
- lhs_shape.extendRank(broadcast_rank);
- rhs_shape.extendRank(broadcast_rank);
- }
-
- // Nontrivial broadcasting isn't supported yet
- if (!(_ctx.at(lhs_index).shape() == _ctx.at(rhs_index).shape()))
- {
- throw std::runtime_error("NYI");
+ // TODO remove const_cast later. For example, _ctx may need to be a non const variable or
+ // a node to extend shape may be inserted in front of this operation
+ const_cast<::neurun::model::Shape &>(_ctx.at(lhs_index).shape()).extendRank(broadcast_rank);
+ const_cast<::neurun::model::Shape &>(_ctx.at(rhs_index).shape()).extendRank(broadcast_rank);
}
}
diff --git a/tests/nnapi/nnapi_gtest.skip.armv7l-linux.acl_neon b/tests/nnapi/nnapi_gtest.skip.armv7l-linux.acl_neon
index 86daa12..be5a45a 100644
--- a/tests/nnapi/nnapi_gtest.skip.armv7l-linux.acl_neon
+++ b/tests/nnapi/nnapi_gtest.skip.armv7l-linux.acl_neon
@@ -20,7 +20,6 @@ GeneratedTests.logistic*
GeneratedTests.lsh_projection*
GeneratedTests.lstm*
GeneratedTests.mobilenet*
-GeneratedTests.mul*
GeneratedTests.neg*
GeneratedTests.notequal*
GeneratedTests.prelu_ex*