MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / validate

Method validate

src/cpu/operators/CpuGemmLowpMatrixMultiplyCore.cpp:362–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362Status CpuGemmLowpMatrixMultiplyCore::validate(const ITensorInfo *a,
363 const ITensorInfo *b,
364 const ITensorInfo *c,
365 const ITensorInfo *output,
366 const GEMMInfo &gemm_info)
367{
368 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU,
369 "CpuGemmLowpMatrixMultiplyCore::validate");
370 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(a, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED);
371 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(b, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED,
372 DataType::QSYMM8, DataType::QSYMM8_PER_CHANNEL);
373 ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(output);
374 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::S32, DataType::QASYMM8,
375 DataType::QASYMM8_SIGNED, DataType::F32, DataType::F16);
376 ARM_COMPUTE_RETURN_ERROR_ON_MSG(c != nullptr && output->data_type() != DataType::F32 &&
377 gemm_info.gemmlowp_output_stage().type == GEMMLowpOutputStageType::NONE,
378 "Bias addition not supported in NEGEMMLowpMatrixMultiplyCore for output S32");
379 ARM_COMPUTE_RETURN_ERROR_ON_MSG(
380 (a)->dimension(0) != (b)->dimension(1),
381 "The product AB is defined only if the number of columns in A is equal to the number of rows in B");
382 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.is_a_reshaped(), "Matrix A already reshaped is not supported");
383 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.is_b_reshaped(), "Matrix B already reshaped is not supported");
384 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.pretranspose_A(), "Matrix A already pretransposed is not supported");
385 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.pretranspose_B(), "Matrix B already pretransposed is not supported");
386
387 if (int8_dequantize_f32_path(a->data_type(), output->data_type()))
388 {
389 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(a, 1, DataType::QASYMM8_SIGNED);
390 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(b, 1, DataType::QASYMM8_SIGNED);
391 }
392
393 // When using accumulation(in place summation), for now, the only supported DataType for output is S32.
394 if (gemm_info.accumulate())
395 {
396#ifdef __arm__
397 ARM_COMPUTE_RETURN_ERROR_MSG("Accumulation is not supported for armv7");
398#endif /* __arm__ */
399 ARM_COMPUTE_RETURN_ERROR_ON_MSG(gemm_info.gemmlowp_output_stage().type != GEMMLowpOutputStageType::NONE,
400 "Accumulation is not supported for output QASYMM8/QASYMM8_SIGNED");
401 }
402
403 GEMMInfo info = gemm_info;
404 const ITensorInfo *matrix_a_info = a;
405 const ITensorInfo *matrix_b_info = b;
406
407 const ITensorInfo *a_to_use = a;
408
409 TensorInfo tmp_a_info{};
410 TensorInfo tmp_b_info{};
411 TensorInfo mm_result_s32_info{};
412
413 int32_t a_offset = a->quantization_info().uniform().offset;
414 int32_t b_offset = b->quantization_info().uniform().offset;
415
416 bool fuse_output_stage = info.gemmlowp_output_stage().type != GEMMLowpOutputStageType::NONE;
417 if (fuse_output_stage)
418 {
419 auto_init_if_empty(mm_result_s32_info,

Callers

nothing calls this directly

Calls 15

auto_init_if_emptyFunction · 0.85
compute_reductionA_shapeFunction · 0.85
compute_reductionB_shapeFunction · 0.85
ceilFunction · 0.85
gemmlowp_output_stageMethod · 0.80
is_a_reshapedMethod · 0.80
is_b_reshapedMethod · 0.80
pretranspose_AMethod · 0.80
pretranspose_BMethod · 0.80
accumulateMethod · 0.80

Tested by

no test coverage detected