| 175 | } |
| 176 | |
| 177 | bool ConvBiasImpl::AlgoConv1x1::usable( |
| 178 | const NCBKernSizeParam& param, AlgoSelectionStrategy) const { |
| 179 | MIDOUT_BEGIN(megdnn_fallback_conv1x1, 0, 2) { |
| 180 | size_t FH = param.filter_meta.spatial[0], FW = param.filter_meta.spatial[1]; |
| 181 | size_t PH = param.filter_meta.padding[0], PW = param.filter_meta.padding[1]; |
| 182 | size_t SH = param.filter_meta.stride[0], SW = param.filter_meta.stride[1]; |
| 183 | auto format = param.filter_meta.format; |
| 184 | size_t OH = param.osz[0]; |
| 185 | size_t OW = param.osz[1]; |
| 186 | #if MEGDNN_AARCH64 || MEGDNN_ARMV7 |
| 187 | if (format != param::ConvBias::Format::NCHW && |
| 188 | format != param::ConvBias::Format::NCHW44 && |
| 189 | format != param::ConvBias::Format::NCHW44_DOT && |
| 190 | format != param::ConvBias::Format::NCHW88) { |
| 191 | return false; |
| 192 | } |
| 193 | //! hybird mode is not support |
| 194 | if (param.filter_meta.format == param::ConvBias::Format::NCHW44 || |
| 195 | param.filter_meta.format == param::ConvBias::Format::NCHW44_DOT) { |
| 196 | if (param.filter_meta.icpg < 4_z || param.filter_meta.ocpg == 1) { |
| 197 | return false; |
| 198 | } |
| 199 | } |
| 200 | if (format == param::ConvBias::Format::NCHW88) { |
| 201 | bool is_packmode_not_default = |
| 202 | (m_matmul_algo->packmode() != |
| 203 | MatrixMulImpl::AlgoBase::PackMode::DEFAULT); |
| 204 | //! nchw88 hybrid mode and channel wise is not support |
| 205 | bool is_hybrid_mode_or_channel_wise = |
| 206 | (param.filter_meta.icpg < 8_z || param.filter_meta.ocpg == 1); |
| 207 | if (is_packmode_not_default || is_hybrid_mode_or_channel_wise) { |
| 208 | return false; |
| 209 | } |
| 210 | } |
| 211 | #else //! x86 and RISC-V do not support NCHW44_DOT |
| 212 | if (format != param::ConvBias::Format::NCHW && |
| 213 | format != param::ConvBias::Format::NCHW44) { |
| 214 | return false; |
| 215 | } |
| 216 | //! hybird mode is not support |
| 217 | if (param.filter_meta.format == param::ConvBias::Format::NCHW44) { |
| 218 | if (param.filter_meta.icpg < 4_z || param.filter_meta.ocpg == 1) { |
| 219 | return false; |
| 220 | } |
| 221 | } |
| 222 | #endif |
| 223 | //! param |
| 224 | if (FH != 1 || FW != 1 || PH || PW || SH != 1 || SW != 1) { |
| 225 | return false; |
| 226 | } |
| 227 | //! data type |
| 228 | if (param.src_type.enumv() != param.filter_type.enumv() || |
| 229 | (param.src_type.enumv() != DTypeEnum::Int8 && |
| 230 | param.src_type.enumv() != DTypeEnum::QuantizedS8 && |
| 231 | param.src_type.enumv() != DTypeEnum::Quantized8Asymm && |
| 232 | #if !MEGDNN_DISABLE_FLOAT16 |
| 233 | param.src_type.enumv() != DTypeEnum::Float16 && |
| 234 | #endif |
nothing calls this directly
no test coverage detected