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

Method exec

dnn/src/atlas/checksum/opr_impl.cpp:17–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17ChecksumForward::Result ChecksumForwardImpl::exec(
18 _megdnn_tensor_in data, _megdnn_workspace workspace) {
19 check_exec(data.layout, workspace.size);
20 //! FIXME currently the cce programming interface is not so stable, here i
21 //! just allocate some memory of cpu here and compute the result in cpu
22 std::vector<uint8_t> cpu_data(data.layout.span().dist_byte(), 0);
23
24 megcoreDeviceHandle_t dev_handle;
25 megcoreComputingHandle_t comp_handle = handle()->megcore_computing_handle();
26 megcoreGetDeviceHandle(comp_handle, &dev_handle);
27 megcoreMemcpy(
28 comp_handle, cpu_data.data(), data.raw_ptr(), cpu_data.size(),
29 megcoreMemcpyDeviceToHost);
30 megcoreSynchronize(comp_handle);
31
32 auto opr = inplace_cpu_handle()->create_operator<ChecksumForward>();
33 size_t workspace_size = opr->get_workspace_in_bytes(data.layout);
34 std::vector<uint8_t> cpu_workspace_data(workspace_size, 0);
35
36 Workspace cpu_workspace(
37 reinterpret_cast<dt_byte*>(cpu_workspace_data.data()),
38 cpu_workspace_data.size());
39
40 return opr->exec(TensorND{cpu_data.data(), data.layout}, cpu_workspace);
41}
42
43// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 10

megcoreGetDeviceHandleFunction · 0.85
megcoreMemcpyFunction · 0.85
megcoreSynchronizeFunction · 0.85
dist_byteMethod · 0.80
spanMethod · 0.80
dataMethod · 0.45
raw_ptrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected