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

Method exec

dnn/src/rocm/relayout/opr_impl.cpp:120–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void RelayoutForwardImpl::exec(
121 _megdnn_tensor_in src, _megdnn_tensor_out dst, Handle* src_handle) {
122 bool cross_dev = false;
123
124 // check whether cross device copy
125 if (src_handle && src_handle != handle()) {
126 megcoreDeviceHandle_t dev;
127 megcoreGetDeviceHandle(src_handle->megcore_computing_handle(), &dev);
128 megcorePlatform_t plat;
129 megcoreGetPlatform(dev, &plat);
130 megdnn_assert(
131 plat == megcorePlatformROCM,
132 "only relayout between rocm devices are supported");
133 int dst_dev_id = -1, src_dev_id = -1;
134 megcoreGetDeviceID(dev, &src_dev_id);
135
136 megcoreGetDeviceHandle(this->handle()->megcore_computing_handle(), &dev);
137 megcoreGetDeviceID(dev, &dst_dev_id);
138
139 megdnn_assert(src_dev_id >= 0 && dst_dev_id >= 0);
140 cross_dev = src_dev_id != dst_dev_id;
141 }
142 Param param{src, dst, this};
143 if (!param.try_copy_contig() && !param.try_copy_2d() &&
144 !param.try_copy_last_contig()) {
145 megdnn_assert(!cross_dev, "cross-device general non-contig copy unsupported");
146 param.copy_general();
147 }
148}
149
150// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 9

megcoreGetDeviceHandleFunction · 0.85
megcoreGetPlatformFunction · 0.85
megcoreGetDeviceIDFunction · 0.85
handleMethod · 0.45
try_copy_contigMethod · 0.45
try_copy_2dMethod · 0.45
try_copy_last_contigMethod · 0.45
copy_generalMethod · 0.45

Tested by

no test coverage detected