telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | #pragma once |
| 6 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 7 | #include <armnn/Optional.hpp> |
Aron Virginas-Tar | 6057895 | 2018-10-31 11:04:01 +0000 | [diff] [blame] | 8 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 9 | #include <backendsCommon/OutputHandler.hpp> |
Aron Virginas-Tar | 6057895 | 2018-10-31 11:04:01 +0000 | [diff] [blame] | 10 | #include <aclCommon/BaseMemoryManager.hpp> |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 11 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 12 | #include <boost/core/ignore_unused.hpp> |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 13 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 14 | namespace armnn |
| 15 | { |
| 16 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 17 | // Neon workload factory. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 18 | class NeonWorkloadFactory : public IWorkloadFactory |
| 19 | { |
| 20 | public: |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 21 | NeonWorkloadFactory(const std::shared_ptr<NeonMemoryManager>& memoryManager); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 22 | |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 23 | const BackendId& GetBackendId() const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 24 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 25 | static bool IsLayerSupported(const Layer& layer, |
| 26 | Optional<DataType> dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 27 | std::string& outReasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 28 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 29 | bool SupportsSubTensors() const override { return true; } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 30 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 31 | std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent, |
| 32 | TensorShape const& subTensorShape, |
| 33 | unsigned int const* subTensorOrigin) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 34 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 35 | std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 36 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 37 | std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo, |
| 38 | DataLayout dataLayout) const override; |
Francis Murtagh | 351d13d | 2018-09-24 15:01:18 +0100 | [diff] [blame] | 39 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 40 | std::unique_ptr<IWorkload> CreateInput(const InputQueueDescriptor& descriptor, |
| 41 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 42 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 43 | std::unique_ptr<IWorkload> CreateOutput(const OutputQueueDescriptor& descriptor, |
| 44 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 45 | |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 46 | std::unique_ptr<IWorkload> CreateAbs(const AbsQueueDescriptor& descriptor, |
| 47 | const WorkloadInfo& info) const override; |
| 48 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 49 | std::unique_ptr<IWorkload> CreateActivation(const ActivationQueueDescriptor& descriptor, |
| 50 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 51 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 52 | std::unique_ptr<IWorkload> CreateSoftmax(const SoftmaxQueueDescriptor& descriptor, |
| 53 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 54 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 55 | std::unique_ptr<IWorkload> CreateSplitter(const SplitterQueueDescriptor& descriptor, |
| 56 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 57 | |
Jim Flynn | 4ed6c83 | 2019-05-20 11:02:46 +0100 | [diff] [blame] | 58 | ARMNN_DEPRECATED_MSG("Use CreateConcat instead") |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 59 | std::unique_ptr<IWorkload> CreateMerger(const MergerQueueDescriptor& descriptor, |
| 60 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 61 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 62 | std::unique_ptr<IWorkload> CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor, |
| 63 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 64 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 65 | std::unique_ptr<IWorkload> CreatePermute(const PermuteQueueDescriptor& descriptor, |
| 66 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 67 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 68 | std::unique_ptr<IWorkload> CreatePooling2d(const Pooling2dQueueDescriptor& descriptor, |
| 69 | const WorkloadInfo& info) const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 70 | |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 71 | std::unique_ptr<IWorkload> CreatePrelu(const PreluQueueDescriptor& descriptor, |
| 72 | const WorkloadInfo& info) const override; |
| 73 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 74 | std::unique_ptr<IWorkload> CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 75 | const WorkloadInfo& info) const override; |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 76 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 77 | std::unique_ptr<IWorkload> CreateDepthwiseConvolution2d(const DepthwiseConvolution2dQueueDescriptor& descriptor, |
| 78 | const WorkloadInfo& info) const override; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 79 | |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 80 | std::unique_ptr<IWorkload> CreateDequantize(const DequantizeQueueDescriptor& descriptor, |
| 81 | const WorkloadInfo& info) const override; |
| 82 | |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 83 | std::unique_ptr<IWorkload> CreateDetectionPostProcess(const DetectionPostProcessQueueDescriptor& descriptor, |
| 84 | const WorkloadInfo& info) const override; |
| 85 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 86 | std::unique_ptr<IWorkload> CreateNormalization(const NormalizationQueueDescriptor& descriptor, |
| 87 | const WorkloadInfo& info) const override; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 88 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 89 | std::unique_ptr<IWorkload> CreateMultiplication(const MultiplicationQueueDescriptor& descriptor, |
| 90 | const WorkloadInfo& info) const override; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 91 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 92 | std::unique_ptr<IWorkload> CreateAddition(const AdditionQueueDescriptor& descriptor, |
| 93 | const WorkloadInfo& info) const override; |
| 94 | |
| 95 | std::unique_ptr<IWorkload> CreateBatchNormalization(const BatchNormalizationQueueDescriptor& descriptor, |
| 96 | const WorkloadInfo& info) const override; |
| 97 | |
| 98 | std::unique_ptr<IWorkload> CreateMemCopy(const MemCopyQueueDescriptor& descriptor, |
| 99 | const WorkloadInfo& info) const override; |
| 100 | |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 101 | std::unique_ptr<IWorkload> CreateMemImport(const MemImportQueueDescriptor& descriptor, |
| 102 | const WorkloadInfo& info) const override; |
| 103 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 104 | std::unique_ptr<IWorkload> CreateResize(const ResizeQueueDescriptor& descriptor, |
| 105 | const WorkloadInfo& info) const override; |
| 106 | |
| 107 | ARMNN_DEPRECATED_MSG("Use CreateResize instead") |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 108 | std::unique_ptr<IWorkload> CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor, |
| 109 | const WorkloadInfo& info) const override; |
| 110 | |
Sadik Armagan | cd5571c | 2019-05-31 10:19:03 +0100 | [diff] [blame] | 111 | std::unique_ptr<IWorkload> CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor, |
| 112 | const WorkloadInfo& info) const override; |
| 113 | |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 114 | std::unique_ptr<IWorkload> CreateQuantize(const QuantizeQueueDescriptor& descriptor, |
| 115 | const WorkloadInfo& info) const override; |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 116 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 117 | std::unique_ptr<IWorkload> CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor, |
Nattapat Chaimanowong | 5a4304a | 2018-11-28 10:44:37 +0000 | [diff] [blame] | 118 | const WorkloadInfo& info) const override; |
| 119 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 120 | std::unique_ptr<IWorkload> CreateConcat(const ConcatQueueDescriptor& descriptor, |
Jim Flynn | 4ed6c83 | 2019-05-20 11:02:46 +0100 | [diff] [blame] | 121 | const WorkloadInfo& info) const override; |
| 122 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 123 | std::unique_ptr<IWorkload> CreateConstant(const ConstantQueueDescriptor& descriptor, |
| 124 | const WorkloadInfo& info) const override; |
narpra01 | a6bf912 | 2018-09-10 09:50:09 +0100 | [diff] [blame] | 125 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 126 | std::unique_ptr<IWorkload> CreateReshape(const ReshapeQueueDescriptor& descriptor, |
| 127 | const WorkloadInfo& info) const override; |
| 128 | |
| 129 | std::unique_ptr<IWorkload> CreateSpaceToBatchNd(const SpaceToBatchNdQueueDescriptor& descriptor, |
| 130 | const WorkloadInfo& info) const override; |
| 131 | |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 132 | std::unique_ptr<IWorkload> CreateSpaceToDepth(const SpaceToDepthQueueDescriptor& descriptor, |
| 133 | const WorkloadInfo& info) const override; |
| 134 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 135 | std::unique_ptr<IWorkload> CreateFloor(const FloorQueueDescriptor& descriptor, |
| 136 | const WorkloadInfo& info) const override; |
| 137 | |
| 138 | std::unique_ptr<IWorkload> CreateLstm(const LstmQueueDescriptor& descriptor, |
| 139 | const WorkloadInfo& info) const override; |
| 140 | |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 141 | std::unique_ptr<IWorkload> CreateQuantizedLstm(const QuantizedLstmQueueDescriptor& descriptor, |
| 142 | const WorkloadInfo& info) const override; |
| 143 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 144 | std::unique_ptr<IWorkload> CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor, |
| 145 | const WorkloadInfo& info) const override; |
| 146 | |
| 147 | std::unique_ptr<IWorkload> CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor, |
| 148 | const WorkloadInfo& info) const override; |
| 149 | |
| 150 | std::unique_ptr<IWorkload> CreateDivision(const DivisionQueueDescriptor& descriptor, |
| 151 | const WorkloadInfo& info) const override; |
| 152 | |
| 153 | std::unique_ptr<IWorkload> CreateSubtraction(const SubtractionQueueDescriptor& descriptor, |
jimfly01 | 2c9322a | 2018-09-19 10:59:49 +0100 | [diff] [blame] | 154 | const WorkloadInfo& info) const override; |
| 155 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 156 | std::unique_ptr<IWorkload> CreateMaximum(const MaximumQueueDescriptor& descriptor, |
| 157 | const WorkloadInfo& info) const override; |
FrancisMurtagh | 2099595 | 2018-12-17 12:11:36 +0000 | [diff] [blame] | 158 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 159 | std::unique_ptr<IWorkload> CreateMean(const MeanQueueDescriptor& descriptor, |
| 160 | const WorkloadInfo& Info) const override; |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 161 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 162 | std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor, |
| 163 | const WorkloadInfo& info) const override; |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 164 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 165 | std::unique_ptr<IWorkload> CreateEqual(const EqualQueueDescriptor& descriptor, |
| 166 | const WorkloadInfo& info) const override; |
kevmay01 | 9053969 | 2018-11-29 08:40:19 +0000 | [diff] [blame] | 167 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 168 | std::unique_ptr<IWorkload> CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor, |
| 169 | const WorkloadInfo& Info) const override; |
Matteo Martincigh | 59a950c | 2018-12-13 12:48:25 +0000 | [diff] [blame] | 170 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 171 | std::unique_ptr<IWorkload> CreateStridedSlice(const StridedSliceQueueDescriptor& descriptor, |
| 172 | const WorkloadInfo& info) const override; |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 173 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 174 | std::unique_ptr<IWorkload> CreateMinimum(const MinimumQueueDescriptor& descriptor, |
| 175 | const WorkloadInfo& info) const override; |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 176 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 177 | std::unique_ptr<IWorkload> CreateGreater(const GreaterQueueDescriptor& descriptor, |
| 178 | const WorkloadInfo& info) const override; |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 179 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 180 | std::unique_ptr<IWorkload> CreateDebug(const DebugQueueDescriptor& descriptor, |
| 181 | const WorkloadInfo& info) const override; |
| 182 | |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 183 | std::unique_ptr<IWorkload> CreateTransposeConvolution2d(const TransposeConvolution2dQueueDescriptor& descriptor, |
| 184 | const WorkloadInfo& info) const override; |
| 185 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 186 | std::unique_ptr<IWorkload> CreateRsqrt(const RsqrtQueueDescriptor& descriptor, |
| 187 | const WorkloadInfo& info) const override; |
| 188 | |
| 189 | std::unique_ptr<IWorkload> CreatePreCompiled(const PreCompiledQueueDescriptor& descriptor, |
| 190 | const WorkloadInfo& info) const override; |
| 191 | |
| 192 | std::unique_ptr<IWorkload> CreateGather(const GatherQueueDescriptor& descriptor, |
| 193 | const WorkloadInfo& info) const override; |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 194 | |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 195 | std::unique_ptr<IWorkload> CreateStack(const StackQueueDescriptor& descriptor, |
| 196 | const WorkloadInfo& info) const override; |
| 197 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 198 | private: |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 199 | mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 200 | }; |
| 201 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 202 | } // namespace armnn |