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

Method get_workspace_in_bytes

dnn/src/fallback/reduce/opr_impl.cpp:69–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67namespace fallback {
68
69size_t ReduceImpl::get_workspace_in_bytes(
70 const TensorLayout& src, const TensorLayout& dst) {
71 MEGDNN_MARK_USED_VAR(src);
72 MEGDNN_MARK_USED_VAR(dst);
73
74 if (src.dtype.enumv() == DTypeEnum::Float32 &&
75 (param().mode == Mode::MEAN || param().mode == Mode::SUM ||
76 param().mode == Mode::SUM_SQR)) {
77 size_t A, B, C;
78 reduce::get_ABC(src, A, B, C, param().axis);
79 if (C == 1) {
80 // Using B = 247 as an example, you can understand why these parameters exist
81 size_t _60xT_in_4 = (60 * 3) / 4; // T = 3
82 size_t _60xX_in_4 = 4; // 0 < X < T, X = 1,2.
83 size_t _XXxT_in_4 = 4;
84 return ((B / _60xT_in_4 + _60xX_in_4 + _XXxT_in_4) * sizeof(float));
85 }
86 }
87 return naive::ReduceForwardImpl::get_workspace_in_bytes(src, dst);
88}
89
90void ReduceImpl::exec(
91 _megdnn_tensor_in src, _megdnn_tensor_out dst, _megdnn_workspace workspace) {

Callers

nothing calls this directly

Calls 4

get_ABCFunction · 0.85
paramFunction · 0.50
get_workspace_in_bytesFunction · 0.50
enumvMethod · 0.45

Tested by

no test coverage detected