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

Method make_bundle

dnn/src/cambricon/powc/opr_impl.cpp:12–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace cambricon;
11
12WorkspaceBundle PowCImpl::make_bundle(
13 const TensorLayout& src, const TensorLayout& dst) {
14 auto handle = concrete_handle(this->handle());
15 CnnlTensorDescriptor desc_inp, desc_exp, desc_out;
16 auto layout = CNNL_LAYOUT_ARRAY;
17 desc_inp.set(src, layout);
18 desc_out.set(dst, layout);
19 std::vector<size_t> dims = {1};
20 desc_exp.set(1, dims, convert_to_cnnl_datatype(src.dtype.enumv()), layout);
21 size_t powc_workspace = 0;
22 cnnl_check(cnnlGetPowWorkspaceSize(
23 handle->cnnl_handle(), desc_inp.desc(), desc_exp.desc(), desc_out.desc(),
24 &powc_workspace));
25 size_t exp_workspace = sizeof(float);
26 return {nullptr, {exp_workspace, powc_workspace}, handle->alignment_requirement()};
27}
28
29size_t PowCImpl::get_workspace_in_bytes(
30 const TensorLayout& src, const TensorLayout& dst) {

Callers

nothing calls this directly

Calls 8

convert_to_cnnl_datatypeFunction · 0.85
cnnl_handleMethod · 0.80
concrete_handleFunction · 0.50
handleMethod · 0.45
setMethod · 0.45
enumvMethod · 0.45
descMethod · 0.45
alignment_requirementMethod · 0.45

Tested by

no test coverage detected