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

Method exec

dnn/src/cuda/region_restricted_convolution/opr_impl.cpp:13–46  ·  view source on GitHub ↗

============== RegionRestrictedConvolutionForwardImpl ============== */

Source from the content-addressed store, hash-verified

11
12/* ============== RegionRestrictedConvolutionForwardImpl ============== */
13void RegionRestrictedConvolutionForwardImpl::exec(
14 _megdnn_tensor_in src, _megdnn_tensor_in filter, _megdnn_tensor_in rin,
15 _megdnn_tensor_in rout, _megdnn_tensor_out dst, _megdnn_workspace workspace) {
16 auto fm = check_exec(
17 src.layout, filter.layout, rin.layout, rout.layout, dst.layout,
18 workspace.size);
19 auto kparam = chanwise::Param::load(
20 src.layout, dst.layout, fm,
21 param().compute_mode == Param::ComputeMode::DEFAULT);
22 megdnn_assert(
23 src.layout.dtype.category() == DTypeCategory::FLOAT &&
24 param().compute_mode == Param::ComputeMode::DEFAULT &&
25 fm.spatial_ndim == 2 && fm.icpg == 1 && fm.ocpg == 1 &&
26 fm.dilation[0] == 1 && fm.dilation[1] == 1 && !fm.should_flip &&
27 param().stride_h == 1 && param().stride_w == 1);
28
29 auto stream = cuda_stream(handle());
30
31 if (filter.layout.dtype == dtype::Float32() && rin.layout.dtype == dtype::Int32() &&
32 rout.layout.dtype == dtype::Int32()) {
33 chanwise::run_fwd_depthwise_large_filter(
34 dst.ptr<float>(), src.ptr<float>(), filter.ptr<float>(), rin.ptr<int>(),
35 rout.ptr<int>(), kparam, stream);
36 } else if (
37 filter.layout.dtype == dtype::Float32() &&
38 rin.layout.dtype == dtype::Uint8() && rout.layout.dtype == dtype::Uint8()) {
39 chanwise::run_fwd_depthwise_large_filter(
40 dst.ptr<float>(), src.ptr<float>(), filter.ptr<float>(),
41 rin.ptr<uint8_t>(), rout.ptr<uint8_t>(), kparam, stream);
42 } else {
43 printf("unexpected region restricted conv mode\n");
44 megdnn_assert_internal(0);
45 }
46}
47
48size_t RegionRestrictedConvolutionBackwardDataImpl::get_workspace_in_bytes(
49 const TensorLayout& filter, const TensorLayout& diff, const TensorLayout& rin,

Callers

nothing calls this directly

Calls 10

cuda_streamFunction · 0.85
getFunction · 0.85
categoryMethod · 0.80
find_opMethod · 0.80
loadFunction · 0.50
paramFunction · 0.50
operator[]Method · 0.45
nameMethod · 0.45
raw_ptrMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected