blob: f769422a0a4aae46c24522c395e697c16492ed72 [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,
26 bool isFastMathEnabled = false);
Matthew Benthamd8067922018-10-03 17:18:04 +010027
28class ClConvolution2dWorkload : public BaseWorkload<Convolution2dQueueDescriptor>
29{
30public:
Sadik Armagan04a72972020-09-14 15:44:18 +010031 ClConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor,
32 const WorkloadInfo& info,
33 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
34 const bool isFastMathEnabled = false);
Matthew Benthamd8067922018-10-03 17:18:04 +010035 void Execute() const override;
36
Sadik Armagan04a72972020-09-14 15:44:18 +010037 arm_compute::ConvolutionMethod GetConvolutionMethod() const;
38
Matthew Benthamd8067922018-10-03 17:18:04 +010039private:
40 mutable arm_compute::CLConvolutionLayer m_ConvolutionLayer;
41
42 std::unique_ptr<arm_compute::CLTensor> m_KernelTensor;
43 std::unique_ptr<arm_compute::CLTensor> m_BiasTensor;
44
Sadik Armagan04a72972020-09-14 15:44:18 +010045 arm_compute::ConvolutionMethod m_ConvolutionMethod;
46
Matthew Benthamd8067922018-10-03 17:18:04 +010047 void FreeUnusedTensors();
48};
49
50} //namespace armnn
51