From 97a609bb9b2ad22a2ebd54493cd1374f0992eb52 Mon Sep 17 00:00:00 2001 From: Mohammed Suhail Munshi Date: Fri, 21 Oct 2022 11:15:54 +0100 Subject: Fix GemmLowp BatchMatMul Tests to use quantized Outputs - Fix includes int8/uint8 quantized inputs - Bias S32 value is limited to better allow detection of mismatches in gemmlowp kernel Resolves: [COMPMID-5659] Signed-off-by: Mohammed Suhail Munshi Change-Id: Ie9cca430c6ab66253fe1d5252bd2c5396c7f38cf Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8514 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir Benchmark: Arm Jenkins --- tests/validation/fixtures/GEMMLowpFixture.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'tests/validation/fixtures/GEMMLowpFixture.h') diff --git a/tests/validation/fixtures/GEMMLowpFixture.h b/tests/validation/fixtures/GEMMLowpFixture.h index f1ec81aae6..043fc9cb3c 100644 --- a/tests/validation/fixtures/GEMMLowpFixture.h +++ b/tests/validation/fixtures/GEMMLowpFixture.h @@ -68,6 +68,12 @@ void fill(U &&tensor, int i) library->fill(tensor, distribution, i); break; } + case DataType::S32: + { + std::uniform_int_distribution distribution(-20000, 20000); + library->fill(tensor, distribution, i); + break; + } case DataType::F16: { arm_compute::utils::uniform_real_distribution_16bit distribution{ -1.0f, 1.0f }; @@ -235,7 +241,8 @@ public: protected: TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, const TensorShape &shape_output, int32_t a_offset, int32_t b_offset) { - return compute_gemmlowp_target(shape_a, shape_b, shape_output, a_offset, b_offset); + return compute_gemmlowp_target(shape_a, shape_b, shape_output, a_offset, + b_offset); } SimpleTensor compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, const TensorShape &shape_output, int32_t a_offset, int32_t b_offset) @@ -247,7 +254,7 @@ protected: SimpleTensor _reference{}; }; -template +template class GEMMLowpMatrixMultiplyCoreFusedOffsetOutputGenericValidationFixture : public framework::Fixture { public: @@ -286,18 +293,20 @@ protected: TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, const TensorShape &shape_output, int32_t a_offset, int32_t b_offset, GEMMLowpOutputStageInfo output_stage, DataType data_type_a, DataType data_type_b, QuantizationInfo b_qinfo, bool reshape_b_only_on_first_run = false) { - return compute_gemmlowp_target(shape_a, shape_b, shape_output, a_offset, b_offset, + return compute_gemmlowp_target(shape_a, shape_b, shape_output, a_offset, + b_offset, output_stage, data_type_a, data_type_b, b_qinfo, reshape_b_only_on_first_run); } SimpleTensor compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, const TensorShape &shape_output, int32_t a_offset, int32_t b_offset, GEMMLowpOutputStageInfo output_stage, DataType data_type_a, DataType data_type_b, QuantizationInfo b_qinfo) { - SimpleTensor output = compute_gemmlowp_reference(shape_a, shape_b, shape_output, a_offset, b_offset, data_type_a, data_type_b, b_qinfo); + SimpleTensor output = compute_gemmlowp_reference(shape_a, shape_b, shape_output, a_offset, b_offset, data_type_a, data_type_b, + b_qinfo); TensorShape bias_shape(shape_b[0]); SimpleTensor bias{ bias_shape, DataType::S32, 1 }; - fill(bias, 2); + (run_twice) ? fill(bias, 5) : fill(bias, 2); // Fill bias with same seed as last run of gemmlowp_target switch(output_stage.type) { -- cgit v1.2.1