MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_kimpl

Method get_kimpl

dnn/src/fallback/convolution/algos.cpp:399–427  ·  view source on GitHub ↗

Return the implement kernel

Source from the content-addressed store, hash-verified

397
398//! Return the implement kernel
399SmallVector<ConvolutionImpl::NCBKern> ConvolutionImpl::AlgoDefault::get_kimpl(
400 ConvBiasImpl::AlgoBase* algo, const NCBKernSizeParam& param) {
401 MIDOUT_BEGIN(megdnn_fallback_conv, midout_iv(0)) {
402 // construct the conv_bias kern param
403 ::ConvBiasImpl::NCBKernParam conv_bias_param;
404 static_cast<::ConvBiasImpl::NCBKernSizeParam&>(conv_bias_param) =
405 init_conv_bias_param(param);
406 auto&& conv_bias_kerns = algo->dispatch_kerns(conv_bias_param);
407 SmallVector<ConvolutionImpl::NCBKern> convolution_kerns;
408
409 for (size_t i = 0; i < conv_bias_kerns.size(); i++) {
410 auto&& kernel = conv_bias_kerns[i];
411 //! If the kerenl batch parallel
412 auto run = [conv_bias_param, kernel](
413 const NCBKernParam& p, const NCBKernIndex& ncb_index) {
414 auto param = conv_bias_param;
415 param.src_ptr = p.src_ptr;
416 param.filter_ptr = p.filter_ptr;
417 param.dst_ptr = p.dst_ptr;
418 param.workspace_ptr = p.workspace_ptr;
419 param.workspace_size = p.workspace_size;
420 kernel.kern(param, {ncb_index.thread_id, ncb_index.ndrange_id});
421 };
422 convolution_kerns.push_back({run, kernel.global_size});
423 }
424 return convolution_kerns;
425 }
426 MIDOUT_END();
427}
428
429/////////////////////////// ConvolutionBackwardData /////////////////////
430/* ===================== naive algo ===================== */

Callers

nothing calls this directly

Calls 5

MIDOUT_BEGINFunction · 0.70
dispatch_kernsMethod · 0.45
sizeMethod · 0.45
kernMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected