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

Method exec

dnn/src/cuda/local/backward_data.cpp:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20namespace cuda {
21
22void LocalBackwardDataImpl::exec(
23 _megdnn_tensor_in filter, _megdnn_tensor_in diff, _megdnn_tensor_out grad,
24 _megdnn_workspace workspace) {
25 check_exec(filter.layout, diff.layout, grad.layout, workspace.size);
26 megdnn_assert(param().mode == Mode::CROSS_CORRELATION);
27 auto N = grad.layout.shape[0], IC = grad.layout.shape[1], IH = grad.layout.shape[2],
28 IW = grad.layout.shape[3];
29 auto OC = diff.layout.shape[1], OH = diff.layout.shape[2],
30 OW = diff.layout.shape[3];
31 auto FH = filter.layout.shape[3], FW = filter.layout.shape[4];
32 auto handle = concrete_handle(this->handle());
33 auto stream = cuda_stream(this->handle());
34 auto cublas = cublas_handle(this->handle());
35 auto one = handle->one_device();
36 auto zero = handle->zero_device();
37 if (use_cuda_convnet(filter.layout, diff.layout, grad.layout)) {
38 local::backward_data_proxy_convnet(
39 filter.ptr<dt_float32>(), diff.ptr<dt_float32>(),
40 grad.ptr<dt_float32>(), reinterpret_cast<float*>(workspace.raw_ptr), N,
41 IC, IH, IW, OC, OH, OW, FH, FW, IC * IH * IW, OC * OH * OW,
42 param().pad_h, param().pad_w, param().stride_h, param().stride_w,
43 cublas, stream, one, zero);
44 } else {
45 local::boom_backward_data();
46 }
47}
48
49size_t LocalBackwardDataImpl::get_workspace_in_bytes(
50 const TensorLayout& filter, const TensorLayout& diff,

Callers

nothing calls this directly

Calls 8

cuda_streamFunction · 0.85
cublas_handleFunction · 0.85
boom_backward_dataFunction · 0.85
paramFunction · 0.50
concrete_handleFunction · 0.50
handleMethod · 0.45
one_deviceMethod · 0.45
zero_deviceMethod · 0.45

Tested by

no test coverage detected