blob: 860d78ba7ecfec69e44f1fadd828afe518a048ac [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,
24 bool isFastMathEnabled = false);
surmeh013537c2c2018-05-18 16:31:43 +010025
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010026class NeonConvolution2dWorkload : public BaseWorkload<Convolution2dQueueDescriptor>
telsoa014fcda012018-03-09 14:13:49 +000027{
28public:
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010029 using BaseWorkload<Convolution2dQueueDescriptor>::m_Data;
telsoa014fcda012018-03-09 14:13:49 +000030
Sadik Armagan04a72972020-09-14 15:44:18 +010031 NeonConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor,
32 const WorkloadInfo& info,
33 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
34 const bool isFastMathENabled = false);
telsoa014fcda012018-03-09 14:13:49 +000035
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010036 void Execute() const override;
telsoa014fcda012018-03-09 14:13:49 +000037
Sadik Armagan04a72972020-09-14 15:44:18 +010038 arm_compute::ConvolutionMethod GetConvolutionMethod() const;
39
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010040private:
telsoa014fcda012018-03-09 14:13:49 +000041 std::unique_ptr<arm_compute::IFunction> m_ConvolutionLayer;
telsoa01c577f2c2018-08-31 09:22:23 +010042
43 std::unique_ptr<arm_compute::Tensor> m_KernelTensor;
44 std::unique_ptr<arm_compute::Tensor> m_BiasTensor;
45
Sadik Armagan04a72972020-09-14 15:44:18 +010046 arm_compute::ConvolutionMethod m_ConvolutionMethod;
47
telsoa01c577f2c2018-08-31 09:22:23 +010048 void FreeUnusedTensors();
Nattapat Chaimanowong974b65f2018-10-15 15:07:34 +010049
telsoa014fcda012018-03-09 14:13:49 +000050};
surmeh013537c2c2018-05-18 16:31:43 +010051
52} //namespace armnn