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

Method get_workspace_in_bytes

dnn/src/fallback/matrix_mul/opr_impl.cpp:231–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231size_t MatrixMulImpl::get_workspace_in_bytes(
232 const TensorLayout& A, const TensorLayout& B, const TensorLayout& C) {
233 TensorLayoutArray layouts{A, B, C};
234 AlgorithmCache::Key key{this->handle(), this->get_opr_type(),
235 layouts.data(), layouts.size(),
236 &this->param(), sizeof(this->param())};
237 auto rst = AlgorithmCache::instance().get(key);
238 if (rst.policy.algo.valid()) {
239 return rst.workspace;
240 }
241
242 if (auto algo = get_algorithm_heuristic(
243 A, B, C, std::numeric_limits<size_t>::max(), AlgoAttribute::DEFAULT,
244 AlgoAttribute::DEFAULT)) {
245 auto kern_size_param = make_kern_size_param(A, B, C);
246 return static_cast<AlgoBase*>(algo)->get_workspace(kern_size_param);
247 }
248 return 0;
249}
250
251void MatrixMulImpl::exec(
252 _megdnn_tensor_in A, _megdnn_tensor_in B, _megdnn_tensor_out C,

Callers

nothing calls this directly

Calls 9

maxFunction · 0.85
handleMethod · 0.45
get_opr_typeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
paramMethod · 0.45
getMethod · 0.45
validMethod · 0.45
get_workspaceMethod · 0.45

Tested by

no test coverage detected