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 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 6 | #pragma once |
| 7 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 8 | #include <backendsCommon/Workload.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 10 | #include <arm_compute/runtime/IFunction.h> |
| 11 | #include <arm_compute/runtime/Tensor.h> |
David Beck | 711fa31 | 2018-09-24 10:46:38 +0100 | [diff] [blame] | 12 | #include <arm_compute/runtime/MemoryManagerOnDemand.h> |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 13 | |
| 14 | #include <memory> |
| 15 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 16 | namespace armnn |
| 17 | { |
| 18 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 19 | arm_compute::Status NeonConvolution2dWorkloadValidate(const TensorInfo& input, |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 20 | const TensorInfo& output, |
| 21 | const Convolution2dDescriptor& descriptor, |
| 22 | const TensorInfo& weights, |
| 23 | const Optional<TensorInfo>& biases, |
| 24 | bool isFastMathEnabled = false); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 25 | |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 26 | class NeonConvolution2dWorkload : public BaseWorkload<Convolution2dQueueDescriptor> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 27 | { |
| 28 | public: |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 29 | using BaseWorkload<Convolution2dQueueDescriptor>::m_Data; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 30 | |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 31 | NeonConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor, |
| 32 | const WorkloadInfo& info, |
| 33 | std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager, |
| 34 | const bool isFastMathENabled = false); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 35 | |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 36 | void Execute() const override; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 37 | |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 38 | arm_compute::ConvolutionMethod GetConvolutionMethod() const; |
| 39 | |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 40 | private: |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 41 | std::unique_ptr<arm_compute::IFunction> m_ConvolutionLayer; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 42 | |
| 43 | std::unique_ptr<arm_compute::Tensor> m_KernelTensor; |
| 44 | std::unique_ptr<arm_compute::Tensor> m_BiasTensor; |
| 45 | |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 46 | arm_compute::ConvolutionMethod m_ConvolutionMethod; |
| 47 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 48 | void FreeUnusedTensors(); |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 49 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 50 | }; |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 51 | |
| 52 | } //namespace armnn |