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/cl/ClLayerSupport.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/backends/cl/ClLayerSupport.cpp') diff --git a/src/backends/cl/ClLayerSupport.cpp b/src/backends/cl/ClLayerSupport.cpp index 1af5c91fc5..7c1466e0e1 100644 --- a/src/backends/cl/ClLayerSupport.cpp +++ b/src/backends/cl/ClLayerSupport.cpp @@ -5,14 +5,17 @@ #include "ClLayerSupport.hpp" #include "ClBackendId.hpp" +#include "ClBackendModelContext.hpp" -#include #include #include #include #include +#include +#include + #if defined(ARMCOMPUTECL_ENABLED) #include #include @@ -155,6 +158,16 @@ bool IsSupportedForDataTypeCl(Optional reasonIfUnsupported, } } // anonymous namespace +ClLayerSupport::ClLayerSupport(const IBackendInternal::IBackendSpecificModelContextPtr& modelContextPtr) + : m_ModelContextPtr(modelContextPtr) +{ +} + +ClLayerSupport::ClLayerSupport() + : m_ModelContextPtr(nullptr) +{ +} + bool ClLayerSupport::IsAbsSupported(const TensorInfo& input, const TensorInfo& output, Optional reasonIfUnsupported) const @@ -322,13 +335,29 @@ bool ClLayerSupport::IsConvolution2dSupported(const TensorInfo& input, const Optional& biases, Optional reasonIfUnsupported) const { + bool isFastMathEnabled = false; +#if defined(ARMCOMPUTECL_ENABLED) + if (m_ModelContextPtr) + { + if (m_ModelContextPtr.get() != nullptr) + { + auto modelOptions = dynamic_cast(m_ModelContextPtr.get()); + if (modelOptions) + { + isFastMathEnabled = modelOptions->IsFastMathEnabled(); + } + } + } +#endif + FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvolution2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor, weights, - biases); + biases, + isFastMathEnabled); } bool ClLayerSupport::IsDequantizeSupported(const TensorInfo& input, -- cgit v1.2.1