blob: 4e5c1cf5ed7397d27c395c15f475b39b6a394582 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
Mike Kellyec67a0f2022-11-25 13:55:24 +00002// Copyright © 2017,2022 Arm Ltd and Contributors. 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
Teresa Charlin588cbdf2022-01-19 15:55:37 +00008#include "NeonBaseWorkload.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
Teresa Charlin588cbdf2022-01-19 15:55:37 +000027class NeonConvolution2dWorkload : public NeonBaseWorkload<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
Mike Kellyec67a0f2022-11-25 13:55:24 +000044 mutable std::unique_ptr<arm_compute::Tensor> m_KernelTensor;
45 mutable std::unique_ptr<arm_compute::Tensor> m_BiasTensor;
46 TensorInfo m_KernelTensorInfo;
47 TensorInfo m_BiasTensorInfo;
Sadik Armagan04a72972020-09-14 15:44:18 +010048 arm_compute::ConvolutionMethod m_ConvolutionMethod;
Mike Kellyec67a0f2022-11-25 13:55:24 +000049 mutable bool prepared = false;
telsoa014fcda012018-03-09 14:13:49 +000050};
surmeh013537c2c2018-05-18 16:31:43 +010051
52} //namespace armnn