From 8efb48a6847c5cd166c561127ae6611150963ce3 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 19 May 2023 11:14:28 +0100 Subject: Update Doxygen docu for 23.05 Signed-off-by: Nikhil Raj Change-Id: I0a992286f14fa68fcc6e5eba31ac39fed003cbbe --- .../classarmnn_1_1_cl_batch_mat_mul_workload.xhtml | 179 +++++++-------------- 1 file changed, 62 insertions(+), 117 deletions(-) (limited to 'latest/classarmnn_1_1_cl_batch_mat_mul_workload.xhtml') diff --git a/latest/classarmnn_1_1_cl_batch_mat_mul_workload.xhtml b/latest/classarmnn_1_1_cl_batch_mat_mul_workload.xhtml index c324140f8b..7b91ba7151 100644 --- a/latest/classarmnn_1_1_cl_batch_mat_mul_workload.xhtml +++ b/latest/classarmnn_1_1_cl_batch_mat_mul_workload.xhtml @@ -41,7 +41,7 @@ ArmNN
-  23.02 +  23.05
@@ -169,7 +169,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 21 of file ClBatchMatMulWorkload.hpp.

+

Definition at line 20 of file ClBatchMatMulWorkload.hpp.

Constructor & Destructor Documentation

◆ ClBatchMatMulWorkload()

@@ -203,97 +203,56 @@ Additional Inherited Members
-

Definition at line 115 of file ClBatchMatMulWorkload.cpp.

-
118  : ClBaseWorkload<BatchMatMulQueueDescriptor>(descriptor, info)
-
119 {
-
120  // Report Profiling Details
-
121  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClBatchMatMulWorkload_Construct",
-
122  descriptor.m_Parameters,
-
123  info,
-
124  this->GetGuid());
-
125 
-
126  if (descriptor.m_Parameters.m_AdjointX || descriptor.m_Parameters.m_AdjointY )
-
127  {
-
128  throw Exception("Support for adjoint not implemented.");
-
129  }
-
130  if (descriptor.m_Parameters.m_DataLayoutX != armnn::DataLayout::NCHW ||
-
131  descriptor.m_Parameters.m_DataLayoutY != armnn::DataLayout::NCHW )
-
132  {
-
133  throw Exception("Only supported the MatMul in the last 2 dimensions");
-
134  }
-
135 
-
136  m_Data.ValidateInputsOutputs("ClBatchMatMulWorkload", 2, 1);
-
137 
-
138  const arm_compute::ICLTensor& inputX = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
-
139  const arm_compute::ICLTensor& inputY = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
-
140  arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
-
141 
-
142  inputX.info()->set_data_layout(armcomputetensorutils::ConvertDataLayout(m_Data.m_Parameters.m_DataLayoutX));
-
143  arm_compute::TensorShape inputXTensorInfo = armcomputetensorutils::BuildArmComputeTensorShape(
-
144  info.m_InputTensorInfos[0].GetShape(), 3);
-
145  inputX.info()->set_tensor_shape(inputXTensorInfo);
-
146  inputY.info()->set_data_layout(armcomputetensorutils::ConvertDataLayout(m_Data.m_Parameters.m_DataLayoutY));
-
147  arm_compute::TensorShape inputYTensorInfo = armcomputetensorutils::BuildArmComputeTensorShape(
-
148  info.m_InputTensorInfos[1].GetShape(), 3);
-
149  inputY.info()->set_tensor_shape(inputYTensorInfo);
-
150 
-
151  arm_compute::TensorInfo aclPermutedXInfo = arm_compute::TensorInfo();
-
152  arm_compute::TensorInfo aclPermutedYInfo = arm_compute::TensorInfo();
-
153 
-
154  if (descriptor.m_Parameters.m_TransposeX == true)
-
155  {
-
156  armnn::TensorInfo strippedInfo = armnnUtils::ReduceDims(info.m_InputTensorInfos[0], 3);
-
157 
-
158  armnn::PermutationVector permutationXVector
- -
160  const TensorInfo permutedXInfo = armnnUtils::Permuted(strippedInfo, permutationXVector);
-
161  const auto aclPermutationXVector = armcomputetensorutils::BuildArmComputePermutationVector(permutationXVector);
-
162  armcomputetensorutils::BuildArmComputeTensor(m_PermutedTensorX, permutedXInfo);
-
163  armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_PermutedTensorX);
-
164 
-
165  auto permuteLayerX = std::make_unique<arm_compute::CLPermute>();
-
166  permuteLayerX->configure(clCompileContext,
-
167  &inputX,
-
168  &m_PermutedTensorX,
-
169  aclPermutationXVector);
-
170  m_PermuteLayerX.reset(permuteLayerX.release());
-
171  }
-
172 
-
173  if (descriptor.m_Parameters.m_TransposeY == true)
-
174  {
-
175  armnn::TensorInfo strippedInfo = armnnUtils::ReduceDims(info.m_InputTensorInfos[1], 3);
-
176 
-
177  armnn::PermutationVector permutationYVector
- -
179  const TensorInfo permutedYInfo = armnnUtils::Permuted(strippedInfo, permutationYVector);
-
180  const auto aclPermutationYVector = armcomputetensorutils::BuildArmComputePermutationVector(permutationYVector);
-
181  armcomputetensorutils::BuildArmComputeTensor(m_PermutedTensorY, permutedYInfo);
-
182  armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_PermutedTensorY);
-
183 
-
184  auto permuteLayerY = std::make_unique<arm_compute::CLPermute>();
-
185  permuteLayerY->configure(clCompileContext,
-
186  &inputY,
-
187  &m_PermutedTensorY,
-
188  aclPermutationYVector);
-
189  m_PermuteLayerY.reset(permuteLayerY.release());
-
190  }
-
191 
-
192  const arm_compute::GEMMInfo& gemm_info = arm_compute::GEMMInfo(false, // is inputX reshaped
-
193  false, // is inputY reshaped
-
194  false); // is inputY reshaped only 1st run
-
195  auto gemmLayer = std::make_unique<arm_compute::CLGEMM>();
-
196  gemmLayer->configure(clCompileContext,
-
197  descriptor.m_Parameters.m_TransposeX ? &m_PermutedTensorX : &inputX,
-
198  descriptor.m_Parameters.m_TransposeY ? &m_PermutedTensorY : &inputY,
-
199  nullptr,
-
200  &output,
-
201  1.0,
-
202  0,
-
203  gemm_info);
-
204  m_GEMMLayer.reset(gemmLayer.release());
-
205 }
+

