aboutsummaryrefslogtreecommitdiff
path: root/src/backends/cl/ClLayerSupport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/cl/ClLayerSupport.cpp')
-rw-r--r--src/backends/cl/ClLayerSupport.cpp33
1 files changed, 31 insertions, 2 deletions
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 <armnn/utility/IgnoreUnused.hpp>
#include <armnn/Descriptors.hpp>
#include <armnn/BackendRegistry.hpp>
#include <InternalTypes.hpp>
#include <LayerSupportCommon.hpp>
+#include <armnn/utility/IgnoreUnused.hpp>
+#include <armnn/utility/PolymorphicDowncast.hpp>
+
#if defined(ARMCOMPUTECL_ENABLED)
#include <aclCommon/ArmComputeUtils.hpp>
#include <aclCommon/ArmComputeTensorUtils.hpp>
@@ -155,6 +158,16 @@ bool IsSupportedForDataTypeCl(Optional<std::string&> 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<std::string&> reasonIfUnsupported) const
@@ -322,13 +335,29 @@ bool ClLayerSupport::IsConvolution2dSupported(const TensorInfo& input,
const Optional<TensorInfo>& biases,
Optional<std::string&> reasonIfUnsupported) const
{
+ bool isFastMathEnabled = false;
+#if defined(ARMCOMPUTECL_ENABLED)
+ if (m_ModelContextPtr)
+ {
+ if (m_ModelContextPtr.get() != nullptr)
+ {
+ auto modelOptions = dynamic_cast<ClBackendModelContext*>(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,