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

Method dispatch_kerns

dnn/src/fallback/conv_bias/algos.cpp:202–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202SmallVector<ConvBiasImpl::NCBKern> ConvBiasImpl::AlgoNaive::dispatch_kerns(
203 const NCBKernSizeParam& p) const {
204 size_t workspace_size = get_workspace(p);
205 //! When group>1 or n>1, this algo will parallel by group and n
206 size_t nr_threads = p.nr_threads;
207 size_t GROUP = p.filter_meta.group;
208 size_t N = p.n;
209 size_t workspace_per_thread = workspace_size / nr_threads;
210 auto kern = [workspace_per_thread](
211 const NCBKernParam& param, const NCBKernIndex& ncb_index) {
212 MIDOUT_BEGIN(megdnn_fallback_naive, 2) {
213 size_t group_id = ncb_index.ndrange_id[0];
214 size_t batch_id = ncb_index.ndrange_id[1];
215 size_t thread_id = ncb_index.thread_id;
216 auto thread_param = param;
217 thread_param.workspace_ptr = reinterpret_cast<void*>(
218 reinterpret_cast<ptrdiff_t>(param.workspace_ptr) +
219 thread_id * workspace_per_thread);
220
221 thread_param.filter_ptr += param.filter_offset(group_id);
222 thread_param.dst_ptr += param.dst_offset(batch_id, group_id);
223 thread_param.src_ptr += param.src_offset(batch_id, group_id);
224 thread_param.bias_ptr += param.bias_offset(batch_id, group_id);
225
226 kern_default(thread_param);
227 }
228 MIDOUT_END();
229 };
230 return {{kern, {GROUP, N, 1_z}}};
231}
232
233MIDOUT_DECL(megdnn_fallback_winograd)
234/* ======================= AlgoWinogradF32 ======================== */

Callers 1

get_kimplMethod · 0.45

Calls 8

kern_defaultFunction · 0.85
filter_offsetMethod · 0.80
dst_offsetMethod · 0.80
src_offsetMethod · 0.80
bias_offsetMethod · 0.80
get_workspaceFunction · 0.50
MIDOUT_BEGINFunction · 0.50
get_kernsMethod · 0.45

Tested by

no test coverage detected