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

Method exec

dnn/src/cuda/conv_bias/chanwise_small.cpp:55–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void ConvBiasForwardImpl::AlgoChanwiseSmall::exec(const ExecArgs& args) const {
56 WorkspaceBundle bundle{args.workspace.raw_ptr, {get_workspace_in_bytes(args)}};
57 TensorND conv_dst_tensor = *args.dst_tensor;
58 if (args.dst_layout->dtype.enumv() != args.bias_layout->dtype.enumv()) {
59 conv_dst_tensor = TensorND{bundle.get(0), conv_dst_tensor.layout};
60 conv_dst_tensor.layout.dtype = DType();
61 args.opr->check_or_deduce_dtype_fwd(
62 args.src_layout->dtype, args.filter_layout->dtype,
63 conv_dst_tensor.layout.dtype);
64 }
65 {
66 auto kparam = chanwise::Param::from_fwd_args(args);
67 auto stream = cuda_stream(args.handle);
68 switch (args.src_layout->dtype.enumv()) {
69 case DTypeEnum::Float32:
70 chanwise::run_fwd_small(
71 conv_dst_tensor.ptr<float>(), args.src_tensor->ptr<float>(),
72 args.filter_tensor->ptr<float>(), kparam, stream);
73 break;
74#if CUDA_VERSION >= 9000
75 case DTypeEnum::Float16:
76 chanwise::run_fwd_small(
77 static_cast<half*>(conv_dst_tensor.raw_ptr()),
78 static_cast<half*>(args.src_tensor->raw_ptr()),
79 static_cast<half*>(args.filter_tensor->raw_ptr()), kparam,
80 stream);
81 break;
82#endif
83 default:
84 megdnn_assert_internal(0);
85 }
86 }
87 handle_bias_and_nonlinear(
88 args.handle, args.nonlinear_mode, &conv_dst_tensor, args.dst_tensor,
89 args.bias_tensor);
90}
91
92// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 8

DTypeClass · 0.85
cuda_streamFunction · 0.85
get_workspace_in_bytesFunction · 0.50
enumvMethod · 0.45
getMethod · 0.45
raw_ptrMethod · 0.45

Tested by

no test coverage detected