diff options
Diffstat (limited to 'src/core/NEON/kernels/arm_conv/pooling/pooling_s8.cpp')
-rw-r--r-- | src/core/NEON/kernels/arm_conv/pooling/pooling_s8.cpp | 107 |
1 files changed, 74 insertions, 33 deletions
diff --git a/src/core/NEON/kernels/arm_conv/pooling/pooling_s8.cpp b/src/core/NEON/kernels/arm_conv/pooling/pooling_s8.cpp index 490fc0d863..8d08ddc43f 100644 --- a/src/core/NEON/kernels/arm_conv/pooling/pooling_s8.cpp +++ b/src/core/NEON/kernels/arm_conv/pooling/pooling_s8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. + * Copyright (c) 2021-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -30,13 +30,16 @@ #include "kernels/cpp_nhwc_1x1_stride_any_depthfirst.hpp" #if defined(__aarch64__) -#if defined(__ARM_FEATURE_SVE) -#if defined(SVE2) +#if defined(ARM_COMPUTE_ENABLE_SME) +#include "kernels/sme_s8_nhwc_avg_generic_depthfirst.hpp" +#include "kernels/sme_s8_nhwc_max_2x2_s1_output2x2_depthfirst.hpp" +#include "kernels/sme_s8_nhwc_max_generic_depthfirst.hpp" +#endif // defined(ARM_COMPUTE_ENABLE_SME) +#if defined(ARM_COMPUTE_ENABLE_SVE) #include "kernels/sve_s8_nhwc_avg_generic_depthfirst.hpp" -#endif // defined(SVE2) #include "kernels/sve_s8_nhwc_max_2x2_s1_output2x2_depthfirst.hpp" #include "kernels/sve_s8_nhwc_max_generic_depthfirst.hpp" -#endif // defined(__ARM_FEATURE_SVE) +#endif // defined(ARM_COMPUTE_ENABLE_SVE) #include "kernels/a64_s8_nhwc_max_2x2_s1_output2x2_depthfirst.hpp" #include "kernels/a64_s8_nhwc_avg_generic_depthfirst.hpp" #include "kernels/a64_s8_nhwc_max_generic_depthfirst.hpp" @@ -47,19 +50,6 @@ namespace arm_conv { namespace pooling { -namespace -{ - template <class Strategy> - bool is_supported(const PoolingArgs &args, const Nothing &) - { - return ((args.pool_type == Strategy::pooling_type()) && - (args.pool_window.rows == Strategy::pool_rows()) && - (args.pool_window.cols == Strategy::pool_cols()) && - (args.pool_stride.rows == Strategy::stride_rows()) && - (args.pool_stride.cols == Strategy::stride_cols())); - } -} - static const PoolingImplementation<int8_t, int8_t> pooling_s8_methods[] = { { PoolingMethod::DEPTHFIRST, @@ -69,48 +59,97 @@ static const PoolingImplementation<int8_t, int8_t> pooling_s8_methods[] = { }, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirstGeneric<cpp_nhwc_1x1_stride_any_depthfirst<int8_t>>(args); + auto strat = new cpp_nhwc_1x1_stride_any_depthfirst<int8_t>(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); }, }, #if defined(__aarch64__) -#if defined(__ARM_FEATURE_SVE) -#if defined(SVE2) +#if defined(ARM_COMPUTE_ENABLE_SME) { PoolingMethod::DEPTHFIRST, - "sve_s8_nhwc_avg_generic_depthfirst", - [] (const PoolingArgs &args, const Nothing &) -> bool { return args.pool_type == PoolingType::AVERAGE; }, + "sme_s8_nhwc_max_2x2_s1_output2x2_depthfirst", + [] (const PoolingArgs &args, const Nothing &os) -> bool { + return args.cpu_info->has_sme() && + is_supported<sme_s8_nhwc_max_2x2_s1_output2x2_depthfirst>(args, os); + }, + nullptr, + [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { + auto strat = new sme_s8_nhwc_max_2x2_s1_output2x2_depthfirst(args.cpu_info); + return new PoolingDepthfirst<int8_t>(strat, args); + }, + }, + { + PoolingMethod::DEPTHFIRST, + "sme_s8_nhwc_avg_generic_depthfirst", + [] (const PoolingArgs &args, const Nothing &) -> bool { + return args.cpu_info->has_sme2() && args.pool_type == PoolingType::AVERAGE; + }, + nullptr, + [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { + auto strat = new sme_s8_nhwc_avg_generic_depthfirst(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); + }, + }, + { + PoolingMethod::DEPTHFIRST, + "sme_s8_nhwc_max_generic_depthfirst", + [] (const PoolingArgs &args, const Nothing &) -> bool { + return args.cpu_info->has_sme() && args.pool_type == PoolingType::MAX; + }, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirstGeneric<sve_s8_nhwc_avg_generic_depthfirst>(args); + auto strat = new sme_s8_nhwc_max_generic_depthfirst(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); }, }, -#endif // defined(SVE2) +#endif // defined(ARM_COMPUTE_ENABLE_SME) +#if defined(ARM_COMPUTE_ENABLE_SVE) { PoolingMethod::DEPTHFIRST, "sve_s8_nhwc_max_2x2_s1_output2x2_depthfirst", - is_supported<sve_s8_nhwc_max_2x2_s1_output2x2_depthfirst>, + [] (const PoolingArgs &args, const Nothing &os) -> bool { + return args.cpu_info->has_sve() && + is_supported<sve_s8_nhwc_max_2x2_s1_output2x2_depthfirst>(args, os); + }, + nullptr, + [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { + auto strat = new sve_s8_nhwc_max_2x2_s1_output2x2_depthfirst(args.cpu_info); + return new PoolingDepthfirst<int8_t>(strat, args); + }, + }, + { + PoolingMethod::DEPTHFIRST, + "sve_s8_nhwc_avg_generic_depthfirst", + [] (const PoolingArgs &args, const Nothing &) -> bool { + return args.cpu_info->has_sve2() && args.pool_type == PoolingType::AVERAGE; + }, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirst<sve_s8_nhwc_max_2x2_s1_output2x2_depthfirst>(args); + auto strat = new sve_s8_nhwc_avg_generic_depthfirst(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); }, }, { PoolingMethod::DEPTHFIRST, "sve_s8_nhwc_max_generic_depthfirst", - [] (const PoolingArgs &args, const Nothing &) -> bool { return args.pool_type == PoolingType::MAX; }, + [] (const PoolingArgs &args, const Nothing &) -> bool { + return args.cpu_info->has_sve() && args.pool_type == PoolingType::MAX; + }, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirstGeneric<sve_s8_nhwc_max_generic_depthfirst>(args); + auto strat = new sve_s8_nhwc_max_generic_depthfirst(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); }, }, -#endif // defined(__ARM_FEATURE_SVE) +#endif // defined(ARM_COMPUTE_ENABLE_SVE) { PoolingMethod::DEPTHFIRST, "a64_s8_nhwc_max_2x2_s1_output2x2_depthfirst", is_supported<a64_s8_nhwc_max_2x2_s1_output2x2_depthfirst>, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirst<a64_s8_nhwc_max_2x2_s1_output2x2_depthfirst>(args); + auto strat = new a64_s8_nhwc_max_2x2_s1_output2x2_depthfirst(args.cpu_info); + return new PoolingDepthfirst<int8_t>(strat, args); }, }, { @@ -119,7 +158,8 @@ static const PoolingImplementation<int8_t, int8_t> pooling_s8_methods[] = { [] (const PoolingArgs &args, const Nothing &) -> bool { return args.pool_type == PoolingType::AVERAGE; }, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirstGeneric<a64_s8_nhwc_avg_generic_depthfirst>(args); + auto strat = new a64_s8_nhwc_avg_generic_depthfirst(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); }, }, { @@ -128,7 +168,8 @@ static const PoolingImplementation<int8_t, int8_t> pooling_s8_methods[] = { [] (const PoolingArgs &args, const Nothing &) -> bool { return args.pool_type == PoolingType::MAX; }, nullptr, [] (const PoolingArgs &args, const Nothing &) -> PoolingCommon<int8_t, int8_t> * { - return new PoolingDepthfirstGeneric<a64_s8_nhwc_max_generic_depthfirst>(args); + auto strat = new a64_s8_nhwc_max_generic_depthfirst(args.cpu_info); + return new PoolingDepthfirstGeneric<int8_t>(strat, args); }, }, #endif // defined(__aarch64__) |