diff options
Diffstat (limited to 'src/cpu/kernels/range/generic')
-rw-r--r-- | src/cpu/kernels/range/generic/neon/fp16.cpp | 4 | ||||
-rw-r--r-- | src/cpu/kernels/range/generic/neon/fp32.cpp | 4 | ||||
-rw-r--r-- | src/cpu/kernels/range/generic/neon/impl.h | 48 |
3 files changed, 29 insertions, 27 deletions
diff --git a/src/cpu/kernels/range/generic/neon/fp16.cpp b/src/cpu/kernels/range/generic/neon/fp16.cpp index 5d50dce907..505c18c27d 100644 --- a/src/cpu/kernels/range/generic/neon/fp16.cpp +++ b/src/cpu/kernels/range/generic/neon/fp16.cpp @@ -23,10 +23,10 @@ */ #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) -#include "src/cpu/kernels/range/generic/neon/impl.h" - #include "arm_compute/core/Helpers.h" + #include "src/core/NEON/wrapper/wrapper.h" +#include "src/cpu/kernels/range/generic/neon/impl.h" namespace arm_compute { diff --git a/src/cpu/kernels/range/generic/neon/fp32.cpp b/src/cpu/kernels/range/generic/neon/fp32.cpp index 6044f0f886..e5e472abb5 100644 --- a/src/cpu/kernels/range/generic/neon/fp32.cpp +++ b/src/cpu/kernels/range/generic/neon/fp32.cpp @@ -22,10 +22,10 @@ * SOFTWARE. */ -#include "src/cpu/kernels/range/generic/neon/impl.h" - #include "arm_compute/core/Helpers.h" + #include "src/core/NEON/wrapper/wrapper.h" +#include "src/cpu/kernels/range/generic/neon/impl.h" namespace arm_compute { diff --git a/src/cpu/kernels/range/generic/neon/impl.h b/src/cpu/kernels/range/generic/neon/impl.h index 62144e6776..f8c30d52a0 100644 --- a/src/cpu/kernels/range/generic/neon/impl.h +++ b/src/cpu/kernels/range/generic/neon/impl.h @@ -26,8 +26,9 @@ #include "arm_compute/core/Helpers.h" #include "arm_compute/core/TensorInfo.h" -#include "src/core/NEON/wrapper/wrapper.h" + #include "src/core/common/Registrars.h" +#include "src/core/NEON/wrapper/wrapper.h" namespace arm_compute { @@ -47,35 +48,36 @@ void neon_range_function(ITensor *output, float start, float step, const Window const auto window_end_x = static_cast<int>(window.x().end()); const int window_step_x = 16 / sizeof(T); - Window win{ window }; + Window win{window}; win.set(Window::DimX, Window::Dimension(0, 1, 1)); Iterator output_it(output, win); - execute_window_loop(win, [&](const Coordinates &) - { - int x = window_start_x; - const auto out_ptr = reinterpret_cast<T *>(output_it.ptr()); - for(; x <= (window_end_x - window_step_x); x += window_step_x) + execute_window_loop( + win, + [&](const Coordinates &) { - for(int count = 0; count < window_step_x; ++count) + int x = window_start_x; + const auto out_ptr = reinterpret_cast<T *>(output_it.ptr()); + for (; x <= (window_end_x - window_step_x); x += window_step_x) { - id_vec = wrapper::vsetlane(static_cast<T>(x + count), id_vec, count); - } - - // start + step * id - const auto res_vec = wrapper::vmla(start_vec, id_vec, step_vec); - wrapper::vstore(out_ptr + x, res_vec); - } + for (int count = 0; count < window_step_x; ++count) + { + id_vec = wrapper::vsetlane(static_cast<T>(x + count), id_vec, count); + } - // Compute left-over elements - for(; x < window_end_x; ++x) - { - const auto res = start + x * step; - *(out_ptr + x) = res; - } + // start + step * id + const auto res_vec = wrapper::vmla(start_vec, id_vec, step_vec); + wrapper::vstore(out_ptr + x, res_vec); + } - }, - output_it); + // Compute left-over elements + for (; x < window_end_x; ++x) + { + const auto res = start + x * step; + *(out_ptr + x) = res; + } + }, + output_it); } } // namespace cpu } // namespace arm_compute |