aboutsummaryrefslogtreecommitdiff
path: root/src/backends/neon/NeonLayerSupport.cpp
diff options
context:
space:
mode:
authorTeresa Charlin <teresa.charlinreyes@arm.com>2023-08-17 18:44:58 +0100
committerTeresa Charlin <teresa.charlinreyes@arm.com>2023-08-28 12:37:25 +0100
commit9145e38edf49fa4862008c163c34590141eecb14 (patch)
tree64706ef579f548b804d5b674b33f6b239c638d0f /src/backends/neon/NeonLayerSupport.cpp
parente40cc8359b02a7786908294300c45b672cf6b0e4 (diff)
downloadarmnn-9145e38edf49fa4862008c163c34590141eecb14.tar.gz
IVGCVSW-7505 Create FusedLayer and NeonFusedWorkload for AddMulAdd Neon kernel
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com> Change-Id: Ic778d35b001474b44fb1e433a6fe276e4ec9f565
Diffstat (limited to 'src/backends/neon/NeonLayerSupport.cpp')
-rw-r--r--src/backends/neon/NeonLayerSupport.cpp54
1 files changed, 41 insertions, 13 deletions
diff --git a/src/backends/neon/NeonLayerSupport.cpp b/src/backends/neon/NeonLayerSupport.cpp
index b491ba8493..ef1d21835a 100644
--- a/src/backends/neon/NeonLayerSupport.cpp
+++ b/src/backends/neon/NeonLayerSupport.cpp
@@ -4,7 +4,6 @@
//
#include "NeonLayerSupport.hpp"
-#include "NeonBackendId.hpp"
#include "NeonBackendModelContext.hpp"
#include <armnn/Exceptions.hpp>
@@ -12,7 +11,6 @@
#include <armnn/Types.hpp>
#include <armnn/BackendRegistry.hpp>
-#include <InternalTypes.hpp>
#include <LayerSupportCommon.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
#include <armnn/utility/PolymorphicDowncast.hpp>
@@ -39,8 +37,13 @@
#include "workloads/NeonDepthToSpaceWorkload.hpp"
#include "workloads/NeonDepthwiseConvolutionWorkload.hpp"
#include "workloads/NeonDequantizeWorkload.hpp"
+#include "workloads/NeonDivisionWorkload.hpp"
#include "workloads/NeonElementwiseBinaryWorkload.hpp"
#include "workloads/NeonExpWorkload.hpp"
+#include "workloads/NeonFullyConnectedWorkload.hpp"
+#include "workloads/NeonFusedWorkload.hpp"
+#include "workloads/NeonGatherWorkload.hpp"
+#include "workloads/NeonGatherNdWorkload.hpp"
#include "workloads/NeonInstanceNormalizationWorkload.hpp"
#include "workloads/NeonL2NormalizationFloatWorkload.hpp"
#include "workloads/NeonLogWorkload.hpp"
@@ -53,12 +56,8 @@
#include "workloads/NeonMeanWorkload.hpp"
#include "workloads/NeonMinimumWorkload.hpp"
#include "workloads/NeonMultiplicationWorkload.hpp"
-#include "workloads/NeonDivisionWorkload.hpp"
#include "workloads/NeonNegWorkload.hpp"
#include "workloads/NeonNormalizationFloatWorkload.hpp"
-#include "workloads/NeonFullyConnectedWorkload.hpp"
-#include "workloads/NeonGatherWorkload.hpp"
-#include "workloads/NeonGatherNdWorkload.hpp"
#include "workloads/NeonPadWorkload.hpp"
#include "workloads/NeonPermuteWorkload.hpp"
#include "workloads/NeonPooling2dWorkload.hpp"
@@ -128,13 +127,13 @@ bool IsSupportedForDataTypeNeon(Optional<std::string&> reasonIfUnsupported,
{
return IsNeonBackendSupported(reasonIfUnsupported) &&
IsSupportedForDataTypeGeneric(reasonIfUnsupported,
- dataType,
- floatFuncPtr,
- floatFuncPtr,
- uint8FuncPtr,
- &FalseFunc<>,
- &FalseFunc<>,
- std::forward<Params>(params)...);
+ dataType,
+ floatFuncPtr,
+ floatFuncPtr,
+ uint8FuncPtr,
+ &FalseFunc<>,
+ &FalseFunc<>,
+ std::forward<Params>(params)...);
}
#if defined(ARMCOMPUTENEON_ENABLED)
@@ -430,6 +429,22 @@ bool IsLayerTypeSupported(const LayerType& type,
*(PolymorphicDowncast<const
FullyConnectedDescriptor*>(&descriptor)),
reasonIfUnsupported);
+ case LayerType::Fused:
+ {
+ auto fusedDescriptor = *(PolymorphicDowncast<const FusedDescriptor*>(&descriptor));
+ if (fusedDescriptor.m_NumInputSlots + fusedDescriptor.m_NumOutputSlots != infos.size())
+ {
+ throw InvalidArgumentException("Invalid number of FusedLayer TensorInfos.");
+ }
+
+ std::vector<TensorInfo> inputInfos(infos.begin(), infos.begin() + fusedDescriptor.m_NumInputSlots);
+ std::vector<TensorInfo> outputInfos(infos.begin() + fusedDescriptor.m_NumInputSlots, infos.end());
+
+ return support.IsFusedSupported({inputInfos.begin(), inputInfos.end()},
+ {outputInfos.begin(), outputInfos.end()},
+ fusedDescriptor,
+ reasonIfUnsupported);
+ }
case LayerType::Gather:
return support.IsGatherSupported(infos[0],
infos[1],
@@ -1155,6 +1170,19 @@ bool NeonLayerSupport::IsFullyConnectedSupported(const TensorInfo& input,
nullptr);
}
+bool NeonLayerSupport::IsFusedSupported(const std::vector<std::reference_wrapper<TensorInfo>>& inputs,
+ const std::vector<std::reference_wrapper<TensorInfo>>& outputs,
+ const FusedDescriptor& descriptor,
+ Optional<std::string&> reasonIfUnsupported) const
+{
+ FORWARD_WORKLOAD_VALIDATE_FUNC(NeonFusedWorkloadValidate,
+ reasonIfUnsupported,
+ inputs,
+ outputs,
+ descriptor,
+ nullptr);
+}
+
bool NeonLayerSupport::IsGatherSupported(const TensorInfo& input0,
const TensorInfo& input1,
const TensorInfo& output,