Definition at line 57 of file ClBatchMatMulWorkload.cpp.

+
60  : ClBaseWorkload<BatchMatMulQueueDescriptor>(descriptor, info)
+
61 {
+
62  // Report Profiling Details
+
63  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClBatchMatMulWorkload_Construct",
+
64  descriptor.m_Parameters,
+
65  info,
+
66  this->GetGuid());
+
67 
+
68  if (descriptor.m_Parameters.m_AdjointX || descriptor.m_Parameters.m_AdjointY )
+
69  {
+
70  throw Exception("Support for adjoint not implemented.");
+
71  }
+
72  if (descriptor.m_Parameters.m_DataLayoutX != armnn::DataLayout::NCHW ||
+
73  descriptor.m_Parameters.m_DataLayoutY != armnn::DataLayout::NCHW )
+
74  {
+
75  throw Exception("Only supported the MatMul in the last 2 dimensions");
+
76  }
+
77 
+
78  m_Data.ValidateInputsOutputs("ClBatchMatMulWorkload", 2, 1);
+
79 
+
80  arm_compute::ICLTensor& inputX = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
+
81  arm_compute::ICLTensor& inputY = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
+
82  auto outputHandle = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0]);
+
83  arm_compute::ICLTensor& output = outputHandle->GetTensor();
+
84 
+
85  // GeMM dispatches kernel handles dynamic inputs differently to static so this flag needs to be set
+
86  inputX.info()->set_are_values_constant(false);
+
87  inputY.info()->set_are_values_constant(false);
+
88 
+
89  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
+
90 
+
91  arm_compute::MatMulInfo matMulInfo;
+
92  matMulInfo.adj_lhs(descriptor.m_Parameters.m_TransposeX);
+
93  matMulInfo.adj_rhs(descriptor.m_Parameters.m_TransposeY);
+
94  matMulInfo.fused_activation(activationInfo);
+
95 
+
96  m_MatMulLayer.configure(clCompileContext, &inputX, &inputY, &output, matMulInfo);
+
97 
+
98  // Report Profiling Details
+
99  WorkloadInfo detailsInfo;
+
100  detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
+
101  detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
+
102  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClBatchMatMulWorkload_Construct",
+
103  descriptor.m_Parameters,
+
104  detailsInfo,
+
105  GetGuid());
+
106 }
-

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, armnn::info, BatchMatMulDescriptor::m_AdjointX, BatchMatMulDescriptor::m_AdjointY, BaseWorkload< BatchMatMulQueueDescriptor >::m_Data, BatchMatMulDescriptor::m_DataLayoutX, BatchMatMulDescriptor::m_DataLayoutY, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, armnn::NCHW, and QueueDescriptor::ValidateInputsOutputs().

