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 | |
| 29 | virtual bool SupportsSubTensors() const override { return true; } |
| 30 | |
| 31 | virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent, |
| 32 | TensorShape const& subTensorShape, |
| 33 | unsigned int const* subTensorOrigin) const override; |
| 34 | |
| 35 | virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override; |
| 36 | |
Francis Murtagh | 351d13d | 2018-09-24 15:01:18 +0100 | [diff] [blame] | 37 | virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo, |
| 38 | DataLayout dataLayout) const override; |
| 39 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 40 | virtual std::unique_ptr<IWorkload> CreateInput(const InputQueueDescriptor& descriptor, |
| 41 | const WorkloadInfo& info) const override; |
| 42 | |
| 43 | virtual std::unique_ptr<IWorkload> CreateOutput(const OutputQueueDescriptor& descriptor, |
| 44 | const WorkloadInfo& info) const override; |
| 45 | |
| 46 | virtual std::unique_ptr<IWorkload> CreateActivation(const ActivationQueueDescriptor& descriptor, |
| 47 | const WorkloadInfo& info) const override; |
| 48 | |
| 49 | virtual std::unique_ptr<IWorkload> CreateSoftmax(const SoftmaxQueueDescriptor& descriptor, |
| 50 | const WorkloadInfo& info) const override; |
| 51 | |
| 52 | virtual std::unique_ptr<IWorkload> CreateSplitter(const SplitterQueueDescriptor& descriptor, |
| 53 | const WorkloadInfo& info) const override; |
| 54 | |
| 55 | virtual std::unique_ptr<IWorkload> CreateMerger(const MergerQueueDescriptor& descriptor, |
| 56 | const WorkloadInfo& info) const override; |
| 57 | |
| 58 | virtual std::unique_ptr<IWorkload> CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor, |
| 59 | const WorkloadInfo& info) const override; |
| 60 | |
| 61 | virtual std::unique_ptr<IWorkload> CreatePermute(const PermuteQueueDescriptor& descriptor, |
| 62 | const WorkloadInfo& info) const override; |
| 63 | |
| 64 | virtual std::unique_ptr<IWorkload> CreatePooling2d(const Pooling2dQueueDescriptor& descriptor, |
| 65 | const WorkloadInfo& info) const override; |
| 66 | |
| 67 | virtual std::unique_ptr<IWorkload> CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor, |
| 68 | const WorkloadInfo& info) const override; |
| 69 | |
| 70 | virtual std::unique_ptr<IWorkload> CreateDepthwiseConvolution2d( |
| 71 | const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const override; |
| 72 | |
| 73 | virtual std::unique_ptr<IWorkload> CreateNormalization(const NormalizationQueueDescriptor& descriptor, |
| 74 | const WorkloadInfo& info) const override; |
| 75 | |
| 76 | virtual std::unique_ptr<IWorkload> CreateMultiplication(const MultiplicationQueueDescriptor& descriptor, |
| 77 | const WorkloadInfo& info) const override; |
| 78 | |
| 79 | virtual std::unique_ptr<IWorkload> CreateAddition(const AdditionQueueDescriptor& descriptor, |
| 80 | const WorkloadInfo& info) const override; |
| 81 | |
| 82 | virtual std::unique_ptr<IWorkload> CreateBatchNormalization(const BatchNormalizationQueueDescriptor& descriptor, |
| 83 | const WorkloadInfo& info) const override; |
| 84 | |
| 85 | virtual std::unique_ptr<IWorkload> CreateMemCopy(const MemCopyQueueDescriptor& descriptor, |
| 86 | const WorkloadInfo& info) const override; |
| 87 | |
| 88 | virtual std::unique_ptr<IWorkload> CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor, |
| 89 | const WorkloadInfo& info) const override; |
| 90 | |
| 91 | virtual std::unique_ptr<IWorkload> CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor, |
| 92 | const WorkloadInfo& info) const override; |
| 93 | |
| 94 | virtual std::unique_ptr<IWorkload> CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor, |
| 95 | const WorkloadInfo& info) const override; |
| 96 | |
| 97 | virtual std::unique_ptr<IWorkload> CreateConstant(const ConstantQueueDescriptor& descriptor, |
| 98 | const WorkloadInfo& info) const override; |
| 99 | |
| 100 | virtual std::unique_ptr<IWorkload> CreateReshape(const ReshapeQueueDescriptor& descriptor, |
| 101 | const WorkloadInfo& info) const override; |
| 102 | |
Nattapat Chaimanowong | 207ef9a | 2018-11-02 10:57:25 +0000 | [diff] [blame] | 103 | virtual std::unique_ptr<IWorkload> CreateSpaceToBatchNd(const SpaceToBatchNdQueueDescriptor& descriptor, |
| 104 | const WorkloadInfo& info) const override; |
| 105 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 106 | virtual std::unique_ptr<IWorkload> CreateFloor(const FloorQueueDescriptor& descriptor, |
| 107 | const WorkloadInfo& info) const override; |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 108 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 109 | virtual std::unique_ptr<IWorkload> CreateLstm(const LstmQueueDescriptor& descriptor, |
| 110 | const WorkloadInfo& info) const override; |
| 111 | |
| 112 | virtual std::unique_ptr<IWorkload> CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor, |
| 113 | const WorkloadInfo& info) const override; |
| 114 | |
| 115 | virtual std::unique_ptr<IWorkload> CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor, |
| 116 | const WorkloadInfo& info) const override; |
| 117 | |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 118 | virtual std::unique_ptr<IWorkload> CreateDivision(const DivisionQueueDescriptor& descriptor, |
| 119 | const WorkloadInfo& info) const override; |
| 120 | |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 121 | virtual std::unique_ptr<IWorkload> CreateSubtraction(const SubtractionQueueDescriptor& descriptor, |
| 122 | const WorkloadInfo& info) const override; |
| 123 | |
narpra01 | a6bf912 | 2018-09-10 09:50:09 +0100 | [diff] [blame] | 124 | virtual std::unique_ptr<IWorkload> CreateMean(const MeanQueueDescriptor& descriptor, |
| 125 | const WorkloadInfo& Info) const override; |
| 126 | |
jimfly01 | 2c9322a | 2018-09-19 10:59:49 +0100 | [diff] [blame] | 127 | virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor, |
| 128 | const WorkloadInfo& info) const override; |
| 129 | |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 130 | virtual std::unique_ptr<IWorkload> CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor, |
| 131 | const WorkloadInfo& Info) const override; |
| 132 | |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 133 | virtual std::unique_ptr<IWorkload> CreateStridedSlice(const StridedSliceQueueDescriptor& descriptor, |
| 134 | const WorkloadInfo& info) const override; |
| 135 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 136 | private: |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 137 | mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 138 | }; |
| 139 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 140 | } // namespace armnn |