diff options
author | Viet-Hoa Do <viet-hoa.do@arm.com> | 2022-10-07 15:58:05 +0100 |
---|---|---|
committer | Pablo Marquez Tello <pablo.tello@arm.com> | 2022-10-10 12:24:18 +0000 |
commit | 66704133478dcb2065e6313590187315de74ec5f (patch) | |
tree | 6f1af66aed2a2d03bf814a7cf7ae2165463ce0b3 /src/cpu/kernels | |
parent | 2ffab6dc8afb3716c189a30f75c33b2f2c35a6d4 (diff) | |
download | ComputeLibrary-66704133478dcb2065e6313590187315de74ec5f.tar.gz |
Fix LUT-based activation layer
* Use the window instead of the tensor shape to determine the
number of elements in the x-dimension.
* Remove the LUT implementation in 32-bit build.
Resolves: COMPMID-5641
Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Change-Id: I0a79aa38d8f6a105ad01785bd94571f5a2ecb348
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8380
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Marquez Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/cpu/kernels')
-rw-r--r-- | src/cpu/kernels/activation/generic/neon/lut.cpp | 14 | ||||
-rw-r--r-- | src/cpu/kernels/activation/list.h | 3 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/cpu/kernels/activation/generic/neon/lut.cpp b/src/cpu/kernels/activation/generic/neon/lut.cpp index ddf7f1bd61..b5c29ce07b 100644 --- a/src/cpu/kernels/activation/generic/neon/lut.cpp +++ b/src/cpu/kernels/activation/generic/neon/lut.cpp @@ -411,11 +411,11 @@ void substitute_bytes_neon( #endif // __aarch64__ } // namespace +#ifdef __aarch64__ void neon_q8_activation_lut(const ITensor *src, ITensor *dst, const ActivationLayerInfo &act_info, const Window &window) { ARM_COMPUTE_ERROR_ON(!ActivationLayerInfo::is_lut_supported(act_info.activation(), src->info()->data_type())); -#ifdef __aarch64__ - const int window_step_x = src->info()->tensor_shape().x(); + const auto window_end_x = window.x().end(); Window win_collapsed = window.collapse_if_possible(window, Window::DimZ); win_collapsed.set(Window::DimX, Window::Dimension(0, 1, 1)); Iterator input(src, win_collapsed); @@ -424,16 +424,10 @@ void neon_q8_activation_lut(const ITensor *src, ITensor *dst, const ActivationLa { const auto input_ptr = reinterpret_cast<const uint8_t *>(input.ptr()); auto output_ptr = reinterpret_cast<uint8_t *>(output.ptr()); - substitute_bytes_neon(act_info.lut().data(), 1u, window_step_x, &input_ptr, &output_ptr); + substitute_bytes_neon(act_info.lut().data(), 1u, window_end_x, &input_ptr, &output_ptr); }, input, output); -#else // #ifdef __aarch64__ - ARM_COMPUTE_UNUSED(src); - ARM_COMPUTE_UNUSED(dst); - ARM_COMPUTE_UNUSED(act_info); - ARM_COMPUTE_UNUSED(window); - ARM_COMPUTE_ERROR("LUT Only supported in aarch64."); -#endif // __aarch64__ } +#endif // __aarch64__ } // namespace cpu } // namespace arm_compute diff --git a/src/cpu/kernels/activation/list.h b/src/cpu/kernels/activation/list.h index 3850d4de6b..c0a2446748 100644 --- a/src/cpu/kernels/activation/list.h +++ b/src/cpu/kernels/activation/list.h @@ -31,7 +31,10 @@ namespace cpu #define DECLARE_ACTIVATION_KERNEL(func_name) \ void func_name(const ITensor *src, ITensor *dst, const ActivationLayerInfo &act_info, const Window &window) +#ifdef __aarch64__ DECLARE_ACTIVATION_KERNEL(neon_q8_activation_lut); +#endif // __aarch64__ + DECLARE_ACTIVATION_KERNEL(neon_qasymm8_activation); DECLARE_ACTIVATION_KERNEL(sve2_qasymm8_activation); DECLARE_ACTIVATION_KERNEL(neon_qasymm8_signed_activation); |