Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/Tensor.hpp> |
| 9 | #include <armnn/Descriptors.hpp> |
| 10 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 11 | #include <backendsCommon/Workload.hpp> |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 12 | |
| 13 | #include <arm_compute/runtime/CL/functions/CLConvolutionLayer.h> |
| 14 | #include <arm_compute/runtime/MemoryManagerOnDemand.h> |
| 15 | |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 16 | #include <memory> |
| 17 | |
| 18 | namespace armnn |
| 19 | { |
| 20 | |
| 21 | arm_compute::Status ClConvolution2dWorkloadValidate(const TensorInfo& input, |
| 22 | const TensorInfo& output, |
| 23 | const Convolution2dDescriptor& descriptor, |
| 24 | const TensorInfo& weights, |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 25 | const Optional<TensorInfo>& biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame^] | 26 | bool isFastMathEnabled = false, |
| 27 | const ActivationDescriptor* activationDescriptor = nullptr); |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 28 | |
| 29 | class ClConvolution2dWorkload : public BaseWorkload<Convolution2dQueueDescriptor> |
| 30 | { |
| 31 | public: |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 32 | ClConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor, |
| 33 | const WorkloadInfo& info, |
| 34 | std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager, |
| 35 | const bool isFastMathEnabled = false); |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 36 | void Execute() const override; |
| 37 | |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 38 | arm_compute::ConvolutionMethod GetConvolutionMethod() const; |
| 39 | |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 40 | private: |
| 41 | mutable arm_compute::CLConvolutionLayer m_ConvolutionLayer; |
| 42 | |
| 43 | std::unique_ptr<arm_compute::CLTensor> m_KernelTensor; |
| 44 | std::unique_ptr<arm_compute::CLTensor> m_BiasTensor; |
| 45 | |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 46 | arm_compute::ConvolutionMethod m_ConvolutionMethod; |
| 47 | |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 48 | void FreeUnusedTensors(); |
| 49 | }; |
| 50 | |
| 51 | } //namespace armnn |
| 52 | |