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

Method try_copy_contig

dnn/src/cuda/relayout/opr_impl.cpp:65–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool RelayoutForwardImpl::Param::try_copy_contig() {
66 auto &&lsrc = m_src.layout, &&ldst = m_dst.layout;
67 if (lsrc.ndim != 1 || ldst.ndim != 1)
68 return false;
69 if (lsrc.stride[0] != 1 || ldst.stride[0] != 1)
70 return false;
71 size_t copy_size = ldst.span().dist_byte();
72
73 cuda_check(cudaMemcpyAsync(
74 m_dst.raw_ptr(), m_src.raw_ptr(), copy_size, cudaMemcpyDeviceToDevice,
75 m_opr->stream()));
76 return true;
77}
78
79bool RelayoutForwardImpl::expand_dim2(TensorLayout& dst, const TensorLayout& src) {
80 megdnn_assert(src.ndim == 2 && dst.ndim == 1);

Callers 1

execMethod · 0.45

Calls 4

dist_byteMethod · 0.80
spanMethod · 0.80
raw_ptrMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected