ArmNN
 24.08
ClConvolution2dWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. 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 
11 #include "ClBaseWorkload.hpp"
12 
13 #include <arm_compute/runtime/CL/functions/CLConvolutionLayer.h>
14 #include <arm_compute/runtime/MemoryManagerOnDemand.h>
15 
16 #include <cl/ICLTensorProxy.hpp>
17 
18 #include <memory>
19 
20 namespace armnn
21 {
22 
24  const TensorInfo& output,
25  const Convolution2dDescriptor& descriptor,
26  const TensorInfo& weights,
27  const Optional<TensorInfo>& biases,
28  bool isFastMathEnabled = false,
29  const ActivationDescriptor* activationDescriptor = nullptr);
30 
31 class ClConvolution2dWorkload : public ClBaseWorkload<Convolution2dQueueDescriptor>
32 {
33 public:
35  const WorkloadInfo& info,
36  std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
37  const arm_compute::CLCompileContext& clCompileContext,
38  const bool isFastMathEnabled = false);
39  void Execute() const override;
40 
41  arm_compute::ConvolutionMethod GetConvolutionMethod() const;
42 
43  bool SupportsTensorHandleReplacement() const override
44  {
45  // NCHW DataLayout on ACL still uses paddding for alignment on the Conv2d workload so importing is unreliable.
47  {
48  return false;
49  }
50  else
51  {
52  return true;
53  }
54  }
55 
56 
57 protected:
58  void Reconfigure() override;
59 
60 private:
61  mutable arm_compute::CLConvolutionLayer m_ConvolutionLayer;
62 
63  arm_compute::ConvolutionMethod m_ConvolutionMethod;
64 
65  std::unique_ptr<ICLTensorProxy> m_InputProxy;
66  std::unique_ptr<ICLTensorProxy> m_WeightsProxy;
67  std::unique_ptr<ICLTensorProxy> m_BiasProxy;
68  std::unique_ptr<ICLTensorProxy> m_OutputProxy;
69 };
70 
71 } //namespace armnn
72 
armnn::ClConvolution2dWorkload::ClConvolution2dWorkload
ClConvolution2dWorkload(const Convolution2dQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager, const arm_compute::CLCompileContext &clCompileContext, const bool isFastMathEnabled=false)
Definition: ClConvolution2dWorkload.cpp:76
Descriptors.hpp
armnn::ClConvolution2dWorkload::GetConvolutionMethod
arm_compute::ConvolutionMethod GetConvolutionMethod() const
Definition: ClConvolution2dWorkload.cpp:166
armnn::ClConvolution2dWorkload::Execute
void Execute() const override
Definition: ClConvolution2dWorkload.cpp:160
armnn::ClBaseWorkload
Definition: ClBaseWorkload.hpp:13
armnn::ClConvolution2dWorkloadValidate
arm_compute::Status ClConvolution2dWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const Convolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, bool isFastMathEnabled, const ActivationDescriptor *activationDescriptor)
Definition: ClConvolution2dWorkload.cpp:23
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::Convolution2dQueueDescriptor
Definition: WorkloadData.hpp:210
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::ClConvolution2dWorkload
Definition: ClConvolution2dWorkload.hpp:31
armnn::Convolution2dDescriptor::m_DataLayout
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Definition: Descriptors.hpp:584
armnn::BoostLogSeverityMapping::info
@ info
ICLTensorProxy.hpp
Tensor.hpp
armnn::Status
Status
Definition: Types.hpp:42
armnn::BaseWorkload< Convolution2dQueueDescriptor >::m_Data
Convolution2dQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ClConvolution2dWorkload::Reconfigure
void Reconfigure() override
Definition: ClConvolution2dWorkload.cpp:171
ClBaseWorkload.hpp
armnn::ClConvolution2dWorkload::SupportsTensorHandleReplacement
bool SupportsTensorHandleReplacement() const override
Definition: ClConvolution2dWorkload.hpp:43
armnn::DataLayout::NCHW
@ NCHW