2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
7 #include <armnn/Optional.hpp>
8 #include <backends/OutputHandler.hpp>
9 #include <backends/aclCommon/memory/BaseMemoryManager.hpp>
11 #include <boost/core/ignore_unused.hpp>
17 // Neon workload factory.
18 class NeonWorkloadFactory : public IWorkloadFactory
21 NeonWorkloadFactory();
23 const BackendId& GetBackendId() const override;
25 static bool IsLayerSupported(const Layer& layer,
26 Optional<DataType> dataType,
27 std::string& outReasonIfUnsupported);
29 virtual bool SupportsSubTensors() const override { return true; }
31 virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
32 TensorShape const& subTensorShape,
33 unsigned int const* subTensorOrigin) const override;
35 virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
37 virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
38 DataLayout dataLayout) const override;
40 virtual std::unique_ptr<IWorkload> CreateInput(const InputQueueDescriptor& descriptor,
41 const WorkloadInfo& info) const override;
43 virtual std::unique_ptr<IWorkload> CreateOutput(const OutputQueueDescriptor& descriptor,
44 const WorkloadInfo& info) const override;
46 virtual std::unique_ptr<IWorkload> CreateActivation(const ActivationQueueDescriptor& descriptor,
47 const WorkloadInfo& info) const override;
49 virtual std::unique_ptr<IWorkload> CreateSoftmax(const SoftmaxQueueDescriptor& descriptor,
50 const WorkloadInfo& info) const override;
52 virtual std::unique_ptr<IWorkload> CreateSplitter(const SplitterQueueDescriptor& descriptor,
53 const WorkloadInfo& info) const override;
55 virtual std::unique_ptr<IWorkload> CreateMerger(const MergerQueueDescriptor& descriptor,
56 const WorkloadInfo& info) const override;
58 virtual std::unique_ptr<IWorkload> CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor,
59 const WorkloadInfo& info) const override;
61 virtual std::unique_ptr<IWorkload> CreatePermute(const PermuteQueueDescriptor& descriptor,
62 const WorkloadInfo& info) const override;
64 virtual std::unique_ptr<IWorkload> CreatePooling2d(const Pooling2dQueueDescriptor& descriptor,
65 const WorkloadInfo& info) const override;
67 virtual std::unique_ptr<IWorkload> CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor,
68 const WorkloadInfo& info) const override;
70 virtual std::unique_ptr<IWorkload> CreateDepthwiseConvolution2d(
71 const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const override;
73 virtual std::unique_ptr<IWorkload> CreateNormalization(const NormalizationQueueDescriptor& descriptor,
74 const WorkloadInfo& info) const override;
76 virtual std::unique_ptr<IWorkload> CreateMultiplication(const MultiplicationQueueDescriptor& descriptor,
77 const WorkloadInfo& info) const override;
79 virtual std::unique_ptr<IWorkload> CreateAddition(const AdditionQueueDescriptor& descriptor,
80 const WorkloadInfo& info) const override;
82 virtual std::unique_ptr<IWorkload> CreateBatchNormalization(const BatchNormalizationQueueDescriptor& descriptor,
83 const WorkloadInfo& info) const override;
85 virtual std::unique_ptr<IWorkload> CreateMemCopy(const MemCopyQueueDescriptor& descriptor,
86 const WorkloadInfo& info) const override;
88 virtual std::unique_ptr<IWorkload> CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor,
89 const WorkloadInfo& info) const override;
91 virtual std::unique_ptr<IWorkload> CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor,
92 const WorkloadInfo& info) const override;
94 virtual std::unique_ptr<IWorkload> CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor,
95 const WorkloadInfo& info) const override;
97 virtual std::unique_ptr<IWorkload> CreateConstant(const ConstantQueueDescriptor& descriptor,
98 const WorkloadInfo& info) const override;
100 virtual std::unique_ptr<IWorkload> CreateReshape(const ReshapeQueueDescriptor& descriptor,
101 const WorkloadInfo& info) const override;
103 virtual std::unique_ptr<IWorkload> CreateSpaceToBatchNd(const SpaceToBatchNdQueueDescriptor& descriptor,
104 const WorkloadInfo& info) const override;
106 virtual std::unique_ptr<IWorkload> CreateFloor(const FloorQueueDescriptor& descriptor,
107 const WorkloadInfo& info) const override;
109 virtual std::unique_ptr<IWorkload> CreateLstm(const LstmQueueDescriptor& descriptor,
110 const WorkloadInfo& info) const override;
112 virtual std::unique_ptr<IWorkload> CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor,
113 const WorkloadInfo& info) const override;
115 virtual std::unique_ptr<IWorkload> CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor,
116 const WorkloadInfo& info) const override;
118 virtual std::unique_ptr<IWorkload> CreateDivision(const DivisionQueueDescriptor& descriptor,
119 const WorkloadInfo& info) const override;
121 virtual std::unique_ptr<IWorkload> CreateSubtraction(const SubtractionQueueDescriptor& descriptor,
122 const WorkloadInfo& info) const override;
124 virtual std::unique_ptr<IWorkload> CreateMean(const MeanQueueDescriptor& descriptor,
125 const WorkloadInfo& Info) const override;
127 virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
128 const WorkloadInfo& info) const override;
130 virtual void Finalize() override;
132 virtual void Release() override;
134 virtual void Acquire() override;
137 #ifdef ARMCOMPUTENEON_ENABLED
138 mutable NeonMemoryManager m_MemoryManager;