+

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, armnn::ConvertAdditionalInfoToAclActivationLayerInfo(), BaseWorkload< BatchMatMulQueueDescriptor >::GetGuid(), armnn::info, BatchMatMulDescriptor::m_AdjointX, BatchMatMulDescriptor::m_AdjointY, BaseWorkload< BatchMatMulQueueDescriptor >::m_Data, BatchMatMulDescriptor::m_DataLayoutX, BatchMatMulDescriptor::m_DataLayoutY, QueueDescriptor::m_Inputs, WorkloadInfo::m_InputTensorInfos, QueueDescriptor::m_Outputs, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, BatchMatMulDescriptor::m_TransposeX, BatchMatMulDescriptor::m_TransposeY, armnn::NCHW, and QueueDescriptor::ValidateInputsOutputs().

@@ -323,21 +282,13 @@ Additional Inherited Members

Implements IWorkload.

-

Definition at line 207 of file ClBatchMatMulWorkload.cpp.

-
208 {
-
209  ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClBatchMatMulWorkload_Execute", this->GetGuid());
-
210  if (m_PermuteLayerX)
-
211  {
-
212  m_PermuteLayerX->run();
-
213  }
-
214  if (m_PermuteLayerY)
-
215  {
-
216  m_PermuteLayerY->run();
-
217  }
-
218  m_GEMMLayer->run();
-
219 }
+

Definition at line 108 of file ClBatchMatMulWorkload.cpp.

+
109 {
+
110  ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClBatchMatMulWorkload_Execute", this->GetGuid());
+
111  RunClFunction(m_MatMulLayer, CHECK_LOCATION());
+
112 }
-

References ARMNN_SCOPED_PROFILING_EVENT_CL_GUID, and BaseWorkload< BatchMatMulQueueDescriptor >::GetGuid().

+

References ARMNN_SCOPED_PROFILING_EVENT_CL_GUID, CHECK_LOCATION, BaseWorkload< BatchMatMulQueueDescriptor >::GetGuid(), and armnn::RunClFunction().

@@ -348,19 +299,13 @@ Additional Inherited Members
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:61
-
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
+
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
+
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
-
armnn::TensorShape Permuted(const armnn::TensorShape &srcShape, const armnn::PermutationVector &mappings)
Definition: Permute.cpp:98
-
DataLayout m_DataLayoutX
Data layout of each input tensor, such as NHWC/NDHWC (leave as default for arbitrary layout)
-
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:195
-
armnn::PermutationVector GeneratePermutationVectorOnLastTwoDimensions(unsigned int rank)
Generates a permutation vector of size rank that permutes the 2 most right dimensions.
- -
armnn::TensorShape ReduceDims(const armnn::TensorShape &tensorInfo, unsigned int dimensions)
- - +
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
+
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
-
std::vector< ITensorHandle * > m_Outputs
#define ARMNN_SCOPED_PROFILING_EVENT_CL_GUID(name, guid)
std::vector< ITensorHandle * > m_Inputs
@@ -369,7 +314,7 @@ Additional Inherited Members