Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 1 | /* |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 2 | * Copyright (c) 2021-2022 Arm Limited. |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #include "arm_gemm_local.hpp" |
| 26 | |
| 27 | #include "depthwise_implementation.hpp" |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 28 | #include "depthwise_depthfirst.hpp" |
| 29 | #include "depthwise_depthfirst_generic.hpp" |
| 30 | #include "depthwise_depthfirst_multiplier.hpp" |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 31 | |
| 32 | #include "depthwise_implementation_constraints.hpp" |
| 33 | |
| 34 | #if defined(__aarch64__) |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 35 | #if defined(ARM_COMPUTE_ENABLE_SVE) |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 36 | #include "kernels/sve_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst.hpp" |
| 37 | #include "kernels/sve_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst.hpp" |
| 38 | #include "kernels/sve_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst.hpp" |
| 39 | #include "kernels/sve_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst.hpp" |
| 40 | #include "kernels/sve_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst.hpp" |
| 41 | #include "kernels/sve_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst.hpp" |
| 42 | #include "kernels/sve_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst.hpp" |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 43 | #endif // defined(ARM_COMPUTE_ENABLE_SVE) |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 44 | #include "kernels/a64_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst.hpp" |
| 45 | #include "kernels/a64_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst.hpp" |
| 46 | #include "kernels/a64_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst.hpp" |
| 47 | #include "kernels/a64_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst.hpp" |
| 48 | #include "kernels/a64_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst.hpp" |
| 49 | #include "kernels/a64_s8q_nhwc_generic_output9_mla_depthfirst.hpp" |
| 50 | #include "kernels/a64_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst.hpp" |
| 51 | #include "kernels/a64_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst.hpp" |
| 52 | #include "kernels/a64_s8q_packed_to_nhwc_generic_with_multiplier_output2x8_mla_depthfirst.hpp" |
| 53 | #endif // defined(__aarch64__) |
| 54 | |
| 55 | #include <cstdint> |
| 56 | |
| 57 | using arm_gemm::Requantize32; |
| 58 | |
| 59 | namespace arm_conv { |
| 60 | namespace depthwise { |
| 61 | |
| 62 | namespace |
| 63 | { |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 64 | #if defined(__aarch64__) |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 65 | bool qp_weights_are_symmetric(const DepthwiseArgs &, const void *_qp) |
| 66 | { |
| 67 | const auto qp = static_cast<const arm_gemm::Requantize32 *>(_qp); |
| 68 | return qp->b_offset == 0; |
| 69 | } |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 70 | #endif // defined(__aarch64__) |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | static const DepthwiseImplementation<int8_t, int8_t, int8_t, Requantize32> depthwise_s8q_methods[] = { |
| 74 | #if defined(__aarch64__) |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 75 | #if defined(ARM_COMPUTE_ENABLE_SVE) |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 76 | { |
| 77 | DepthwiseMethod::DEPTHFIRST, |
| 78 | "sve_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst", |
| 79 | constraint<Requantize32>(is_supported<sve_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst>, |
| 80 | has_no_channel_multiplier, |
| 81 | qp_has_no_left_shift, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 82 | qp_weights_are_symmetric, |
| 83 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 84 | nullptr, |
| 85 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 86 | auto strat = new sve_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst(args.cpu_info); |
| 87 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 88 | }, |
| 89 | }, |
| 90 | { |
| 91 | DepthwiseMethod::DEPTHFIRST, |
| 92 | "sve_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst", |
| 93 | constraint<Requantize32>(is_supported<sve_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst>, |
| 94 | has_no_channel_multiplier, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 95 | qp_has_no_left_shift, |
| 96 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 97 | nullptr, |
| 98 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 99 | auto strat = new sve_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst(args.cpu_info); |
| 100 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 101 | }, |
| 102 | }, |
| 103 | { |
| 104 | DepthwiseMethod::DEPTHFIRST, |
| 105 | "sve_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst", |
| 106 | constraint<Requantize32>(is_supported<sve_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst>, |
| 107 | has_no_channel_multiplier, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 108 | qp_has_no_left_shift, |
| 109 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 110 | nullptr, |
| 111 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 112 | auto strat = new sve_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst(args.cpu_info); |
| 113 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 114 | }, |
| 115 | }, |
| 116 | { |
| 117 | DepthwiseMethod::DEPTHFIRST, |
| 118 | "sve_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst", |
| 119 | constraint<Requantize32>(is_supported<sve_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst>, |
| 120 | has_no_channel_multiplier, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 121 | qp_has_no_left_shift, |
| 122 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 123 | nullptr, |
| 124 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 125 | auto strat = new sve_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst(args.cpu_info); |
| 126 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 127 | }, |
| 128 | }, |
| 129 | { |
| 130 | DepthwiseMethod::DEPTHFIRST, |
| 131 | "sve_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst", |
| 132 | constraint<Requantize32>(is_supported<sve_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst>, |
| 133 | has_no_channel_multiplier, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 134 | qp_has_no_left_shift, |
| 135 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 136 | nullptr, |
| 137 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 138 | auto strat = new sve_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst(args.cpu_info); |
| 139 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 140 | }, |
| 141 | }, |
| 142 | { |
| 143 | DepthwiseMethod::DEPTHFIRST, |
| 144 | "sve_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst", |
| 145 | constraint<Requantize32>(is_supported<sve_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst>, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 146 | qp_has_no_left_shift, |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 147 | has_channel_multiplier, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 148 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 149 | nullptr, |
| 150 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 151 | auto strat = new sve_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst(args.cpu_info); |
| 152 | return new DepthwiseDepthfirstMultiplier<int8_t, int8_t, int8_t, int32_t, false>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 153 | }, |
| 154 | }, |
| 155 | { |
| 156 | DepthwiseMethod::DEPTHFIRST, |
| 157 | "sve_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst", |
| 158 | constraint<Requantize32>(is_supported<sve_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst>, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 159 | qp_has_no_left_shift, |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 160 | has_channel_multiplier, |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 161 | cpu_has_sve2), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 162 | nullptr, |
| 163 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 164 | auto strat = new sve_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst(args.cpu_info); |
| 165 | return new DepthwiseDepthfirstMultiplier<int8_t, int8_t, int8_t, int32_t, false>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 166 | }, |
| 167 | }, |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 168 | #endif // defined(ARM_COMPUTE_ENABLE_SVE) |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 169 | { |
| 170 | DepthwiseMethod::DEPTHFIRST, |
| 171 | "a64_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst", |
| 172 | constraint<Requantize32>(is_supported<a64_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst>, |
| 173 | has_no_channel_multiplier, |
| 174 | qp_weights_are_symmetric, |
| 175 | qp_has_no_left_shift, |
| 176 | cpu_has_dot_product), |
| 177 | nullptr, |
| 178 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 179 | auto strat = new a64_s8qs_nhwc_3x3_s1_output2x2_dot_depthfirst(args.cpu_info); |
| 180 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 181 | }, |
| 182 | }, |
| 183 | { |
| 184 | DepthwiseMethod::DEPTHFIRST, |
| 185 | "a64_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst", |
| 186 | constraint<Requantize32>(is_supported<a64_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst>, |
| 187 | has_no_channel_multiplier, |
| 188 | qp_has_no_left_shift, |
| 189 | cpu_has_dot_product), |
| 190 | nullptr, |
| 191 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 192 | auto strat = new a64_s8q_nhwc_3x3_s1_output2x2_dot_depthfirst(args.cpu_info); |
| 193 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 194 | }, |
| 195 | }, |
| 196 | { |
| 197 | DepthwiseMethod::DEPTHFIRST, |
| 198 | "a64_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst", |
| 199 | constraint<Requantize32>(is_supported<a64_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst>, |
| 200 | has_no_channel_multiplier, |
| 201 | qp_has_no_left_shift), |
| 202 | nullptr, |
| 203 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 204 | auto strat = new a64_s8q_nhwc_3x3_s1_output2x2_mla_depthfirst(args.cpu_info); |
| 205 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 206 | }, |
| 207 | }, |
| 208 | { |
| 209 | DepthwiseMethod::DEPTHFIRST, |
| 210 | "a64_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst", |
| 211 | constraint<Requantize32>(is_supported<a64_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst>, |
| 212 | has_no_channel_multiplier, |
| 213 | qp_has_no_left_shift), |
| 214 | nullptr, |
| 215 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 216 | auto strat = new a64_s8q_nhwc_3x3_s2_output2x2_mla_depthfirst(args.cpu_info); |
| 217 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 218 | }, |
| 219 | }, |
| 220 | { |
| 221 | DepthwiseMethod::DEPTHFIRST, |
| 222 | "a64_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst", |
| 223 | constraint<Requantize32>(is_supported<a64_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst>, |
| 224 | has_no_channel_multiplier, |
| 225 | qp_has_no_left_shift), |
| 226 | nullptr, |
| 227 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 228 | auto strat = new a64_s8q_nhwc_5x5_s1_output2x2_mla_depthfirst(args.cpu_info); |
| 229 | return new DepthwiseDepthfirst<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 230 | }, |
| 231 | }, |
| 232 | { |
| 233 | DepthwiseMethod::DEPTHFIRST, |
| 234 | "a64_s8q_nhwc_generic_output3x3_mla_depthfirst", |
| 235 | constraint<Requantize32>(has_no_channel_multiplier), |
| 236 | nullptr, |
| 237 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 238 | auto kernel = new a64_s8q_nhwc_generic_output9_mla_depthfirst(args.cpu_info); |
| 239 | auto strat = new GenericDepthfirstStrategy<int8_t>(kernel, 3, 3, args); |
| 240 | return new DepthwiseDepthfirstGeneric<int8_t>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 241 | }, |
| 242 | }, |
| 243 | { |
| 244 | DepthwiseMethod::DEPTHFIRST, |
| 245 | "a64_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst", |
| 246 | constraint<Requantize32>(is_supported<a64_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst>, |
| 247 | qp_has_no_left_shift, |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 248 | has_channel_multiplier, |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 249 | cpu_has_dot_product), |
| 250 | nullptr, |
| 251 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 252 | auto strat = new a64_s8q_packed_to_nhwc_3x3_s2_with_multiplier_output2x4_dot_depthfirst(args.cpu_info); |
| 253 | return new DepthwiseDepthfirstMultiplier<int8_t, int8_t, int8_t, int32_t, false>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 254 | }, |
| 255 | }, |
| 256 | { |
| 257 | DepthwiseMethod::DEPTHFIRST, |
| 258 | "a64_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst", |
| 259 | constraint<Requantize32>(is_supported<a64_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst>, |
| 260 | qp_has_no_left_shift, |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 261 | has_channel_multiplier, |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 262 | cpu_has_dot_product), |
| 263 | nullptr, |
| 264 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 265 | auto strat = new a64_s8q_packed_to_nhwc_5x5_s1_with_multiplier_output4x2_dot_depthfirst(args.cpu_info); |
| 266 | return new DepthwiseDepthfirstMultiplier<int8_t, int8_t, int8_t, int32_t, false>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 267 | }, |
| 268 | }, |
| 269 | { |
| 270 | DepthwiseMethod::DEPTHFIRST, |
| 271 | "a64_s8q_packed_to_nhwc_generic_with_multiplier_output2x8_mla_depthfirst", |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 272 | constraint<Requantize32>(has_channel_multiplier), |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 273 | nullptr, |
| 274 | [] (const DepthwiseArgs &args, const Requantize32 &qp) -> DepthwiseCommon<int8_t, int8_t, int8_t> * { |
ramelg01 | 8a16488 | 2022-04-07 02:42:52 +0100 | [diff] [blame^] | 275 | auto kern = new a64_s8q_packed_to_nhwc_generic_with_multiplier_output2x8_mla_depthfirst(args.cpu_info); |
| 276 | auto strat = new GenericDepthfirstMultiplierStrategy<int8_t>(kern, args); |
| 277 | return new DepthwiseDepthfirstMultiplier<int8_t, int8_t, int8_t, int32_t, true>(strat, args, qp); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 278 | }, |
| 279 | }, |
| 280 | #endif // defined(__aarch64__) |
| 281 | { DepthwiseMethod::DEFAULT, "", nullptr, nullptr, nullptr }, // End of list |
| 282 | }; |
| 283 | |
| 284 | template <> |
| 285 | const DepthwiseImplementation<int8_t, int8_t, int8_t, Requantize32> *depthwise_implementation_list() |
| 286 | { |
| 287 | return depthwise_s8q_methods; |
| 288 | } |
| 289 | |
| 290 | template UniqueDepthwiseCommon<int8_t, int8_t, int8_t> depthwise(const DepthwiseArgs &, const Requantize32 &); |
| 291 | template std::vector<KernelDescription> get_compatible_kernels<int8_t, int8_t, int8_t, Requantize32>(const DepthwiseArgs &, const Requantize32 &); |
| 292 | |
| 293 | } // namespace depthwise |
| 294 | } // namespace arm_conv |