2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
7 #include <backends/OutputHandler.hpp>
9 #include <memory/BaseMemoryManager.hpp>
11 #include <boost/core/ignore_unused.hpp>
12 #include <boost/optional.hpp>
17 // Neon workload factory.
18 class NeonWorkloadFactory : public IWorkloadFactory
21 NeonWorkloadFactory();
23 virtual Compute GetCompute() const override { return Compute::CpuAcc; }
25 static bool IsLayerSupported(const Layer& layer, boost::optional<DataType> dataType,
26 std::string& outReasonIfUnsupported);
28 virtual bool SupportsSubTensors() const override { return true; }
30 virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
31 TensorShape const& subTensorShape,
32 unsigned int const* subTensorOrigin) const override;
34 virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
36 virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
37 DataLayout dataLayout) const override;
39 virtual std::unique_ptr<IWorkload> CreateInput(const InputQueueDescriptor& descriptor,
40 const WorkloadInfo& info) const override;
42 virtual std::unique_ptr<IWorkload> CreateOutput(const OutputQueueDescriptor& descriptor,
43 const WorkloadInfo& info) const override;
45 virtual std::unique_ptr<IWorkload> CreateActivation(const ActivationQueueDescriptor& descriptor,
46 const WorkloadInfo& info) const override;
48 virtual std::unique_ptr<IWorkload> CreateSoftmax(const SoftmaxQueueDescriptor& descriptor,
49 const WorkloadInfo& info) const override;
51 virtual std::unique_ptr<IWorkload> CreateSplitter(const SplitterQueueDescriptor& descriptor,
52 const WorkloadInfo& info) const override;
54 virtual std::unique_ptr<IWorkload> CreateMerger(const MergerQueueDescriptor& descriptor,
55 const WorkloadInfo& info) const override;
57 virtual std::unique_ptr<IWorkload> CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor,
58 const WorkloadInfo& info) const override;
60 virtual std::unique_ptr<IWorkload> CreatePermute(const PermuteQueueDescriptor& descriptor,
61 const WorkloadInfo& info) const override;
63 virtual std::unique_ptr<IWorkload> CreatePooling2d(const Pooling2dQueueDescriptor& descriptor,
64 const WorkloadInfo& info) const override;
66 virtual std::unique_ptr<IWorkload> CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor,
67 const WorkloadInfo& info) const override;
69 virtual std::unique_ptr<IWorkload> CreateDepthwiseConvolution2d(
70 const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const override;
72 virtual std::unique_ptr<IWorkload> CreateNormalization(const NormalizationQueueDescriptor& descriptor,
73 const WorkloadInfo& info) const override;
75 virtual std::unique_ptr<IWorkload> CreateMultiplication(const MultiplicationQueueDescriptor& descriptor,
76 const WorkloadInfo& info) const override;
78 virtual std::unique_ptr<IWorkload> CreateAddition(const AdditionQueueDescriptor& descriptor,
79 const WorkloadInfo& info) const override;
81 virtual std::unique_ptr<IWorkload> CreateBatchNormalization(const BatchNormalizationQueueDescriptor& descriptor,
82 const WorkloadInfo& info) const override;
84 virtual std::unique_ptr<IWorkload> CreateMemCopy(const MemCopyQueueDescriptor& descriptor,
85 const WorkloadInfo& info) const override;
87 virtual std::unique_ptr<IWorkload> CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor,
88 const WorkloadInfo& info) const override;
90 virtual std::unique_ptr<IWorkload> CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor,
91 const WorkloadInfo& info) const override;
93 virtual std::unique_ptr<IWorkload> CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor,
94 const WorkloadInfo& info) const override;
96 virtual std::unique_ptr<IWorkload> CreateConstant(const ConstantQueueDescriptor& descriptor,
97 const WorkloadInfo& info) const override;
99 virtual std::unique_ptr<IWorkload> CreateReshape(const ReshapeQueueDescriptor& descriptor,
100 const WorkloadInfo& info) const override;
102 virtual std::unique_ptr<IWorkload> CreateFloor(const FloorQueueDescriptor& descriptor,
103 const WorkloadInfo& info) const override;
105 virtual std::unique_ptr<IWorkload> CreateLstm(const LstmQueueDescriptor& descriptor,
106 const WorkloadInfo& info) const override;
108 virtual std::unique_ptr<IWorkload> CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor,
109 const WorkloadInfo& info) const override;
111 virtual std::unique_ptr<IWorkload> CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor,
112 const WorkloadInfo& info) const override;
114 virtual std::unique_ptr<IWorkload> CreateDivision(const DivisionQueueDescriptor& descriptor,
115 const WorkloadInfo& info) const override;
117 virtual std::unique_ptr<IWorkload> CreateSubtraction(const SubtractionQueueDescriptor& descriptor,
118 const WorkloadInfo& info) const override;
120 virtual std::unique_ptr<IWorkload> CreateMean(const MeanQueueDescriptor& descriptor,
121 const WorkloadInfo& Info) const override;
123 virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
124 const WorkloadInfo& info) const override;
126 virtual void Finalize() override;
128 virtual void Release() override;
130 virtual void Acquire() override;
133 #ifdef ARMCOMPUTENEON_ENABLED
134 mutable NeonMemoryManager m_MemoryManager;