From fd472f05dc73005a89a5e6275940ab5c9a609485 Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Wed, 15 Mar 2023 14:05:06 +0000 Subject: Add quantized support for unary elementwise in CPU * Add quantized unary elementwise in CPU using LUT. * Widen the input data range of the test suite. - Fix CPU exponential function overflow/underflow range. - Fix saturation issue of CL round operator. Resolves: COMPMID-5763 Signed-off-by: Viet-Hoa Do Change-Id: I41445de2b4a33ec6b01e0ab701516c240c852d0b Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9367 Tested-by: Arm Jenkins Reviewed-by: Jakub Sujak Reviewed-by: Pablo Marquez Tello Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- src/core/NEON/NEMath.inl | 6 +++--- src/core/NEON/SVEMath.inl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core/NEON') diff --git a/src/core/NEON/NEMath.inl b/src/core/NEON/NEMath.inl index 94bbc10ad8..8b2d1c3c37 100644 --- a/src/core/NEON/NEMath.inl +++ b/src/core/NEON/NEMath.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2022 Arm Limited. + * Copyright (c) 2016-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -158,9 +158,9 @@ inline float32x4_t vexpq_f32(float32x4_t x) const auto neg_ln2_lo = vreinterpretq_f32_u32(vdupq_n_u32(0xb5bfbe8e)); // -ln(2) from bits -20 to -42: -0x1.7f7d1cp-20f const auto inf = vdupq_n_f32(std::numeric_limits::infinity()); - const auto max_input = vdupq_n_f32(88.7f); // Approximately ln(0x1.fffffep+127) + const auto max_input = vdupq_n_f32(88.37f); // Approximately ln(2^127.5) const auto zero = vdupq_n_f32(0.f); - const auto min_input = vdupq_n_f32(-86.6f); // Approximately ln(2^-125) + const auto min_input = vdupq_n_f32(-86.64f); // Approximately ln(2^-125) // Range reduction: // e^x = 2^n * e^r diff --git a/src/core/NEON/SVEMath.inl b/src/core/NEON/SVEMath.inl index 5f41e2138d..8973d0b273 100644 --- a/src/core/NEON/SVEMath.inl +++ b/src/core/NEON/SVEMath.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022 Arm Limited. + * Copyright (c) 2020-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -96,9 +96,9 @@ inline svfloat32_t svexp_f32_z(svbool_t pg, svfloat32_t x) const auto neg_ln2_lo = svreinterpret_f32_u32(svdup_n_u32(0xb5bfbe8e)); // -ln(2) from bits -20 to -42: -0x1.7f7d1cp-20f const auto inf = svdup_n_f32(std::numeric_limits::infinity()); - const auto max_input = svdup_n_f32(88.7f); // Approximately ln(0x1.fffffep+127) + const auto max_input = svdup_n_f32(88.37f); // Approximately ln(2^127.5) const auto zero = svdup_n_f32(0.f); - const auto min_input = svdup_n_f32(-86.6f); // Approximately ln(2^-125) + const auto min_input = svdup_n_f32(-86.64f); // Approximately ln(2^-125) // Range reduction: // e^x = 2^n * e^r -- cgit v1.2.1