blob: 70170b569dda82814ae10083648d03af0a1e9fbc [file] [log] [blame]
Matthew Benthamd8067922018-10-03 17:18:04 +01001//
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-Tarc9cc8042018-11-01 16:15:57 +000011#include <backendsCommon/Workload.hpp>
Matthew Benthamd8067922018-10-03 17:18:04 +010012
13#include <arm_compute/runtime/CL/functions/CLConvolutionLayer.h>
14#include <arm_compute/runtime/MemoryManagerOnDemand.h>
15
Matthew Benthamd8067922018-10-03 17:18:04 +010016#include <memory>
17
18namespace armnn
19{
20
21arm_compute::Status ClConvolution2dWorkloadValidate(const TensorInfo& input,
22 const TensorInfo& output,
23 const Convolution2dDescriptor& descriptor,
24 const TensorInfo& weights,
Sadik Armagan045f6be2020-09-10 13:37:32 +010025 const Optional<TensorInfo>& biases,
Mike Kelly07810fc2020-11-12 10:58:48 +000026 bool isFastMathEnabled = false,
27 const ActivationDescriptor* activationDescriptor = nullptr);
Matthew Benthamd8067922018-10-03 17:18:04 +010028
29class ClConvolution2dWorkload : public BaseWorkload<Convolution2dQueueDescriptor>
30{
31public:
Sadik Armagan04a72972020-09-14 15:44:18 +010032 ClConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor,
33 const WorkloadInfo& info,
34 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
35 const bool isFastMathEnabled = false);
Matthew Benthamd8067922018-10-03 17:18:04 +010036 void Execute() const override;
37
Sadik Armagan04a72972020-09-14 15:44:18 +010038 arm_compute::ConvolutionMethod GetConvolutionMethod() const;
39
Matthew Benthamd8067922018-10-03 17:18:04 +010040private:
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 Armagan04a72972020-09-14 15:44:18 +010046 arm_compute::ConvolutionMethod m_ConvolutionMethod;
47
Matthew Benthamd8067922018-10-03 17:18:04 +010048 void FreeUnusedTensors();
49};
50
51} //namespace armnn
52