From 9e8a7701532377073220613b3642468f96cba62f Mon Sep 17 00:00:00 2001 From: Yair Schwarzbaum Date: Mon, 8 Nov 2021 10:58:06 +0200 Subject: Decouple data type for NERangeKernel - Decouple data type for CPU implementation, supported data types are: fp32, fp16, u8, u16, u32, s8, s16, s32 Resolves COMPMID-4612 Signed-off-by: Yair Schwarzbaum Change-Id: Iec9aab9f59c5a344950c788281fc500290a19bbc Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6686 Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: Giorgio Arena --- Android.bp | 4 + filelist.json | 8 +- src/core/NEON/kernels/NERangeKernel.cpp | 152 ++++++++++++------------- src/core/NEON/kernels/NERangeKernel.h | 11 +- src/cpu/kernels/range/generic/neon/fp16.cpp | 41 +++++++ src/cpu/kernels/range/generic/neon/fp32.cpp | 39 +++++++ src/cpu/kernels/range/generic/neon/impl.cpp | 93 +++++++++++++++ src/cpu/kernels/range/generic/neon/impl.h | 38 +++++++ src/cpu/kernels/range/generic/neon/integer.cpp | 64 +++++++++++ src/cpu/kernels/range/list.h | 47 ++++++++ 10 files changed, 412 insertions(+), 85 deletions(-) create mode 100644 src/cpu/kernels/range/generic/neon/fp16.cpp create mode 100644 src/cpu/kernels/range/generic/neon/fp32.cpp create mode 100644 src/cpu/kernels/range/generic/neon/impl.cpp create mode 100644 src/cpu/kernels/range/generic/neon/impl.h create mode 100644 src/cpu/kernels/range/generic/neon/integer.cpp create mode 100644 src/cpu/kernels/range/list.h diff --git a/Android.bp b/Android.bp index 98f5237274..413c388285 100644 --- a/Android.bp +++ b/Android.bp @@ -460,6 +460,10 @@ cc_library_static { "src/cpu/kernels/pool2d/neon/nchw/all.cpp", "src/cpu/kernels/pool2d/neon/qasymm8.cpp", "src/cpu/kernels/pool2d/neon/qasymm8_signed.cpp", + "src/cpu/kernels/range/generic/neon/fp16.cpp", + "src/cpu/kernels/range/generic/neon/fp32.cpp", + "src/cpu/kernels/range/generic/neon/impl.cpp", + "src/cpu/kernels/range/generic/neon/integer.cpp", "src/cpu/kernels/scale/neon/fp16.cpp", "src/cpu/kernels/scale/neon/integer.cpp", "src/cpu/kernels/scale/neon/qasymm8.cpp", diff --git a/filelist.json b/filelist.json index 549dc66ce0..0e7dd4ac4f 100644 --- a/filelist.json +++ b/filelist.json @@ -1697,7 +1697,13 @@ "common": [ "src/core/NEON/kernels/NERangeKernel.cpp", "src/runtime/NEON/functions/NERange.cpp" - ] + ], + "neon": { + "common": [ "src/cpu/kernels/range/generic/neon/impl.cpp" ], + "fp32": [ "src/cpu/kernels/range/generic/neon/fp32.cpp" ], + "fp16": [ "src/cpu/kernels/range/generic/neon/fp16.cpp" ], + "integer": [ "src/cpu/kernels/range/generic/neon/integer.cpp" ] + } } }, "Reduction":{ diff --git a/src/core/NEON/kernels/NERangeKernel.cpp b/src/core/NEON/kernels/NERangeKernel.cpp index 0395e0bd34..82d1403c56 100644 --- a/src/core/NEON/kernels/NERangeKernel.cpp +++ b/src/core/NEON/kernels/NERangeKernel.cpp @@ -30,68 +30,96 @@ #include "arm_compute/core/Validate.h" #include "src/core/NEON/NEAsymm.h" #include "src/core/NEON/wrapper/wrapper.h" +#include "src/core/common/Registrars.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/core/helpers/WindowHelpers.h" - -#include "arm_compute/core/Utils.h" +#include "src/cpu/kernels/range/list.h" namespace arm_compute { namespace { -template -void range_function(ITensor *output, float start, float step, const Window &window) +struct RangeSelectorData { - /** SIMD vector tag type. */ - using ExactTagType = typename wrapper::traits::neon_bitvector::tag_type; - - const auto step_vec = wrapper::vdup_n(static_cast(step), ExactTagType{}); - const auto start_vec = wrapper::vdup_n(static_cast(start), ExactTagType{}); - auto id_vec = wrapper::vdup_n(static_cast(0.f), ExactTagType{}); + DataType dt; +}; - const auto window_start_x = static_cast(window.x().start()); - const auto window_end_x = static_cast(window.x().end()); - const int window_step_x = 16 / sizeof(T); +using RangeSelectorPtr = std::add_pointer::type; +using RangeUKernelPtr = std::add_pointer::type; - Window win{ window }; - win.set(Window::DimX, Window::Dimension(0, 1, 1)); - Iterator output_it(output, win); +struct RangeUKernel +{ + const char *name; + const RangeSelectorPtr is_selected; + RangeUKernelPtr ukernel; +}; - execute_window_loop(win, [&](const Coordinates &) +static const RangeUKernel available_kernels[] = +{ { - int x = window_start_x; - const auto out_ptr = reinterpret_cast(output_it.ptr()); - for(; x <= (window_end_x - window_step_x); x += window_step_x) - { - for(int count = 0; count < window_step_x; ++count) - { - id_vec = wrapper::vsetlane(static_cast(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); - } + "fp16_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::F16; }, + REGISTER_FP16_NEON(arm_compute::cpu::fp16_neon_range_function) + }, + { + "f32_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::F32; }, + REGISTER_FP32_NEON(arm_compute::cpu::fp32_neon_range_function) + }, + { + "u8_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::U8; }, + REGISTER_INTEGER_NEON(arm_compute::cpu::u8_neon_range_function) + }, + { + "u16_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::U16; }, + REGISTER_INTEGER_NEON(arm_compute::cpu::u16_neon_range_function) + }, + { + "u32_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::U32; }, + REGISTER_INTEGER_NEON(arm_compute::cpu::u32_neon_range_function) + }, + { + "s8_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::S8; }, + REGISTER_INTEGER_NEON(arm_compute::cpu::s8_neon_range_function) + }, + { + "s16_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::S16; }, + REGISTER_INTEGER_NEON(arm_compute::cpu::s16_neon_range_function) + }, + { + "s32_neon_range", + [](const RangeSelectorData & data) { return data.dt == DataType::S32; }, + REGISTER_INTEGER_NEON(arm_compute::cpu::s32_neon_range_function) + }, +}; - // Compute left-over elements - for(; x < window_end_x; ++x) +/** Micro-kernel selector + * + * @param[in] data Selection data passed to help pick the appropriate micro-kernel + * + * @return A matching micro-kernel else nullptr + */ +const RangeUKernel *get_implementation(const RangeSelectorData &data) +{ + for(const auto &uk : available_kernels) + { + if(uk.is_selected(data)) { - const auto res = start + x * step; - *(out_ptr + x) = res; + return &uk; } - - }, - output_it); + } + return nullptr; } Status validate_arguments(const ITensorInfo &output, const float start, const float end, const float step) { - ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&output, - 1, - DataType::U8, DataType::S8, - DataType::U16, DataType::S16, - DataType::U32, DataType::S32, - DataType::F16, DataType::F32); + const auto *uk = get_implementation(RangeSelectorData{ output.data_type() }); + ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->ukernel == nullptr); ARM_COMPUTE_RETURN_ERROR_ON_MSG((start == end), "start of the requested sequence must not be equal to the end"); ARM_COMPUTE_RETURN_ERROR_ON_MSG(((start < end) && (step <= 0)), "step must be greater than 0 when start < end"); @@ -111,7 +139,7 @@ Status validate_arguments(const ITensorInfo &output, const float start, const fl } // namespace NERangeKernel::NERangeKernel() - : _func(nullptr), _start(0), _end(1), _step(1), _output(nullptr) + : _start(0), _end(1), _step(1), _output(nullptr) { } @@ -131,38 +159,6 @@ void NERangeKernel::configure(ITensor *output, float start, float end, float ste _end = end; _step = step; _output = output; - switch(_output->info()->data_type()) - { - case DataType::U8: - _func = &range_function; - break; - case DataType::U16: - _func = &range_function; - break; - case DataType::U32: - _func = &range_function; - break; - case DataType::S8: - _func = &range_function; - break; - case DataType::S16: - _func = &range_function; - break; - case DataType::S32: - _func = &range_function; - break; - case DataType::F32: - _func = &range_function; - break; -#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC - case DataType::F16: - _func = &range_function; - break; -#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC - default: - ARM_COMPUTE_ERROR("Unsupported data type."); - break; - } INEKernel::configure(win); } @@ -181,8 +177,8 @@ void NERangeKernel::run(const Window &window, const ThreadInfo &info) ARM_COMPUTE_UNUSED(info); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window); - ARM_COMPUTE_ERROR_ON(_func == nullptr); + const auto *uk = get_implementation(RangeSelectorData{ _output->info()->data_type() }); - (*_func)(_output, _start, _step, window); + uk->ukernel(_output, _start, _step, window); } } // namespace arm_compute diff --git a/src/core/NEON/kernels/NERangeKernel.h b/src/core/NEON/kernels/NERangeKernel.h index 7c42ef11dc..90560995e6 100644 --- a/src/core/NEON/kernels/NERangeKernel.h +++ b/src/core/NEON/kernels/NERangeKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -80,11 +80,10 @@ public: private: using RangeFunction = void(ITensor *output, float start, float step, const Window &window); - RangeFunction *_func; /**< Range function to be called */ - float _start; /**< Start of sequence */ - float _end; /**< End of sequence */ - float _step; /**< Increment/step value */ - ITensor *_output; /**< Destination tensor */ + float _start; /**< Start of sequence */ + float _end; /**< End of sequence */ + float _step; /**< Increment/step value */ + ITensor *_output; /**< Destination tensor */ }; } // namespace arm_compute #endif /* ARM_COMPUTE_NERANGEKERNEL_H */ diff --git a/src/cpu/kernels/range/generic/neon/fp16.cpp b/src/cpu/kernels/range/generic/neon/fp16.cpp new file mode 100644 index 0000000000..5d50dce907 --- /dev/null +++ b/src/cpu/kernels/range/generic/neon/fp16.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#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" + +namespace arm_compute +{ +namespace cpu +{ +void fp16_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} +} // namespace cpu +} // namespace arm_compute +#endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) */ diff --git a/src/cpu/kernels/range/generic/neon/fp32.cpp b/src/cpu/kernels/range/generic/neon/fp32.cpp new file mode 100644 index 0000000000..6044f0f886 --- /dev/null +++ b/src/cpu/kernels/range/generic/neon/fp32.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "src/cpu/kernels/range/generic/neon/impl.h" + +#include "arm_compute/core/Helpers.h" +#include "src/core/NEON/wrapper/wrapper.h" + +namespace arm_compute +{ +namespace cpu +{ +void fp32_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} +} // namespace cpu +} // namespace arm_compute diff --git a/src/cpu/kernels/range/generic/neon/impl.cpp b/src/cpu/kernels/range/generic/neon/impl.cpp new file mode 100644 index 0000000000..f91251c914 --- /dev/null +++ b/src/cpu/kernels/range/generic/neon/impl.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "src/cpu/kernels/range/generic/neon/impl.h" + +#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" + +namespace arm_compute +{ +namespace cpu +{ +template +void neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + /** SIMD vector tag type. */ + using ExactTagType = typename wrapper::traits::neon_bitvector::tag_type; + + const auto step_vec = wrapper::vdup_n(static_cast(step), ExactTagType{}); + const auto start_vec = wrapper::vdup_n(static_cast(start), ExactTagType{}); + auto id_vec = wrapper::vdup_n(static_cast(0.f), ExactTagType{}); + + const auto window_start_x = static_cast(window.x().start()); + const auto window_end_x = static_cast(window.x().end()); + const int window_step_x = 16 / sizeof(T); + + 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(output_it.ptr()); + for(; x <= (window_end_x - window_step_x); x += window_step_x) + { + for(int count = 0; count < window_step_x; ++count) + { + id_vec = wrapper::vsetlane(static_cast(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); + } + + // Compute left-over elements + for(; x < window_end_x; ++x) + { + const auto res = start + x * step; + *(out_ptr + x) = res; + } + + }, + output_it); +} + +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +template void neon_range_function(ITensor *output, float start, float step, const Window &window); + +#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) +template void neon_range_function(ITensor *output, float start, float step, const Window &window); +#endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) */ + +} // namespace cpu +} // namespace arm_compute diff --git a/src/cpu/kernels/range/generic/neon/impl.h b/src/cpu/kernels/range/generic/neon/impl.h new file mode 100644 index 0000000000..7ac2fc9c11 --- /dev/null +++ b/src/cpu/kernels/range/generic/neon/impl.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_KERNELS_RANGE_IMPL_H +#define SRC_CORE_NEON_KERNELS_RANGE_IMPL_H + +namespace arm_compute +{ +class ITensor; +class Window; + +namespace cpu +{ +template +void neon_range_function(ITensor *output, float start, float step, const Window &window); +} // namespace cpu +} // namespace arm_compute +#endif //SRC_CORE_NEON_KERNELS_RANGE_IMPL_H diff --git a/src/cpu/kernels/range/generic/neon/integer.cpp b/src/cpu/kernels/range/generic/neon/integer.cpp new file mode 100644 index 0000000000..0f3ff89b71 --- /dev/null +++ b/src/cpu/kernels/range/generic/neon/integer.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "src/cpu/kernels/range/generic/neon/impl.h" + +#include + +namespace arm_compute +{ +namespace cpu +{ +void u8_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} + +void u16_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} + +void u32_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} + +void s8_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} + +void s16_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} + +void s32_neon_range_function(ITensor *output, float start, float step, const Window &window) +{ + return neon_range_function(output, start, step, window); +} + +} // namespace cpu +} // namespace arm_compute diff --git a/src/cpu/kernels/range/list.h b/src/cpu/kernels/range/list.h new file mode 100644 index 0000000000..25d52bfe7f --- /dev/null +++ b/src/cpu/kernels/range/list.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_KERNELS_RANGE_LIST_H +#define SRC_CORE_NEON_KERNELS_RANGE_LIST_H + +namespace arm_compute +{ +namespace cpu +{ +#define DECLARE_RANGE_KERNEL(func_name) \ + void func_name(ITensor *output, float start, float step, const Window &window) + +DECLARE_RANGE_KERNEL(fp16_neon_range_function); +DECLARE_RANGE_KERNEL(fp32_neon_range_function); +DECLARE_RANGE_KERNEL(s8_neon_range_function); +DECLARE_RANGE_KERNEL(s16_neon_range_function); +DECLARE_RANGE_KERNEL(s32_neon_range_function); +DECLARE_RANGE_KERNEL(u8_neon_range_function); +DECLARE_RANGE_KERNEL(u16_neon_range_function); +DECLARE_RANGE_KERNEL(u32_neon_range_function); + +#undef DECLARE_RANGE_KERNEL + +} // namespace cpu +} // namespace arm_compute +#endif //SRC_CORE_NEON_KERNELS_RANGE_LIST_H -- cgit v1.2.1