ArmNN
 25.11
Loading...
Searching...
No Matches
ClDepthwiseConvolutionWorkload Class Reference

#include <ClDepthwiseConvolutionWorkload.hpp>

Inheritance diagram for ClDepthwiseConvolutionWorkload:
[legend]
Collaboration diagram for ClDepthwiseConvolutionWorkload:
[legend]

Public Member Functions

 ClDepthwiseConvolutionWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
void Execute () const override
Public Member Functions inherited from ClBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
 ClBaseWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
Public Member Functions inherited from BaseWorkload< DepthwiseConvolution2dQueueDescriptor >
 BaseWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
virtual const std::string & GetName () const override
void PostAllocationConfigure () override
const DepthwiseConvolution2dQueueDescriptorGetData () const
arm::pipe::ProfilingGuid GetGuid () const final
virtual bool SupportsTensorHandleReplacement () const override
Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
virtual armnn::Optional< armnn::MemoryRequirementsGetMemoryRequirements ()

Protected Attributes

std::unique_ptr< arm_compute::IFunction > m_DepthwiseConvolutionLayer
Protected Attributes inherited from BaseWorkload< DepthwiseConvolution2dQueueDescriptor >
DepthwiseConvolution2dQueueDescriptor m_Data
const arm::pipe::ProfilingGuid m_Guid
const std::string m_Name

Additional Inherited Members

Protected Member Functions inherited from ClBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
virtual void Reconfigure ()

Detailed Description

Definition at line 24 of file ClDepthwiseConvolutionWorkload.hpp.

Constructor & Destructor Documentation

◆ ClDepthwiseConvolutionWorkload()

ClDepthwiseConvolutionWorkload ( const DepthwiseConvolution2dQueueDescriptor & descriptor,
const WorkloadInfo & info,
const arm_compute::CLCompileContext & clCompileContext )

Definition at line 86 of file ClDepthwiseConvolutionWorkload.cpp.

90 : ClBaseWorkload<DepthwiseConvolution2dQueueDescriptor>(descriptor, info)
91{
92 m_Data.ValidateInputsOutputs("ClDepthwiseConv2dWorkload", descriptor.m_Parameters.GetNumInputs(), 1);
93
94 arm_compute::ICLTensor& input = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
95 arm_compute::ICLTensor& output = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
96 arm_compute::ICLTensor& weights = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
97 weights.info()->set_are_values_constant(info.m_InputTensorInfos[1].IsConstant());
98 arm_compute::ITensorInfo* weightsInfo = weights.info();
99 arm_compute::ITensorInfo* inputInfo = input.info();
100 auto weightsShape = weightsInfo->tensor_shape();
101 auto inputShape = inputInfo->tensor_shape();
102
103 // The PermuteDepthwiseConv2dWeights backend optimization has been performed,
104 // converting weights to have the same data layout as input.
105 unsigned int depthMultiplier =
106 ComputeDepthwiseConv2dDepthMultiplier(m_Data.m_Parameters.m_DataLayout, weightsShape, inputShape);
107
108 arm_compute::ICLTensor* bias = nullptr;
109 if (m_Data.m_Parameters.m_BiasEnabled)
110 {
111 bias = &PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
112 bias->info()->set_are_values_constant(info.m_InputTensorInfos[2].IsConstant());
113 }
114
115 const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(
116 m_Data.m_Parameters.m_DilationX,
117 m_Data.m_Parameters.m_DilationY);
118
119 arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
120 input.info()->set_data_layout(aclDataLayout);
121 weights.info()->set_data_layout(aclDataLayout);
122 output.info()->set_data_layout(aclDataLayout);
123
124 arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(m_Data.m_Parameters);
125
126 const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
127
128 m_DepthwiseConvolutionLayer = std::make_unique<arm_compute::CLDepthwiseConvolutionLayer>();
129
130 {
131 ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClDepthwiseConvolutionWorkload_configure");
132 static_cast<arm_compute::CLDepthwiseConvolutionLayer*>(m_DepthwiseConvolutionLayer.get())->configure(
133 clCompileContext,
134 &input,
135 &weights,
136 bias,
137 &output,
138 padStrideInfo,
139 depthMultiplier,
140 activationInfo,
141 aclDilationInfo);
142 }
143
144 // Add details for profiling output
145 WorkloadInfo detailsInfo;
146
147 detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
148 detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
149
150 // Report Profiling Details
151 ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClDepthwiseConvolutionWorkload_Construct",
152 descriptor.m_Parameters,
153 detailsInfo,
154 GetGuid());
155}
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, ClBaseWorkload< DepthwiseConvolution2dQueueDescriptor >::ClBaseWorkload(), armnn::ConvertAdditionalInfoToAclActivationLayerInfo(), BaseWorkload< DepthwiseConvolution2dQueueDescriptor >::GetGuid(), DepthwiseConvolution2dDescriptor::GetNumInputs(), armnn::info, BaseWorkload< DepthwiseConvolution2dQueueDescriptor >::m_Data, m_DepthwiseConvolutionLayer, WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, and armnn::PolymorphicDowncast().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 157 of file ClDepthwiseConvolutionWorkload.cpp.

158{
159 ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClDepthwiseConvolutionWorkload_Execute");
160
161 RunClFunction(*m_DepthwiseConvolutionLayer, CHECK_LOCATION());
162}
#define CHECK_LOCATION()
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)

References ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, CHECK_LOCATION, m_DepthwiseConvolutionLayer, and armnn::RunClFunction().

Member Data Documentation

◆ m_DepthwiseConvolutionLayer

std::unique_ptr<arm_compute::IFunction> m_DepthwiseConvolutionLayer
protected

Definition at line 36 of file ClDepthwiseConvolutionWorkload.hpp.

Referenced by ClDepthwiseConvolutionWorkload(), and Execute().


The documentation for this class was generated from the following files: