Return the implement preprocess kernel
| 366 | |
| 367 | //! Return the implement preprocess kernel |
| 368 | SmallVector<ConvolutionImpl::NCBKern> ConvolutionImpl::AlgoDefault:: |
| 369 | get_preprocess_kimpl( |
| 370 | ConvBiasImpl::AlgoBase* algo, const NCBKernSizeParam& param) { |
| 371 | MIDOUT_BEGIN(megdnn_fallback_conv, midout_iv("get_preprocess_kimpl"_hash)) { |
| 372 | // construct the conv_bias kern param |
| 373 | ::ConvBiasImpl::NCBKernParam conv_bias_param; |
| 374 | static_cast<::ConvBiasImpl::NCBKernSizeParam&>(conv_bias_param) = |
| 375 | init_conv_bias_param(param); |
| 376 | auto conv_bias_preprocess_kerns = |
| 377 | algo->dispatch_preprocess_kerns(conv_bias_param); |
| 378 | SmallVector<ConvolutionImpl::NCBKern> convolution_preprocess_kerns; |
| 379 | |
| 380 | for (size_t i = 0; i < conv_bias_preprocess_kerns.size(); i++) { |
| 381 | auto kernel = conv_bias_preprocess_kerns[i]; |
| 382 | //! If the kerenl batch parallel |
| 383 | auto run = [conv_bias_param, kernel]( |
| 384 | const NCBKernParam& p, const NCBKernIndex& ncb_index) { |
| 385 | auto param = conv_bias_param; |
| 386 | param.filter_ptr = p.filter_ptr; |
| 387 | param.workspace_ptr = p.workspace_ptr; |
| 388 | param.workspace_size = p.workspace_size; |
| 389 | kernel.kern(param, {ncb_index.thread_id, ncb_index.ndrange_id}); |
| 390 | }; |
| 391 | convolution_preprocess_kerns.push_back({run, kernel.global_size}); |
| 392 | } |
| 393 | return convolution_preprocess_kerns; |
| 394 | } |
| 395 | MIDOUT_END(); |
| 396 | } |
| 397 | |
| 398 | //! Return the implement kernel |
| 399 | SmallVector<ConvolutionImpl::NCBKern> ConvolutionImpl::AlgoDefault::get_kimpl( |
nothing calls this directly
no test coverage detected