From 143310c6ec5e7c9f6035e9357bf0faa4020f2412 Mon Sep 17 00:00:00 2001 From: Dana Zlotnik Date: Thu, 30 Dec 2021 13:24:52 +0200 Subject: Decouple NEMaxUnpoolingLayerKernel Resolves COMPMID-4619 Change-Id: I9c43dcd3fb3a688e1c0ccc858a02376741381ba7 Signed-off-by: Dana Zlotnik Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6874 Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena Comments-Addressed: Arm Jenkins --- Android.bp | 5 + filelist.json | 9 +- .../NEON/kernels/NEMaxUnpoolingLayerKernel.cpp | 109 +++++++++++++-------- src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.h | 9 +- src/cpu/kernels/maxunpool/generic/neon/fp16.cpp | 36 +++++++ src/cpu/kernels/maxunpool/generic/neon/fp32.cpp | 34 +++++++ src/cpu/kernels/maxunpool/generic/neon/impl.cpp | 54 ++++++++++ src/cpu/kernels/maxunpool/generic/neon/impl.h | 39 ++++++++ src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp | 34 +++++++ .../maxunpool/generic/neon/qasymm8_signed.cpp | 34 +++++++ src/cpu/kernels/maxunpool/list.h | 39 ++++++++ 11 files changed, 356 insertions(+), 46 deletions(-) create mode 100644 src/cpu/kernels/maxunpool/generic/neon/fp16.cpp create mode 100644 src/cpu/kernels/maxunpool/generic/neon/fp32.cpp create mode 100644 src/cpu/kernels/maxunpool/generic/neon/impl.cpp create mode 100644 src/cpu/kernels/maxunpool/generic/neon/impl.h create mode 100644 src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp create mode 100644 src/cpu/kernels/maxunpool/generic/neon/qasymm8_signed.cpp create mode 100644 src/cpu/kernels/maxunpool/list.h diff --git a/Android.bp b/Android.bp index 4d5f2bdf68..f5db63b35c 100644 --- a/Android.bp +++ b/Android.bp @@ -463,6 +463,11 @@ cc_library_static { "src/cpu/kernels/floor/neon/fp32.cpp", "src/cpu/kernels/internal/CpuDepthwiseConv2dAssemblyWrapperKernel.cpp", "src/cpu/kernels/internal/CpuPool2dAssemblyWrapperKernel.cpp", + "src/cpu/kernels/maxunpool/generic/neon/fp16.cpp", + "src/cpu/kernels/maxunpool/generic/neon/fp32.cpp", + "src/cpu/kernels/maxunpool/generic/neon/impl.cpp", + "src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp", + "src/cpu/kernels/maxunpool/generic/neon/qasymm8_signed.cpp", "src/cpu/kernels/pool2d/neon/fp16.cpp", "src/cpu/kernels/pool2d/neon/fp32.cpp", "src/cpu/kernels/pool2d/neon/nchw/all.cpp", diff --git a/filelist.json b/filelist.json index 040ff51333..da05ad9563 100644 --- a/filelist.json +++ b/filelist.json @@ -1568,7 +1568,14 @@ "common": [ "src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.cpp", "src/runtime/NEON/functions/NEMaxUnpoolingLayer.cpp" - ] + ], + "neon":{ + "common":["src/cpu/kernels/maxunpool/generic/neon/impl.cpp"], + "fp32":["src/cpu/kernels/maxunpool/generic/neon/fp32.cpp"], + "fp16":["src/cpu/kernels/maxunpool/generic/neon/fp16.cpp"], + "qasymm8":["src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp"], + "qasymm8_signed":["src/cpu/kernels/maxunpool/generic/neon/qasymm8_signed.cpp"] + } } }, "Mean": { diff --git a/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.cpp b/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.cpp index 761fa15238..93da8a24c5 100644 --- a/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.cpp +++ b/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -28,9 +28,10 @@ #include "arm_compute/core/Window.h" #include "arm_compute/core/utils/misc/ShapeCalculator.h" #include "src/core/CPP/Validate.h" +#include "src/core/common/Registrars.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/core/helpers/WindowHelpers.h" - +#include "src/cpu/kernels/maxunpool/list.h" #include "support/ToolchainSupport.h" namespace arm_compute @@ -39,6 +40,67 @@ using namespace misc::shape_calculator; namespace { +struct MaxUnpoolingSelectorData +{ + DataType dt; +}; + +using MaxUnpoolingSelctorPtr = std::add_pointer::type; +using MaxUnpoolingUKernelPtr = std::add_pointer::type; + +struct MaxUnpoolingKernel +{ + const char *name; + const MaxUnpoolingSelctorPtr is_selected; + MaxUnpoolingUKernelPtr ukernel; +}; + +static const MaxUnpoolingKernel available_kernels[] = +{ + { + "fp32_neon_maxunpooling", + [](const MaxUnpoolingSelectorData & data) { return data.dt == DataType::F32; }, + REGISTER_FP32_NEON(arm_compute::cpu::neon_fp32_maxunpooling) + }, +#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + { + "fp16_neon_maxunpooling", + [](const MaxUnpoolingSelectorData & data) { return data.dt == DataType::F16; }, + REGISTER_FP16_NEON(arm_compute::cpu::neon_fp16_maxunpooling) + }, +#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC +#if defined(ARM_COMPUTE_ENABLE_NEON) + { + "qs8_neon_maxunpooling", + [](const MaxUnpoolingSelectorData & data) { return data.dt == DataType::QASYMM8; }, + REGISTER_QASYMM8_NEON(arm_compute::cpu::neon_qs8_maxunpooling) + }, + { + "qu8_neon_maxunpooling", + [](const MaxUnpoolingSelectorData & data) { return data.dt == DataType::QASYMM8_SIGNED; }, + REGISTER_QASYMM8_SIGNED_NEON(arm_compute::cpu::neon_qu8_maxunpooling) + }, +#endif //defined(ARM_COMPUTE_ENABLE_NEON) +}; + +/** Micro-kernel selector + * + * @param[in] data Selection data passed to help pick the appropriate micro-kernel + * + * @return A matching micro-kernel else nullptr + */ +const MaxUnpoolingKernel *get_implementation(const MaxUnpoolingSelectorData &data) +{ + for(const auto &uk : available_kernels) + { + if(uk.is_selected(data)) + { + return &uk; + } + } + return nullptr; +} + Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info, const ITensorInfo *indices) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output, indices); @@ -69,7 +131,7 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, c } // namespace NEMaxUnpoolingLayerKernel::NEMaxUnpoolingLayerKernel() - : _func(nullptr), _input(nullptr), _output(nullptr), _indices(nullptr) + : _input(nullptr), _output(nullptr), _indices(nullptr) { } @@ -82,46 +144,12 @@ void NEMaxUnpoolingLayerKernel::configure(const ITensor *input, const ITensor *i _output = output; _indices = indices; - switch(input->info()->data_type()) - { - case DataType::F32: - _func = &NEMaxUnpoolingLayerKernel::unpooling2; - break; - case DataType::QASYMM8: - _func = &NEMaxUnpoolingLayerKernel::unpooling2; - break; - case DataType::QASYMM8_SIGNED: - _func = &NEMaxUnpoolingLayerKernel::unpooling2; - break; -#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC - case DataType::F16: - _func = &NEMaxUnpoolingLayerKernel::unpooling2; - break; -#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ - default: - break; - } const TensorShape output_shape = compute_unpool_shape(*input->info(), pool_info); auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape)); auto window = calculate_max_window(*input->info(), Steps()); INEKernel::configure(window); } -template -void NEMaxUnpoolingLayerKernel::unpooling2(const Window &window) -{ - Iterator input(_input, window); - Iterator indices(_indices, window); - auto out_ptr = reinterpret_cast(_output->buffer()); - const int out_stride_w = static_cast(_output->info()->strides_in_bytes()[3]); - execute_window_loop(window, [&](const Coordinates & id) - { - auto vindices = reinterpret_cast(indices.ptr()); - auto vinput = reinterpret_cast(input.ptr()); - out_ptr[id[3] * out_stride_w / sizeof(T) + *vindices] = *vinput; - }, - input, indices); -} Status NEMaxUnpoolingLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *indices, const ITensorInfo *output, const PoolingLayerInfo &pool_info) { @@ -135,8 +163,9 @@ void NEMaxUnpoolingLayerKernel::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); - // Run function - (this->*_func)(window); + const auto *uk = get_implementation(MaxUnpoolingSelectorData{ _input->info()->data_type() }); + ARM_COMPUTE_ERROR_ON(uk == nullptr || uk->ukernel == nullptr); + + uk->ukernel(_input, _output, _indices, window); } } // namespace arm_compute diff --git a/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.h b/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.h index ecc116e585..f7f9a31f6d 100644 --- a/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.h +++ b/src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Arm Limited. + * Copyright (c) 2020-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -88,10 +88,9 @@ private: using UnpoolingFunction = void (NEMaxUnpoolingLayerKernel::*)(const Window &window); private: - UnpoolingFunction _func; - const ITensor *_input; - ITensor *_output; - const ITensor *_indices; + const ITensor *_input; + ITensor *_output; + const ITensor *_indices; }; } // namespace arm_compute #endif /*ARM_COMPUTE_NEMAXUNPOOLINGLAYERKERNEL_H */ diff --git a/src/cpu/kernels/maxunpool/generic/neon/fp16.cpp b/src/cpu/kernels/maxunpool/generic/neon/fp16.cpp new file mode 100644 index 0000000000..d43503aa2f --- /dev/null +++ b/src/cpu/kernels/maxunpool/generic/neon/fp16.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 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/maxunpool/generic/neon/impl.h" +namespace arm_compute +{ +namespace cpu +{ +void neon_fp16_maxunpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window) +{ + return max_unpooling(input, output, indices, window); +} +} // namespace cpu +} // namespace arm_compute +#endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) */ diff --git a/src/cpu/kernels/maxunpool/generic/neon/fp32.cpp b/src/cpu/kernels/maxunpool/generic/neon/fp32.cpp new file mode 100644 index 0000000000..2f96e86695 --- /dev/null +++ b/src/cpu/kernels/maxunpool/generic/neon/fp32.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 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/maxunpool/generic/neon/impl.h" +namespace arm_compute +{ +namespace cpu +{ +void neon_fp32_maxunpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window) +{ + return max_unpooling(input, output, indices, window); +} +} // namespace cpu +} // namespace arm_compute diff --git a/src/cpu/kernels/maxunpool/generic/neon/impl.cpp b/src/cpu/kernels/maxunpool/generic/neon/impl.cpp new file mode 100644 index 0000000000..8bbc8d128f --- /dev/null +++ b/src/cpu/kernels/maxunpool/generic/neon/impl.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020-2022 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/maxunpool/generic/neon/impl.h" +namespace arm_compute +{ +class ITensor; +class Window; +namespace cpu +{ +template +void max_unpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window) +{ + Iterator input_itr(input, window); + Iterator indices_itr(indices, window); + auto out_ptr = reinterpret_cast(output->buffer()); + const int out_stride_w = static_cast(output->info()->strides_in_bytes()[3]); + execute_window_loop(window, [&](const Coordinates & id) + { + auto vindices = reinterpret_cast(indices_itr.ptr()); + auto vinput = reinterpret_cast(input_itr.ptr()); + out_ptr[id[3] * out_stride_w / sizeof(T) + *vindices] = *vinput; + }, + input_itr, indices_itr); +} +template void max_unpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window); +template void max_unpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window); +template void max_unpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window); + +#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) +template void max_unpooling(const ITensor *input, ITensor *output, const ITensor *indices, 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/maxunpool/generic/neon/impl.h b/src/cpu/kernels/maxunpool/generic/neon/impl.h new file mode 100644 index 0000000000..6a14c66b33 --- /dev/null +++ b/src/cpu/kernels/maxunpool/generic/neon/impl.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 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_SVE_KERNELS_MAXUNPOOLING_IMPL_H +#define SRC_CORE_SVE_KERNELS_MAXUNPOOLING_IMPL_H +#include "arm_compute/core/Helpers.h" +#include "arm_compute/core/Window.h" +#include "src/core/NEON/wrapper/wrapper.h" +namespace arm_compute +{ +class ITensor; +class Window; +namespace cpu +{ +template +void max_unpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window); +} // namespace cpu +} // namespace arm_compute +#endif //define SRC_CORE_SVE_KERNELS_MAXUNPOOLING_IMPL_H diff --git a/src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp b/src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp new file mode 100644 index 0000000000..b6d0f48fda --- /dev/null +++ b/src/cpu/kernels/maxunpool/generic/neon/qasymm8.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 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/maxunpool/generic/neon/impl.h" +namespace arm_compute +{ +namespace cpu +{ +void neon_qs8_maxunpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window) +{ + return max_unpooling(input, output, indices, window); +} +} // namespace cpu +} // namespace arm_compute diff --git a/src/cpu/kernels/maxunpool/generic/neon/qasymm8_signed.cpp b/src/cpu/kernels/maxunpool/generic/neon/qasymm8_signed.cpp new file mode 100644 index 0000000000..79f3013805 --- /dev/null +++ b/src/cpu/kernels/maxunpool/generic/neon/qasymm8_signed.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 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/maxunpool/generic/neon/impl.h" +namespace arm_compute +{ +namespace cpu +{ +void neon_qu8_maxunpooling(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window) +{ + return max_unpooling(input, output, indices, window); +} +} // namespace cpu +} // namespace arm_compute diff --git a/src/cpu/kernels/maxunpool/list.h b/src/cpu/kernels/maxunpool/list.h new file mode 100644 index 0000000000..0f9bb499d3 --- /dev/null +++ b/src/cpu/kernels/maxunpool/list.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 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_MAXUNPOOL_LIST_H +#define SRC_CORE_NEON_KERNELS_MAXUNPOOL_LIST_H +namespace arm_compute +{ +namespace cpu +{ +#define DECLARE_MAXUNPOOL_KERNEL(func_name) \ + void func_name(const ITensor *input, ITensor *output, const ITensor *indices, const Window &window) +DECLARE_MAXUNPOOL_KERNEL(neon_fp32_maxunpooling); +DECLARE_MAXUNPOOL_KERNEL(neon_fp16_maxunpooling); +DECLARE_MAXUNPOOL_KERNEL(neon_qs8_maxunpooling); +DECLARE_MAXUNPOOL_KERNEL(neon_qu8_maxunpooling); +#undef DECLARE_MAXUNPOOL_KERNEL +} // namespace cpu +} // namespace arm_compute +#endif //SRC_CORE_NEON_KERNELS_MAXUNPOOL_LIST_H -- cgit v1.2.1