From 045f6be924240a560293a3a7a0ecae49bcf0d1fa Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Thu, 10 Sep 2020 13:37:32 +0100 Subject: IVGCVSW-5156 Introduce ModelOptions to OptimizedNetwork * Introduced ModelOptions to IBackendInternal * Introduced ModelOptions to Network * Added FastMathEnabled parameter to Conv2d Validate function in CL and NEON * Added Optimizer tests Signed-off-by: Ryan OShea Signed-off-by: Sadik Armagan Change-Id: Ib54c1e82cb3d89a52756ed499cf91b6a7fdb2063 --- src/backends/neon/NeonLayerSupport.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/backends/neon/NeonLayerSupport.cpp') diff --git a/src/backends/neon/NeonLayerSupport.cpp b/src/backends/neon/NeonLayerSupport.cpp index 9dc8a01778..853a518b45 100644 --- a/src/backends/neon/NeonLayerSupport.cpp +++ b/src/backends/neon/NeonLayerSupport.cpp @@ -5,6 +5,7 @@ #include "NeonLayerSupport.hpp" #include "NeonBackendId.hpp" +#include "NeonBackendModelContext.hpp" #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #if defined(ARMCOMPUTENEON_ENABLED) #include @@ -125,6 +127,16 @@ inline bool IsWorkloadSupported(FuncType& func, Optional reasonIfU #endif } // anonymous namespace +NeonLayerSupport::NeonLayerSupport(const IBackendInternal::IBackendSpecificModelContextPtr& modelContextPtr) + : m_ModelContextPtr(modelContextPtr) +{ +} + +NeonLayerSupport::NeonLayerSupport() + : m_ModelContextPtr(nullptr) +{ +} + bool NeonLayerSupport::IsAbsSupported(const TensorInfo& input, const TensorInfo& output, Optional reasonIfUnsupported) const @@ -311,13 +323,29 @@ bool NeonLayerSupport::IsConvolution2dSupported(const TensorInfo& input, const Optional& biases, Optional reasonIfUnsupported) const { + bool isFastMathEnabled = false; +#if defined(ARMCOMPUTENEON_ENABLED) + if (m_ModelContextPtr) + { + if (m_ModelContextPtr.get() != nullptr) + { + auto modelOptions = armnn::PolymorphicDowncast(m_ModelContextPtr.get()); + if (modelOptions) + { + isFastMathEnabled = modelOptions->IsFastMathEnabled(); + } + } + } +#endif + FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvolution2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor, weights, - biases); + biases, + isFastMathEnabled); } bool NeonLayerSupport::IsDepthToSpaceSupported(const TensorInfo& input, -- cgit v1.2.1