IVGCVSW-2006: Move ACL memory manager source code under aclCommon
[platform/upstream/armnn.git] / src / backends / neon / NeonWorkloadFactory.hpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6
7 #include <backends/OutputHandler.hpp>
8 #include <backends/aclCommon/memory/BaseMemoryManager.hpp>
9
10 #include <boost/core/ignore_unused.hpp>
11 #include <boost/optional.hpp>
12
13 namespace armnn
14 {
15
16 // Neon workload factory.
17 class NeonWorkloadFactory : public IWorkloadFactory
18 {
19 public:
20     NeonWorkloadFactory();
21
22     virtual Compute GetCompute() const override { return Compute::CpuAcc; }
23
24     static bool IsLayerSupported(const Layer& layer, boost::optional<DataType> dataType,
25                                  std::string& outReasonIfUnsupported);
26
27     virtual bool SupportsSubTensors() const override { return true; }
28
29     virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
30                                                                  TensorShape const& subTensorShape,
31                                                                  unsigned int const* subTensorOrigin) const override;
32
33     virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
34
35     virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
36                                                               DataLayout dataLayout) const override;
37
38     virtual std::unique_ptr<IWorkload> CreateInput(const InputQueueDescriptor& descriptor,
39                                                    const WorkloadInfo&        info) const override;
40
41     virtual std::unique_ptr<IWorkload> CreateOutput(const OutputQueueDescriptor& descriptor,
42                                                     const WorkloadInfo&        info) const override;
43
44     virtual std::unique_ptr<IWorkload> CreateActivation(const ActivationQueueDescriptor& descriptor,
45                                                         const WorkloadInfo&              info) const override;
46
47     virtual std::unique_ptr<IWorkload> CreateSoftmax(const SoftmaxQueueDescriptor& descriptor,
48                                                      const WorkloadInfo&           info) const override;
49
50     virtual std::unique_ptr<IWorkload> CreateSplitter(const SplitterQueueDescriptor& descriptor,
51                                                       const WorkloadInfo&            info) const override;
52
53     virtual std::unique_ptr<IWorkload> CreateMerger(const MergerQueueDescriptor& descriptor,
54                                                     const WorkloadInfo&          info) const override;
55
56     virtual std::unique_ptr<IWorkload> CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor,
57                                                             const WorkloadInfo&                  info) const override;
58
59     virtual std::unique_ptr<IWorkload> CreatePermute(const PermuteQueueDescriptor& descriptor,
60                                                      const WorkloadInfo&           info) const override;
61
62     virtual std::unique_ptr<IWorkload> CreatePooling2d(const Pooling2dQueueDescriptor& descriptor,
63                                                        const WorkloadInfo&           info) const override;
64
65     virtual std::unique_ptr<IWorkload> CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor,
66                                                            const WorkloadInfo&               info) const override;
67
68     virtual std::unique_ptr<IWorkload> CreateDepthwiseConvolution2d(
69         const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const override;
70
71     virtual std::unique_ptr<IWorkload> CreateNormalization(const NormalizationQueueDescriptor& descriptor,
72                                                            const WorkloadInfo&                 info) const override;
73
74     virtual std::unique_ptr<IWorkload> CreateMultiplication(const MultiplicationQueueDescriptor& descriptor,
75                                                             const WorkloadInfo&                  info) const override;
76
77     virtual std::unique_ptr<IWorkload> CreateAddition(const AdditionQueueDescriptor& descriptor,
78                                                       const WorkloadInfo&            info) const override;
79
80     virtual std::unique_ptr<IWorkload> CreateBatchNormalization(const BatchNormalizationQueueDescriptor& descriptor,
81                                                                 const WorkloadInfo& info) const override;
82
83     virtual std::unique_ptr<IWorkload> CreateMemCopy(const MemCopyQueueDescriptor& descriptor,
84                                                      const WorkloadInfo&        info) const override;
85
86     virtual std::unique_ptr<IWorkload> CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor,
87                                                             const WorkloadInfo& info) const override;
88
89     virtual std::unique_ptr<IWorkload> CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor,
90                                                               const WorkloadInfo& info) const override;
91
92     virtual std::unique_ptr<IWorkload> CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor,
93                                                              const WorkloadInfo& info) const override;
94
95     virtual std::unique_ptr<IWorkload> CreateConstant(const ConstantQueueDescriptor& descriptor,
96                                                       const WorkloadInfo& info) const override;
97
98     virtual std::unique_ptr<IWorkload> CreateReshape(const ReshapeQueueDescriptor& descriptor,
99                                                      const WorkloadInfo& info) const override;
100
101     virtual std::unique_ptr<IWorkload> CreateFloor(const FloorQueueDescriptor& descriptor,
102                                                    const WorkloadInfo& info) const override;
103
104     virtual std::unique_ptr<IWorkload> CreateLstm(const LstmQueueDescriptor& descriptor,
105                                                   const WorkloadInfo& info) const override;
106
107     virtual std::unique_ptr<IWorkload> CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor,
108                                                                const WorkloadInfo& info) const override;
109
110     virtual std::unique_ptr<IWorkload> CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor,
111                                                                const WorkloadInfo& info) const override;
112
113     virtual std::unique_ptr<IWorkload> CreateDivision(const DivisionQueueDescriptor& descriptor,
114                                                       const WorkloadInfo& info) const override;
115
116     virtual std::unique_ptr<IWorkload> CreateSubtraction(const SubtractionQueueDescriptor& descriptor,
117                                                          const WorkloadInfo& info) const override;
118
119     virtual std::unique_ptr<IWorkload> CreateMean(const MeanQueueDescriptor& descriptor,
120                                                   const WorkloadInfo& Info) const override;
121
122     virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
123                                                  const WorkloadInfo& info) const override;
124
125     virtual void Finalize() override;
126
127     virtual void Release() override;
128
129     virtual void Acquire() override;
130
131 private:
132 #ifdef ARMCOMPUTENEON_ENABLED
133     mutable NeonMemoryManager m_MemoryManager;
134 #endif
135 };
136
137 } //namespace armnn