2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
7 #include "OutputHandler.hpp"
9 #include "armnn/IRuntime.hpp"
10 #include <boost/optional.hpp>
12 #include "memory/BaseMemoryManager.hpp"
17 // ARM Compute OpenCL workload factory.
18 class ClWorkloadFactory : public IWorkloadFactory
23 virtual Compute GetCompute() const override { return Compute::GpuAcc; }
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<IWorkload> CreateInput(const InputQueueDescriptor& descriptor,
37 const WorkloadInfo& info) const override;
39 virtual std::unique_ptr<IWorkload> CreateOutput(const OutputQueueDescriptor& descriptor,
40 const WorkloadInfo& info) const override;
42 virtual std::unique_ptr<IWorkload> CreateActivation(const ActivationQueueDescriptor& descriptor,
43 const WorkloadInfo& info) const override;
45 virtual std::unique_ptr<IWorkload> CreateSoftmax(const SoftmaxQueueDescriptor& descriptor,
46 const WorkloadInfo& info) const override;
48 virtual std::unique_ptr<IWorkload> CreateSplitter(const SplitterQueueDescriptor& descriptor,
49 const WorkloadInfo& info) const override;
51 virtual std::unique_ptr<IWorkload> CreateMerger(const MergerQueueDescriptor& descriptor,
52 const WorkloadInfo& info) const override;
54 virtual std::unique_ptr<IWorkload> CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor,
55 const WorkloadInfo& info) const override;
57 virtual std::unique_ptr<IWorkload> CreatePermute(const PermuteQueueDescriptor& descriptor,
58 const WorkloadInfo& info) const override;
60 virtual std::unique_ptr<IWorkload> CreatePooling2d(const Pooling2dQueueDescriptor& descriptor,
61 const WorkloadInfo& info) const override;
63 virtual std::unique_ptr<IWorkload> CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor,
64 const WorkloadInfo& info) const override;
66 virtual std::unique_ptr<IWorkload> CreateDepthwiseConvolution2d(
67 const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const override;
69 virtual std::unique_ptr<IWorkload> CreateNormalization(const NormalizationQueueDescriptor& descriptor,
70 const WorkloadInfo& info) const override;
72 virtual std::unique_ptr<IWorkload> CreateAddition(const AdditionQueueDescriptor& 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> CreateBatchNormalization(const BatchNormalizationQueueDescriptor& descriptor,
79 const WorkloadInfo& info) const override;
81 virtual std::unique_ptr<IWorkload> CreateMemCopy(const MemCopyQueueDescriptor& descriptor,
82 const WorkloadInfo& info) const override;
84 virtual std::unique_ptr<IWorkload> CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor,
85 const WorkloadInfo& info) const override;
87 virtual std::unique_ptr<IWorkload> CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor,
88 const WorkloadInfo& info) const override;
90 virtual std::unique_ptr<IWorkload> CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor,
91 const WorkloadInfo& info) const override;
93 virtual std::unique_ptr<IWorkload> CreateConstant(const ConstantQueueDescriptor& descriptor,
94 const WorkloadInfo& info) const override;
96 virtual std::unique_ptr<IWorkload> CreateReshape(const ReshapeQueueDescriptor& descriptor,
97 const WorkloadInfo& info) const override;
99 virtual std::unique_ptr<IWorkload> CreateFloor(const FloorQueueDescriptor& descriptor,
100 const WorkloadInfo& info) const override;
102 virtual std::unique_ptr<IWorkload> CreateLstm(const LstmQueueDescriptor& descriptor,
103 const WorkloadInfo& info) const override;
105 virtual std::unique_ptr<IWorkload> CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor,
106 const WorkloadInfo& info) const override;
108 virtual std::unique_ptr<IWorkload> CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor,
109 const WorkloadInfo& info) const override;
111 virtual void Finalize() override;
113 virtual void Release() override;
115 virtual void Acquire() override;
119 #ifdef ARMCOMPUTECL_ENABLED
120 mutable ClMemoryManager m_MemoryManager;