From 0ae31d1761b61ce0952b032816de2929e606d3c1 Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Thu, 27 Oct 2022 15:36:20 +0100 Subject: Fix fixed-point quantized addition * The range check condition is incorrect. The maximum value of 8-bit quantized data is 255, not 1023. * Use 256 to make the check slightly stricter than it should. Resolves: COMPMID-5458 Signed-off-by: Viet-Hoa Do Change-Id: I5c071680531574b409a7ce71a732f6480caa10d8 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8537 Reviewed-by: Jakub Sujak Reviewed-by: Gunes Bayir Benchmark: Arm Jenkins Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/cpu/kernels/add/generic/neon/impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu/kernels/add/generic/neon/impl.cpp b/src/cpu/kernels/add/generic/neon/impl.cpp index 0d4402e332..5adb39682e 100644 --- a/src/cpu/kernels/add/generic/neon/impl.cpp +++ b/src/cpu/kernels/add/generic/neon/impl.cpp @@ -144,7 +144,7 @@ bool add_q8_neon_fixedpoint_possible(const ITensorInfo *src0, const ITensorInfo } const auto offset = float(oq.offset) - scale0 * float(iq0.offset) - scale1 * float(iq1.offset); - const auto max_acc = (std::abs(scale0) + std::abs(scale1)) * 1024.f + std::abs(offset); + const auto max_acc = (std::abs(scale0) + std::abs(scale1)) * 256.f + std::abs(offset); if(max_acc > 2097151.f) // 2^21 - 1 { -- cgit v1.2.1