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

Method dispatch_kern

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

Source from the content-addressed store, hash-verified

193}
194
195SmallVector<ConvolutionImpl::NCBKern> ConvolutionImpl::AlgoFallback::dispatch_kern(
196 const NCBKernSizeParam& param) const {
197 MIDOUT_BEGIN(megdnn_fallback_conv, midout_iv("AlgoFallback::dispatch_kern"_hash)) {
198 size_t group = param.filter_meta.group;
199 size_t N = param.n;
200 size_t nr_threads = param.nr_threads;
201 size_t workspace_per_thread = get_workspace(param) / nr_threads;
202 auto kern_fallback = [workspace_per_thread](
203 const NCBKernParam& p,
204 const NCBKernIndex& ncb_index) {
205 UNPACK_CONV_F32_NCB_KERN_SIZES(p);
206 size_t batch_id = ncb_index.ndrange_id[1];
207 size_t group_id = ncb_index.ndrange_id[0];
208 MEGDNN_MARK_USED_VAR(N);
209 auto src = p.src<float>(batch_id, group_id),
210 filter = p.filter<float>(group_id);
211 auto dst = p.dst<float>(batch_id, group_id);
212 size_t thread_id = ncb_index.thread_id;
213 void* workspace_ptr = reinterpret_cast<void*>(
214 reinterpret_cast<ptrdiff_t>(p.workspace_ptr) +
215 workspace_per_thread * thread_id);
216 convolution::run_conv(
217 src, filter, dst, workspace_ptr, IH, IW, IC, FH, FW, OH, OW, OC, PH,
218 PW, SH, SW, !p.filter_meta.should_flip);
219 };
220 return {{kern_fallback, {group, N, 1_z}}};
221 }
222 MIDOUT_END();
223}
224
225/* ===================== naive algo ===================== */
226

Callers 10

execMethod · 0.45
exec_with_ncb_kernMethod · 0.45
ncb_1g_dispatch_kernMethod · 0.45
dispatch_on_dtype_contFunction · 0.45
execMethod · 0.45
execMethod · 0.45
exec_with_ncb_kernMethod · 0.45

Calls 5

run_convFunction · 0.85
MIDOUT_BEGINFunction · 0.70
get_workspaceFunction · 0.70
cbFunction · 0.50
enumvMethod · 0.45

Tested by

no test coverage detected