Compute Library
 23.11
CpuGemmLowpMatrixMultiplyCore.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2023 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
25 
26 #include "arm_compute/core/Error.h"
30 #include "arm_compute/core/Types.h"
35 
36 #include "src/common/utils/Log.h"
49 
51 using namespace arm_compute::experimental;
52 
53 namespace arm_compute
54 {
55 namespace cpu
56 {
57 namespace
58 {
59 cpu::AsmGemmInfo init_assembly_metadata(const GEMMInfo &info)
60 {
61  cpu::AsmGemmInfo asm_info;
62  asm_info.method = cpu::AsmConvMethod::Im2Col;
63  asm_info.reinterpret_input_as_3d = info.reinterpret_input_as_3d();
64  asm_info.depth_output_gemm3d = info.depth_output_gemm3d();
65  asm_info.activation_info = info.activation_info();
66  asm_info.output_stage = info.gemmlowp_output_stage();
67  asm_info.fast_mode = info.fast_math();
68 
69  return asm_info;
70 }
71 } // namespace
72 
73 CpuGemmLowpMatrixMultiplyCore::CpuGemmLowpMatrixMultiplyCore()
74  : _asm_glue(std::make_unique<CpuGemmAssemblyDispatch>()),
75  _mm_kernel(),
76  _mtx_a_reshape_kernel(),
77  _mtx_b_reshape_kernel(),
78  _mtx_a_reduction_kernel(),
79  _mtx_b_reduction_kernel(),
80  _offset_contribution_kernel(),
81  _offset_contribution_output_stage_kernel(),
82  _activation_func(),
83  _convert_to_signed_asymm(),
84  _convert_from_signed_asymm(),
85  _vector_sum_col(),
86  _vector_sum_row(),
87  _tmp_a(),
88  _tmp_b(),
89  _mm_result_s32(),
90  _signed_a(),
91  _signed_output(),
92  _a_offset(0),
93  _b_offset(0),
94  _run_vector_matrix_multiplication(false),
95  _assembly_path(false),
96  _fused_assembly_path(false),
97  _reshape_b_only_on_first_run(false),
98  _is_prepared(false),
99  _fuse_output_stage(false),
100  _run_activation(false),
101  _flip_signedness(false),
102  _gemm_info(),
103  _aux_mem(Count)
104 {
105 }
107 
109  const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, ITensorInfo *dst, const GEMMInfo &gemm_info)
110 {
113  ARM_COMPUTE_LOG_PARAMS(a, b, c, dst, gemm_info);
114 
115  const ITensorInfo *matrix_a = a;
116  const ITensorInfo *matrix_b = b;
117  GEMMInfo info = gemm_info;
118 
119  // Set internal variables
120  _a_offset = a->quantization_info().uniform().offset;
121  _b_offset = b->quantization_info().uniform().offset;
122  _run_vector_matrix_multiplication = a->dimension(1) < 2;
123  _reshape_b_only_on_first_run = b->are_values_constant();
124  _is_prepared = false;
125  _fused_assembly_path = false;
126  _flip_signedness = is_data_type_quantized_per_channel(b->data_type()) && (a->data_type() == DataType::QASYMM8) &&
127  _reshape_b_only_on_first_run;
128  _gemm_info = gemm_info;
129 
130  _asm_glue = std::make_unique<cpu::CpuGemmAssemblyDispatch>();
131 
132  const ITensorInfo *a_to_use = a;
133 
134  // Convert to QASYMM8 -> QASYMM8_SIGNED and back
135  if (_flip_signedness)
136  {
137  const int32_t offset_correction = 128;
139  const UniformQuantizationInfo iqinfo = a_to_use->quantization_info().uniform();
140 
141  _signed_a = a_to_use->clone()->set_data_type(dt).set_quantization_info(
142  QuantizationInfo(iqinfo.scale, iqinfo.offset + offset_correction));
143  _convert_to_signed_asymm = std::make_unique<kernels::CpuConvertQuantizedSignednessKernel>();
144  _convert_to_signed_asymm->configure(a_to_use, &_signed_a);
145  a_to_use = &_signed_a;
146  _a_offset = _signed_a.quantization_info().uniform().offset;
147 
148  const UniformQuantizationInfo oqinfo = dst->quantization_info().uniform();
149  _signed_output = dst->clone()->set_data_type(dt).set_quantization_info(
150  QuantizationInfo(oqinfo.scale, oqinfo.offset - offset_correction));
151 
152  // Output stage correction
153  GEMMLowpOutputStageInfo output_stage_corr = info.gemmlowp_output_stage();
154  output_stage_corr.gemmlowp_offset = _signed_output.quantization_info().uniform().offset;
155  output_stage_corr.gemmlowp_min_bound -= offset_correction;
156  output_stage_corr.gemmlowp_max_bound -= offset_correction;
157  info.set_gemmlowp_output_stage(output_stage_corr);
158 
159  // Update matrix a
160  matrix_a = &_signed_a;
161  }
162 
163  // If GEMMLowpOutputStage != NONE, fuse the offset contribution with the output stage
164  if (info.gemmlowp_output_stage().type != GEMMLowpOutputStageType::NONE)
165  {
166  _fuse_output_stage = true;
167  _mm_result_s32 = TensorInfo(dst->tensor_shape(), 1, DataType::S32);
168  }
169 
170  // Initialize assembly kernel meta-data
171  const cpu::AsmGemmInfo asm_info = init_assembly_metadata(gemm_info);
172 #ifdef __aarch64__
173  if (!(!b->are_values_constant() &&
174  b->tensor_shape().z() > 1)) // Disable batch matmul as optimized GeMM handles batching differently.
175  {
176  switch (a->data_type())
177  {
178  case DataType::QASYMM8:
180  case DataType::U8:
181  case DataType::S8:
182  {
183  if (is_data_type_quantized_asymmetric(a_to_use->data_type()) &&
184  info.gemmlowp_output_stage().type == GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT)
185  {
186  auto c_info_to_use = c == nullptr ? nullptr : c;
187  _asm_glue->configure(a_to_use, b, c_info_to_use, dst, asm_info);
188  _fused_assembly_path = _asm_glue->is_configured();
189  }
190  else
191  {
192  auto output_to_use = (_fuse_output_stage ? &_mm_result_s32 : dst);
193  _asm_glue->configure(a_to_use, b, nullptr, output_to_use, asm_info);
194  }
195  _assembly_path = _asm_glue->is_configured();
196  break;
197  }
198  default:
199  {
200  ARM_COMPUTE_ERROR("Datatype not supported");
201  break;
202  }
203  }
204  }
205 #endif /* __aarch64__ */
206  if (!(_assembly_path || _run_vector_matrix_multiplication))
207  {
208  matrix_a = &_tmp_a;
209  matrix_b = &_tmp_b;
210 
211  // The interleaved output matrix will have the following shape: [ a_height * 4, ceil(a_width / 4.0f) ]
212  _tmp_a =
213  TensorInfo(compute_interleaved_shape(*a_to_use), 1, a_to_use->data_type(), a_to_use->quantization_info());
214  // The transpose1xW output matrix will have the following shape: [ b_height * 16, ceil(b_width / 16.0f) ]
215  _tmp_b = TensorInfo(compute_transpose1xW_shape(*b), 1, b->data_type(), b->quantization_info());
216 
217  // Configure interleave kernel
218  _mtx_a_reshape_kernel = std::make_unique<kernels::CpuGemmInterleave4x4Kernel>();
219  _mtx_a_reshape_kernel->configure(a_to_use, &_tmp_a);
220 
221  // Configure transpose kernel
222  _mtx_b_reshape_kernel = std::make_unique<kernels::CpuGemmTranspose1xWKernel>();
223  _mtx_b_reshape_kernel->configure(b, &_tmp_b);
224  }
225 
226  if (!_fused_assembly_path)
227  {
228  // Build reduction info
229  const GEMMLowpReductionKernelInfo reduction_info(a_to_use->dimension(0), false, 0, false);
230 
231  // Initialize matrix B reduction kernel only if _a_offset is not equal to 0
232  if (_a_offset != 0)
233  {
234  _vector_sum_col = TensorInfo(compute_reductionA_shape(*b), 1, DataType::S32);
235 
236  // Configure Matrix B reduction kernel
237  _mtx_b_reduction_kernel = std::make_unique<kernels::CpuGemmLowpMatrixBReductionKernel>();
238  _mtx_b_reduction_kernel->configure(b, &_vector_sum_col, reduction_info);
239  }
240 
241  // Initialize Matrix A reduction kernel only if _b_offset is not equal to 0
242  if (_b_offset != 0)
243  {
244  _vector_sum_row = TensorInfo(compute_reductionB_shape(*a_to_use), 1, DataType::S32);
245 
246  // Configure matrix A reduction kernel
247  _mtx_a_reduction_kernel = std::make_unique<kernels::CpuGemmLowpMatrixAReductionKernel>();
248  _mtx_a_reduction_kernel->configure(a_to_use, &_vector_sum_row, reduction_info);
249  }
250 
251  if (_fuse_output_stage)
252  {
253  // Configure matrix multiply kernel
254  if (!_assembly_path)
255  {
256  _mm_kernel = std::make_unique<kernels::CpuGemmLowpMatrixMultiplyKernel>();
257  _mm_kernel->configure(matrix_a, matrix_b, &_mm_result_s32);
258  }
259 
260  _offset_contribution_output_stage_kernel =
261  std::make_unique<kernels::CpuGemmLowpOffsetContributionOutputStageKernel>();
262  _offset_contribution_output_stage_kernel->configure(
263  &_mm_result_s32, _a_offset == 0 ? nullptr : &_vector_sum_col,
264  _b_offset == 0 ? nullptr : &_vector_sum_row, c, _flip_signedness ? &_signed_output : dst,
265  a->dimension(0), _a_offset, _b_offset, info.gemmlowp_output_stage());
266 
267  if (_flip_signedness)
268  {
269  _convert_from_signed_asymm = std::make_unique<kernels::CpuConvertQuantizedSignednessKernel>();
270  _convert_from_signed_asymm->configure(&_signed_output, dst);
271  }
272  }
273  else
274  {
275  // Configure matrix multiply kernel
276  if (!_assembly_path)
277  {
278  _mm_kernel = std::make_unique<kernels::CpuGemmLowpMatrixMultiplyKernel>();
279  _mm_kernel->configure(matrix_a, matrix_b, dst);
280  }
281  // Configure offset contribution kernel
282  _offset_contribution_kernel = std::make_unique<kernels::CpuGemmLowpOffsetContributionKernel>();
283  _offset_contribution_kernel->configure(dst, _a_offset == 0 ? nullptr : &_vector_sum_col,
284  _b_offset == 0 ? nullptr : &_vector_sum_row, a_to_use->dimension(0),
285  _a_offset, _b_offset);
286  }
287  }
288  // Configure activation
289  const ActivationLayerInfo &activation = gemm_info.activation_info();
290  _run_activation =
291  activation.enabled() && (!_assembly_path || !cpu::CpuGemmAssemblyDispatch::is_activation_supported(activation));
292  if (_run_activation)
293  {
294  _activation_func = std::make_unique<CpuActivation>();
295  _activation_func->configure(dst, nullptr, activation);
296  }
297 
298  if (_assembly_path)
299  {
300  const auto asm_mem_req = _asm_glue->workspace();
301  for (unsigned int slot = 0; slot < asm_mem_req.size(); ++slot)
302  {
303  _aux_mem[slot] = asm_mem_req[slot];
304  }
305  }
306 
307  // Request memory for LHS and RHS reshape matrix
308  _aux_mem[VectorSumCol] =
309  MemoryInfo(offset_int_vec(VectorSumCol),
310  !_fused_assembly_path && _a_offset != 0 && _reshape_b_only_on_first_run ? MemoryLifetime::Persistent
311  : MemoryLifetime::Temporary,
312  _vector_sum_col.total_size());
313  _aux_mem[VectorSumRow] =
314  MemoryInfo(offset_int_vec(VectorSumRow), MemoryLifetime::Temporary, _vector_sum_row.total_size());
315  _aux_mem[TmpA] = MemoryInfo(offset_int_vec(TmpA), MemoryLifetime::Temporary, _tmp_a.total_size());
316  _aux_mem[TmpB] = MemoryInfo(offset_int_vec(TmpB),
317  _reshape_b_only_on_first_run ? MemoryLifetime::Persistent : MemoryLifetime::Temporary,
318  _tmp_b.total_size());
319  _aux_mem[MMResultS32] =
320  MemoryInfo(offset_int_vec(MMResultS32), MemoryLifetime::Temporary, _mm_result_s32.total_size());
321  _aux_mem[SignedA] = MemoryInfo(offset_int_vec(SignedA), MemoryLifetime::Temporary, _signed_a.total_size());
322  _aux_mem[SignedOutput] =
323  MemoryInfo(offset_int_vec(SignedOutput), MemoryLifetime::Temporary, _signed_output.total_size());
324 }
325 
327  const ITensorInfo *b,
328  const ITensorInfo *c,
329  const ITensorInfo *output,
330  const GEMMInfo &gemm_info)
331 {
337  ARM_COMPUTE_RETURN_ERROR_ON_MSG(c != nullptr &&
339  "Bias addition not supported in NEGEMMLowpMatrixMultiplyCore for output S32");
341  (a)->dimension(0) != (b)->dimension(1),
342  "The product AB is defined only if the number of columns in A is equal to the number of rows in B");
343  ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.is_a_reshaped(), "Matrix A already reshaped is not supported");
344  ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.is_b_reshaped(), "Matrix B already reshaped is not supported");
345 
346  GEMMInfo info = gemm_info;
347  const ITensorInfo *matrix_a_info = a;
348  const ITensorInfo *matrix_b_info = b;
349 
350  const ITensorInfo *a_to_use = a;
351 
352  TensorInfo tmp_a_info{};
353  TensorInfo tmp_b_info{};
354  TensorInfo mm_result_s32_info{};
355 
356  int32_t a_offset = a->quantization_info().uniform().offset;
357  int32_t b_offset = b->quantization_info().uniform().offset;
358 
359  bool fuse_output_stage = info.gemmlowp_output_stage().type != GEMMLowpOutputStageType::NONE;
360  if (fuse_output_stage)
361  {
362  auto_init_if_empty(mm_result_s32_info,
363  a->clone()->set_tensor_shape(output->tensor_shape()).set_data_type(DataType::S32));
364  }
365 
366  // Convert QASYMM8->QASYMM8_SIGNED
367  TensorInfo signed_a{};
368  TensorInfo signed_output{};
369  bool flip_signedness = is_data_type_quantized_per_channel(b->data_type()) &&
370  (a->data_type() == DataType::QASYMM8) && info.reshape_b_only_on_first_run();
371  if (flip_signedness)
372  {
373  const int32_t offset_correction = 128;
375  const UniformQuantizationInfo iqinfo = a_to_use->quantization_info().uniform();
376 
377  signed_a = a_to_use->clone()->set_data_type(dt).set_quantization_info(
378  QuantizationInfo(iqinfo.scale, iqinfo.offset + offset_correction));
380  a_to_use = &signed_a;
381  a_offset = signed_a.quantization_info().uniform().offset;
382 
383  const UniformQuantizationInfo oqinfo = output->quantization_info().uniform();
384  signed_output = output->clone()->set_data_type(dt).set_quantization_info(
385  QuantizationInfo(oqinfo.scale, oqinfo.offset - offset_correction));
386 
387  // Output stage correction
388  GEMMLowpOutputStageInfo output_stage_corr = info.gemmlowp_output_stage();
389  output_stage_corr.gemmlowp_offset = signed_output.quantization_info().uniform().offset;
390  output_stage_corr.gemmlowp_min_bound -= offset_correction;
391  output_stage_corr.gemmlowp_max_bound -= offset_correction;
392  info.set_gemmlowp_output_stage(output_stage_corr);
393 
394  // Update matrix a
395  matrix_a_info = &signed_a;
396  }
397 
398  // Initialize assembly kernel meta-data
399  const AsmGemmInfo asm_info = init_assembly_metadata(info);
400 
401  // Check if we need to run the optimized assembly kernel
402  bool run_optimised = false;
403  bool run_optimised_requantized = false;
404 
405  if (!(!b->are_values_constant() &&
406  b->tensor_shape().z() > 1)) // Disable batch matmul as optimized GeMM handles batching differently.
407  {
408  if (is_data_type_quantized_asymmetric(a_to_use->data_type()) &&
409  info.gemmlowp_output_stage().type == GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT)
410  {
411  run_optimised = bool(CpuGemmAssemblyDispatch::validate(a_to_use, b, c, output, asm_info));
412  run_optimised_requantized = run_optimised;
413  }
414  else
415  {
416  run_optimised = bool(CpuGemmAssemblyDispatch::validate(
417  a_to_use, b, nullptr, fuse_output_stage ? &mm_result_s32_info : output, asm_info));
418  }
419  }
420 
421  if (run_optimised)
422  {
423  ARM_COMPUTE_RETURN_ERROR_ON(b->dimension(0) != output->dimension(0));
424  if (info.depth_output_gemm3d() != 0)
425  {
426  if (info.reinterpret_input_as_3d())
427  {
428  ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(1) != output->dimension(1));
429  ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(2) != output->dimension(2));
430  }
431  else
432  {
433  ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(1) != output->dimension(1) * output->dimension(2));
434  }
435  }
436  else
437  {
438  ARM_COMPUTE_RETURN_ERROR_ON(a->dimension(1) != output->dimension(1));
439  }
440  }
441  else
442  {
443  ARM_COMPUTE_RETURN_ERROR_ON_MSG(info.reinterpret_input_as_3d(),
444  "NEGEMM cannot reinterpret the input tensor as 3D");
445  ARM_COMPUTE_RETURN_ERROR_ON_MSG(info.depth_output_gemm3d() != 0,
446  "NEGEMM cannot reinterpret the output tensor as 3D");
447 
448  const bool run_vector_matrix_multiplication = a->dimension(1) < 2;
449  if (!run_vector_matrix_multiplication)
450  {
451  matrix_a_info = &tmp_a_info;
452  matrix_b_info = &tmp_b_info;
453 
454  // The interleaved output matrix will have the following shape: [ a_height * 4, ceil(a_width / 4.0f) ]
455  TensorShape shape_tmp_a = a->tensor_shape();
456  shape_tmp_a.set(0, a->dimension(0) * 4);
457  shape_tmp_a.set(1, std::ceil(a->dimension(1) / 4.f));
458 
459  // The transpose1xW output matrix will have the following shape: [ b_height * 16, ceil(b_width / 16.0f) ]
460  TensorShape shape_tmp_b = b->tensor_shape();
461  shape_tmp_b.set(0, b->dimension(1) * 16);
462  shape_tmp_b.set(1, std::ceil(b->dimension(0) / 16.f));
463 
464  // Validate interleave kernel
465  auto_init_if_empty(tmp_a_info, a_to_use->clone()->set_tensor_shape(shape_tmp_a));
466  auto_init_if_empty(tmp_b_info, b->clone()->set_tensor_shape(shape_tmp_b));
467 
470  }
471  }
472 
473  if (!run_optimised_requantized)
474  {
475  TensorInfo info_vector_sum_col{};
476  TensorInfo info_vector_sum_row{};
477 
478  const GEMMLowpReductionKernelInfo reduction_info(a_to_use->dimension(0), false, 0, false);
479 
480  // Validate matrix B reduction kernel only if _a_offset is not equal to 0
481  if (a_offset != 0)
482  {
483  info_vector_sum_col = TensorInfo(compute_reductionA_shape(*b), 1, DataType::S32);
484 
485  // Configure Matrix B reduction kernel
487  kernels::CpuGemmLowpMatrixBReductionKernel::validate(b, &info_vector_sum_col, reduction_info));
488  }
489 
490  // Validate Matrix A reduction kernel only if _b_offset is not equal to 0
491  if (b_offset != 0)
492  {
493  info_vector_sum_row = TensorInfo(compute_reductionB_shape(*a), 1, DataType::S32);
494 
495  // Configure matrix A reduction kernel
497  kernels::CpuGemmLowpMatrixAReductionKernel::validate(a_to_use, &info_vector_sum_row, reduction_info));
498  }
499 
500  if (fuse_output_stage)
501  {
502  if (!run_optimised)
503  {
505  info.reinterpret_input_as_3d(),
506  "CpuGemmLowpMatrixMultiplyKernel cannot reinterpret the input tensor as 3D");
508  info.depth_output_gemm3d() != 0,
509  "CpuGemmLowpMatrixMultiplyKernel cannot reinterpret the output tensor as 3D");
510 
512  matrix_a_info, matrix_b_info, &mm_result_s32_info));
513  }
514 
515  // Validate offset contribution kernel
517  &mm_result_s32_info, a_offset == 0 ? nullptr : &info_vector_sum_col,
518  b_offset == 0 ? nullptr : &info_vector_sum_row, c, flip_signedness ? &signed_output : output, a_offset,
519  b_offset, info.gemmlowp_output_stage()));
520  }
521  else
522  {
523  if (!run_optimised)
524  {
526  info.reinterpret_input_as_3d(),
527  "CpuGemmLowpMatrixMultiplyKernel cannot reinterpret the input tensor as 3D");
529  info.depth_output_gemm3d() != 0,
530  "CpuGemmLowpMatrixMultiplyKernel cannot reinterpret the output tensor as 3D");
531 
533  kernels::CpuGemmLowpMatrixMultiplyKernel::validate(matrix_a_info, matrix_b_info, output));
534  }
535  // Validate offset contribution kernel
537  output, a_offset == 0 ? nullptr : &info_vector_sum_col, b_offset == 0 ? nullptr : &info_vector_sum_row,
538  a_offset, b_offset));
539  }
540  }
541 
542  // Validate activation
543  const ActivationLayerInfo &activation = gemm_info.activation_info();
544  if (activation.enabled())
545  {
546  ARM_COMPUTE_RETURN_ON_ERROR(CpuActivation::validate(output, nullptr, activation));
547  }
548 
549  return Status{};
550 }
551 
553 {
554  prepare(tensors);
555 
556  auto a = tensors.get_const_tensor(TensorType::ACL_SRC_0);
557  auto b = tensors.get_const_tensor(TensorType::ACL_SRC_1);
558  auto c = tensors.get_const_tensor(TensorType::ACL_SRC_2);
559  auto dst = tensors.get_tensor(TensorType::ACL_DST);
560  auto a_to_use = a;
561  auto matrix_a = a;
562  auto matrix_b = b;
563 
564  CpuAuxTensorHandler vector_sum_col(offset_int_vec(VectorSumCol), _vector_sum_col, tensors, false);
565  CpuAuxTensorHandler vector_sum_row(offset_int_vec(VectorSumRow), _vector_sum_row, tensors, false);
566  CpuAuxTensorHandler tmp_a(offset_int_vec(TmpA), _tmp_a, tensors, false);
567  CpuAuxTensorHandler tmp_b(offset_int_vec(TmpB), _tmp_b, tensors, true);
568  CpuAuxTensorHandler mm_result_s32(offset_int_vec(MMResultS32), _mm_result_s32, tensors, false);
569  CpuAuxTensorHandler signed_a(offset_int_vec(SignedA), _signed_a, tensors, false);
570  CpuAuxTensorHandler signed_output(offset_int_vec(SignedOutput), _signed_output, tensors, false);
571 
572  // Convert QASYMM8->QASYMM8_SIGNED
573  if (_flip_signedness)
574  {
576  NEScheduler::get().schedule_op(_convert_to_signed_asymm.get(), Window::DimY, _convert_to_signed_asymm->window(),
577  pack);
578  a_to_use = signed_a.get();
579  matrix_a = signed_a.get();
580  }
581 
582  // Run GEMM
583  if (_asm_glue->is_configured())
584  {
585  ITensorPack asm_glue_tensors = tensors;
586  auto output_to_use = (_fuse_output_stage ? mm_result_s32.get() : dst);
587  if (is_data_type_quantized_asymmetric(a_to_use->info()->data_type()) &&
589  {
590  asm_glue_tensors.add_const_tensor(TensorType::ACL_SRC_0, a_to_use);
591  asm_glue_tensors.add_const_tensor(TensorType::ACL_SRC_1, b);
592  asm_glue_tensors.add_const_tensor(TensorType::ACL_SRC_2, c);
593  asm_glue_tensors.add_tensor(TensorType::ACL_DST, dst);
594  }
595  else
596  {
597  asm_glue_tensors.add_const_tensor(TensorType::ACL_SRC_0, a_to_use);
598  asm_glue_tensors.add_const_tensor(TensorType::ACL_SRC_1, b);
599  asm_glue_tensors.add_tensor(TensorType::ACL_DST, output_to_use);
600  }
601  _asm_glue->run(asm_glue_tensors);
602  }
603  else
604  {
605  if (!_run_vector_matrix_multiplication)
606  {
607  matrix_a = tmp_a.get();
608  matrix_b = tmp_b.get();
609  // Run interleave kernel
610  ITensorPack pack_a = {{TensorType::ACL_SRC, a_to_use}, {TensorType::ACL_DST, tmp_a.get()}};
611  NEScheduler::get().schedule_op(_mtx_a_reshape_kernel.get(), Window::DimY, _mtx_a_reshape_kernel->window(),
612  pack_a);
613 
614  if (!_reshape_b_only_on_first_run)
615  {
616  ITensorPack pack_b = {{TensorType::ACL_SRC, b}, {TensorType::ACL_DST, tmp_b.get()}};
617  // Run transpose kernel
618  NEScheduler::get().schedule_op(_mtx_b_reshape_kernel.get(), Window::DimY,
619  _mtx_b_reshape_kernel->window(), pack_b);
620  }
621  }
622  ITensorPack pack_mm = {{TensorType::ACL_SRC_0, matrix_a}, {TensorType::ACL_SRC_1, matrix_b}};
623  if (_fuse_output_stage)
624  {
625  pack_mm.add_tensor(TensorType::ACL_DST, mm_result_s32.get());
626  }
627  else
628  {
630  }
631  NEScheduler::get().schedule_op(_mm_kernel.get(), Window::DimY, _mm_kernel->window(), pack_mm);
632  }
633 
634  if (!_fused_assembly_path)
635  {
636  // Run matrix A reduction kernel only if _b_offset is not equal to 0
637  if (_b_offset != 0)
638  {
639  ITensorPack pack = {{TensorType::ACL_SRC, a_to_use}, {TensorType::ACL_DST, vector_sum_row.get()}};
640  NEScheduler::get().schedule_op(_mtx_a_reduction_kernel.get(), Window::DimX,
641  _mtx_a_reduction_kernel->window(), pack);
642  }
643 
644  // Run matrix B reduction kernel only if _a_offset is not equal to 0
645  if (_a_offset != 0 && !_reshape_b_only_on_first_run)
646  {
647  ITensorPack pack = {{TensorType::ACL_SRC, b}, {TensorType::ACL_DST, vector_sum_col.get()}};
648  NEScheduler::get().schedule_op(_mtx_b_reduction_kernel.get(), Window::DimX,
649  _mtx_b_reduction_kernel->window(), pack);
650  }
651 
652  if (_fuse_output_stage)
653  {
655  pack.add_tensor(TensorType::ACL_SRC_0, mm_result_s32.get());
656  pack.add_tensor(TensorType::ACL_SRC_1, _a_offset == 0 ? nullptr : vector_sum_col.get());
657  pack.add_tensor(TensorType::ACL_SRC_2, _b_offset == 0 ? nullptr : vector_sum_row.get());
659  pack.add_tensor(TensorType::ACL_DST, _flip_signedness ? signed_output.get() : dst);
660 
661  // Run offset contribution kernel
662  NEScheduler::get().schedule_op(_offset_contribution_output_stage_kernel.get(), Window::DimY,
663  _offset_contribution_output_stage_kernel->window(), pack);
664  }
665  else
666  {
668  pack.add_tensor(TensorType::ACL_SRC_0, _a_offset == 0 ? nullptr : vector_sum_col.get());
669  pack.add_tensor(TensorType::ACL_SRC_1, _b_offset == 0 ? nullptr : vector_sum_row.get());
671 
672  // Run offset contribution kernel
673  NEScheduler::get().schedule_op(_offset_contribution_kernel.get(), Window::DimY,
674  _offset_contribution_kernel->window(), pack);
675  }
676  }
677 
678  // Convert QASYMM8_SIGNED->QASYMM8
679  if (!_fused_assembly_path && _fuse_output_stage && _flip_signedness)
680  {
681  ITensorPack pack = {{TensorType::ACL_SRC, signed_output.get()}, {TensorType::ACL_DST, dst}};
682  NEScheduler::get().schedule_op(_convert_from_signed_asymm.get(), Window::DimY,
683  _convert_from_signed_asymm->window(), pack);
684  }
685 
686  // Run fused activation unless already run in the fused assembly
687  if (_run_activation)
688  {
690  _activation_func->run(pack);
691  }
692 }
693 
695 {
696  if (!_is_prepared)
697  {
698  auto original_b = tensors.get_const_tensor(TensorType::ACL_SRC_1);
699  // Run assembly reshape
700  if (_asm_glue->is_configured())
701  {
702  _asm_glue->prepare(tensors);
703  }
704  // Run non-assembly reshape
705  else if (_reshape_b_only_on_first_run && !_run_vector_matrix_multiplication && !_asm_glue->is_configured())
706  {
707  // Run reshape kernel and mark original weights tensor as unused
708  ITensor *tmp_b_p = utils::cast::polymorphic_downcast<ITensor *>(tensors.get_tensor(offset_int_vec(TmpB)));
709  CpuAuxTensorHandler tmp_b(_tmp_b, *tmp_b_p);
710  ITensorPack pack = {{TensorType::ACL_SRC, original_b}, {TensorType::ACL_DST, tmp_b.get()}};
711  NEScheduler::get().schedule_op(_mtx_b_reshape_kernel.get(), Window::DimY, _mtx_b_reshape_kernel->window(),
712  pack);
713  }
714 
715  // Run matrix B reduction kernel only if _a_offset is not equal to 0
716  if (!_fused_assembly_path && _a_offset != 0 && _reshape_b_only_on_first_run)
717  {
718  ITensor *vector_sum_col_p =
719  utils::cast::polymorphic_downcast<ITensor *>(tensors.get_tensor(offset_int_vec(VectorSumCol)));
720  CpuAuxTensorHandler vector_sum_col(_vector_sum_col, *vector_sum_col_p);
721  ITensorPack pack = {{TensorType::ACL_SRC, original_b}, {TensorType::ACL_DST, vector_sum_col.get()}};
722  NEScheduler::get().schedule_op(_mtx_b_reduction_kernel.get(), Window::DimX,
723  _mtx_b_reduction_kernel->window(), pack);
724  }
725  _is_prepared = true;
726  }
727 }
729 {
730  return _aux_mem;
731 }
732 } // namespace cpu
733 } // namespace arm_compute
arm_compute::DataType::QSYMM8_PER_CHANNEL
@ QSYMM8_PER_CHANNEL
quantized, symmetric per channel fixed-point 8-bit number
arm_compute::cpu::CpuAuxTensorHandler
Definition: CpuAuxTensorHandler.h:39
arm_compute::experimental::MemoryRequirements
std::vector< MemoryInfo > MemoryRequirements
Definition: Types.h:123
CpuGemmLowpMatrixReductionKernel.h
arm_compute::misc::shape_calculator::compute_transpose1xW_shape
TensorShape compute_transpose1xW_shape(const ITensorInfo &b)
Calculate the transposed 1xW shape.
Definition: ShapeCalculator.h:306
arm_compute::UniformQuantizationInfo::offset
int32_t offset
Definition: QuantizationInfo.h:63
arm_compute::ITensorInfo::tensor_shape
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
arm_compute::QuantizationInfo
Quantization information.
Definition: QuantizationInfo.h:67
arm_compute::cpu::CpuGemmLowpMatrixMultiplyCore::prepare
void prepare(ITensorPack &tensors) override
Prepare the function for executing.
Definition: CpuGemmLowpMatrixMultiplyCore.cpp:694
Helpers.h
CpuGemmAssemblyDispatch.h
arm_compute::GEMMLowpOutputStageInfo
GEMMLowp output stage info.
Definition: GEMMInfo.h:45
arm_compute::GEMMLowpOutputStageInfo::gemmlowp_offset
int32_t gemmlowp_offset
GEMMLowp output stage offset used for quantizing to QASYMM8.
Definition: GEMMInfo.h:48
arm_compute::DataType::QASYMM8
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
arm_compute::TensorShape
Shape of a tensor.
Definition: TensorShape.h:39
arm_compute::IScheduler::schedule_op
virtual void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors)=0
Runs the kernel in the same thread as the caller synchronously.
arm_compute::test::validation::dst
auto dst
Definition: DFT.cpp:170
arm_compute::cpu::CpuGemmLowpMatrixMultiplyCore::validate
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *dst, const GEMMInfo &gemm_info=GEMMInfo())
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpMatrixMultiplyCore.cpp:326
arm_compute::GEMMLowpOutputStageInfo::type
GEMMLowpOutputStageType type
GEMMLowp output stage type.
Definition: GEMMInfo.h:47
arm_compute::GEMMInfo::is_a_reshaped
bool is_a_reshaped() const
Flag which specifies if the matrix A has been reshaped.
Definition: GEMMInfo.h:145
arm_compute::DataType::QSYMM8
@ QSYMM8
quantized, symmetric fixed-point 8-bit number
Types.h
arm_compute::Window::DimX
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
arm_compute::cpu::CpuActivation::validate
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ActivationLayerInfo &act_info)
Static function to check if given info will lead to a valid configuration.
Definition: CpuActivation.cpp:47
CpuGemmTranspose1xWKernel.h
ARM_COMPUTE_ERROR
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:354
arm_compute::cpu::AsmGemmInfo
Definition: CpuGemmAssemblyDispatch.h:44
arm_compute::ITensor
Interface for CPU tensor.
Definition: ITensor.h:36
arm_compute::TensorInfo::quantization_info
QuantizationInfo quantization_info() const override
Get the quantization settings (scale and offset) of the tensor.
Definition: TensorInfo.h:299
arm_compute::misc::shape_calculator::compute_reductionA_shape
TensorShape compute_reductionA_shape(const ITensorInfo &b)
Calculate the reductionA shape used in GEMMLowp.
Definition: ShapeCalculator.h:343
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:38
arm_compute::GEMMInfo
GEMM information class.
Definition: GEMMInfo.h:69
arm_compute::ITensorPack::get_tensor
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
Definition: ITensorPack.cpp:63
arm_compute::ACL_SRC_3
@ ACL_SRC_3
Definition: Types.h:48
arm_compute::ACL_SRC_0
@ ACL_SRC_0
Definition: Types.h:45
arm_compute::GEMMLowpReductionKernelInfo
Definition: KernelDescriptors.h:177
arm_compute::UniformQuantizationInfo
Quantization info when assuming per layer quantization.
Definition: QuantizationInfo.h:42
Error.h
arm_compute::cpu::CpuAuxTensorHandler::get
ITensor * get()
Definition: CpuAuxTensorHandler.h:105
arm_compute::ACL_SRC_1
@ ACL_SRC_1
Definition: Types.h:46
arm_compute::DataType::S8
@ S8
signed 8-bit number
arm_compute::cpu::kernels::CpuGemmTranspose1xWKernel::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuGemmTranspose1xWKerne...
Definition: CpuGemmTranspose1xWKernel.cpp:61
CpuGemmLowpMatrixMultiplyCore.h
CpuGemmLowpOffsetContributionKernel.h
arm_compute::ITensorPack::add_const_tensor
void add_const_tensor(int id, const ITensor *tensor)
Add const tensor to the pack.
Definition: ITensorPack.cpp:48
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:952
arm_compute::ACL_SRC_2
@ ACL_SRC_2
Definition: Types.h:47
arm_compute::cpu::kernels::CpuConvertQuantizedSignednessKernel::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration.
Definition: CpuConvertQuantizedSignednessKernel.cpp:87
arm_compute::GEMMLowpOutputStageInfo::gemmlowp_max_bound
int32_t gemmlowp_max_bound
GEMMLowp max value used to saturate down the output result before converting back to QASYMM8.
Definition: GEMMInfo.h:54
ARM_COMPUTE_RETURN_ON_ERROR
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:205
arm_compute::ITensorInfo::dimension
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
arm_compute::ActivationLayerInfo
Activation Layer Information class.
Definition: ActivationLayerInfo.h:55
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
arm_compute::experimental::MemoryInfo
Definition: Types.h:91
arm_compute::cpu::CpuGemmLowpMatrixMultiplyCore::~CpuGemmLowpMatrixMultiplyCore
~CpuGemmLowpMatrixMultiplyCore()
Destructor.
TensorAllocator.h
arm_compute::misc::shape_calculator::compute_interleaved_shape
TensorShape compute_interleaved_shape(const ITensorInfo &a, int mult_interleave4x4_height=1, bool reinterpret_input_as_3d=false)
Calculate the interleaved shape of an input tensor.
Definition: ShapeCalculator.h:270
arm_compute::ITensorPack::get_const_tensor
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
Definition: ITensorPack.cpp:53
ARM_COMPUTE_ERROR_THROW_ON
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
arm_compute::ActivationLayerInfo::enabled
bool enabled() const
Check if initialised.
Definition: ActivationLayerInfo.h:90
arm_compute::ITensorPack
Tensor packing service.
Definition: ITensorPack.h:39
CpuActivation.h
CpuGemmInterleave4x4Kernel.h
ARM_COMPUTE_RETURN_ERROR_ON
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:298
CpuGemmLowpMatrixMultiplyKernel.h
arm_compute::cpu::CpuGemmLowpMatrixMultiplyCore::configure
void configure(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, ITensorInfo *dst, const GEMMInfo &gemm_info=GEMMInfo())
Initialise the kernel's inputs, output.
Definition: CpuGemmLowpMatrixMultiplyCore.cpp:108
arm_compute::TensorInfo::total_size
size_t total_size() const override
Returns the total size of the tensor in bytes.
Definition: TensorInfo.h:261
arm_compute::ACL_DST
@ ACL_DST
Definition: Types.h:55
arm_compute::auto_init_if_empty
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
Definition: AutoConfiguration.h:43
arm_compute::DataType::U8
@ U8
unsigned 8-bit number
arm_compute::Scheduler::get
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94
arm_compute::Status
Status class.
Definition: Error.h:52
arm_compute::DataType::QASYMM8_SIGNED
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
CpuAuxTensorHandler.h
arm_compute::cpu::kernels::CpuGemmLowpMatrixMultiplyKernel::validate
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpMatrixMultiplyKernel.cpp:746
arm_compute::ITensorInfo::data_type
virtual DataType data_type() const =0
Data type used for each element of the tensor.
arm_compute::is_data_type_quantized_per_channel
bool is_data_type_quantized_per_channel(DataType dt)
Check if a given data type is of per channel type.
Definition: DataTypeUtils.h:401
arm_compute::cpu::CpuGemmAssemblyDispatch
Assembly kernel glue.
Definition: CpuGemmAssemblyDispatch.h:70
arm_compute::cpu::AsmConvMethod::Im2Col
@ Im2Col
arm_compute::QuantizationInfo::uniform
UniformQuantizationInfo uniform() const
Return per layer quantization info.
Definition: QuantizationInfo.h:140
arm_compute::cpu::kernels::CpuGemmLowpMatrixBReductionKernel::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const GEMMLowpReductionKernelInfo &info)
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpMatrixReductionKernel.cpp:248
arm_compute::GEMMInfo::is_b_reshaped
bool is_b_reshaped() const
Flag which specifies if the matrix B has been reshaped.
Definition: GEMMInfo.h:153
arm_compute::test::validation::pack
ITensorPack pack
Definition: Im2Col.cpp:188
dt
DataType dt
Definition: NEBatchNormalizationLayerKernel.cpp:50
arm_compute::cpu::CpuGemmLowpMatrixMultiplyCore::run
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
Definition: CpuGemmLowpMatrixMultiplyCore.cpp:552
arm_compute::Window::DimY
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Definition: Window.h:45
arm_compute::misc::shape_calculator::compute_reductionB_shape
TensorShape compute_reductionB_shape(const ITensorInfo &a)
Calculate the reductionB shape used in GEMMLowp.
Definition: ShapeCalculator.h:360
arm_compute::GEMMLowpOutputStageType::NONE
@ NONE
No quantization.
AutoConfiguration.h
arm_compute::ITensorInfo::quantization_info
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
arm_compute::cpu::kernels::CpuGemmLowpOffsetContributionOutputStageKernel::validate
static Status validate(const ITensorInfo *mm_result, const ITensorInfo *vector_sum_col, const ITensorInfo *vector_sum_row, const ITensorInfo *bias, const ITensorInfo *dst, int32_t a_offset, int32_t b_offset, GEMMLowpOutputStageInfo output_stage)
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpOffsetContributionOutputStageKernel.cpp:946
CpuGemmLowpOffsetContributionOutputStageKernel.h
MemoryHelpers.h
arm_compute::experimental
Definition: Types.h:83
arm_compute::misc::ICloneable::clone
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
NEScheduler.h
ShapeCalculator.h
arm_compute::TensorInfo
Store the tensor's metadata.
Definition: TensorInfo.h:41
arm_compute::UniformQuantizationInfo::scale
float scale
Definition: QuantizationInfo.h:62
arm_compute::offset_int_vec
int offset_int_vec(int offset)
Definition: MemoryHelpers.h:38
KernelDescriptors.h
arm_compute::cpu::kernels::CpuGemmLowpOffsetContributionKernel::validate
static Status validate(const ITensorInfo *mm_result, const ITensorInfo *vector_sum_col, const ITensorInfo *vector_sum_row, int32_t a_offset, int32_t b_offset)
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpOffsetContributionKernel.cpp:389
arm_compute::cpu::kernels::CpuGemmInterleave4x4Kernel::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuGemmInterleave4x4Kern...
Definition: CpuGemmInterleave4x4Kernel.cpp:58
CpuConvertQuantizedSignednessKernel.h
arm_compute::test::validation::b
SimpleTensor< float > b
Definition: DFT.cpp:157
ARM_COMPUTE_RETURN_ERROR_ON_MSG
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Definition: Error.h:245
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::cpu::CpuGemmAssemblyDispatch::is_activation_supported
static bool is_activation_supported(const ActivationLayerInfo &activation)
Checks if activation is supported by the gemm assembly dispatcher.
Definition: CpuGemmAssemblyDispatch.cpp:968
arm_compute::DataType::S32
@ S32
signed 32-bit number
Log.h
arm_compute::is_data_type_quantized_asymmetric
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Definition: DataTypeUtils.h:346
arm_compute::GEMMLowpOutputStageInfo::gemmlowp_min_bound
int32_t gemmlowp_min_bound
GEMMLowp min value used to saturate down the output result before converting back to QASYMM8.
Definition: GEMMInfo.h:51
arm_compute::ACL_SRC
@ ACL_SRC
Definition: Types.h:44
arm_compute::ITensorInfo
Store the tensor's metadata.
Definition: ITensorInfo.h:44
arm_compute::misc::shape_calculator
Definition: ShapeCalculator.h:41
ITensor.h
arm_compute::test::validation::info
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
arm_compute::TensorShape::set
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:78
arm_compute::cpu::CpuGemmLowpMatrixMultiplyCore::workspace
experimental::MemoryRequirements workspace() const override
Return the memory requirements required by the workspace.
Definition: CpuGemmLowpMatrixMultiplyCore.cpp:728
arm_compute::GEMMInfo::activation_info
ActivationLayerInfo activation_info() const
Activation layer to apply after the matrix multiplication.
Definition: GEMMInfo.h:277
arm_compute::cpu::CpuGemmAssemblyDispatch::validate
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *d, const AsmGemmInfo &info)
Indicates whether or not this function can be used to process the given parameters.
Definition: CpuGemmAssemblyDispatch.cpp:909
ARM_COMPUTE_LOG_PARAMS
#define ARM_COMPUTE_LOG_PARAMS(...)
Definition: Log.h:35
Validate.h
arm_compute::GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT
@ QUANTIZE_DOWN_FIXEDPOINT
Quantize using a fixed point multiplication.
arm_compute::DataType
DataType
Available data types.
Definition: CoreTypes.h:83
arm_compute::cpu::kernels::CpuGemmLowpMatrixAReductionKernel::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const GEMMLowpReductionKernelInfo &info)
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpMatrixReductionKernel.cpp:114
arm_compute::GEMMInfo::gemmlowp_output_stage
GEMMLowpOutputStageInfo gemmlowp_output_stage() const
GEMMLowp output stage.
Definition: GEMMInfo.h:195