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