blob: 4b6e58ce41cb5012ec8a5bdc9a282e6d51cda67b [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa014fcda012018-03-09 14:13:49 +00004//
5
surmeh01bceff2f2018-03-29 16:29:27 +01006#pragma once
7
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +00008#include <backendsCommon/Workload.hpp>
telsoa014fcda012018-03-09 14:13:49 +00009
Matthew Benthamd80a7122019-01-08 17:52:37 +000010#include <arm_compute/runtime/IFunction.h>
11#include <arm_compute/runtime/Tensor.h>
David Beck711fa312018-09-24 10:46:38 +010012#include <arm_compute/runtime/MemoryManagerOnDemand.h>
surmeh013537c2c2018-05-18 16:31:43 +010013
14#include <memory>
15
telsoa014fcda012018-03-09 14:13:49 +000016namespace armnn
17{
18
surmeh013537c2c2018-05-18 16:31:43 +010019arm_compute::Status NeonConvolution2dWorkloadValidate(const TensorInfo& input,
Sadik Armagan045f6be2020-09-10 13:37:32 +010020 const TensorInfo& output,
21 const Convolution2dDescriptor& descriptor,
22 const TensorInfo& weights,
23 const Optional<TensorInfo>& biases,
Mike Kelly07810fc2020-11-12 10:58:48 +000024 bool isFastMathEnabled = false,
25 const ActivationDescriptor* activationDescriptor = nullptr);
surmeh013537c2c2018-05-18 16:31:43 +010026
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010027class NeonConvolution2dWorkload : public BaseWorkload<Convolution2dQueueDescriptor>
telsoa014fcda012018-03-09 14:13:49 +000028{
29public:
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010030 using BaseWorkload<Convolution2dQueueDescriptor>::m_Data;
telsoa014fcda012018-03-09 14:13:49 +000031
Sadik Armagan04a72972020-09-14 15:44:18 +010032 NeonConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor,
33 const WorkloadInfo& info,
34 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
35 const bool isFastMathENabled = false);
telsoa014fcda012018-03-09 14:13:49 +000036
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010037 void Execute() const override;
telsoa014fcda012018-03-09 14:13:49 +000038
Sadik Armagan04a72972020-09-14 15:44:18 +010039 arm_compute::ConvolutionMethod GetConvolutionMethod() const;
40
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010041private:
telsoa014fcda012018-03-09 14:13:49 +000042 std::unique_ptr<arm_compute::IFunction> m_ConvolutionLayer;
telsoa01c577f2c2018-08-31 09:22:23 +010043
44 std::unique_ptr<arm_compute::Tensor> m_KernelTensor;
45 std::unique_ptr<arm_compute::Tensor> m_BiasTensor;
46
Sadik Armagan04a72972020-09-14 15:44:18 +010047 arm_compute::ConvolutionMethod m_ConvolutionMethod;
48
telsoa01c577f2c2018-08-31 09:22:23 +010049 void FreeUnusedTensors();
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010050
telsoa014fcda012018-03-09 14:13:49 +000051};
surmeh013537c2c2018-05-18 16:31:43 +010052
53} //namespace armnn