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

Method exec

dnn/test/common/opr_proxy.h:450–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448 virtual void init(Opr*, const TensorNDArray&) {}
449
450 virtual void exec(Opr* opr, const TensorNDArray& tensors) {
451 megdnn_assert(tensors.size() == arity);
452 if (!W.valid()) {
453 W = WorkspaceWrapper(opr->handle(), 0);
454 }
455 TensorLayoutArray layouts;
456 for (auto&& tensor : tensors) {
457 layouts.push_back(tensor.layout);
458 }
459 if (m_profiling && !target_execution_policy.algo.valid()) {
460 FastRunCache cache;
461 std::string param_str;
462 Algorithm::serialize_write_pod(opr->param(), param_str);
463 auto&& search_items =
464 flatten_search_space(layouts, param_str, opr->handle());
465 FOREACH_OPR_TYPE_DISPATCH(search_items, {
466 OprProxyProfilingBase<_Opr>::search(
467 _item.layouts, _item.param, W, opr->handle(), warmup_times,
468 exec_times, cache);
469 });
470
471 construct_execution_policy(
472 layouts, param_str, opr->handle(), cache, opr->execution_policy());
473 target_execution_policy = opr->execution_policy();
474 auto workspace_size =
475 AlgoProxy<Opr, arity>::get_workspace_in_bytes(opr, layouts);
476 W.update(workspace_size);
477 }
478 if (!target_execution_policy.algo.valid()) {
479 auto workspace_size =
480 AlgoProxy<Opr, arity>::get_workspace_in_bytes(opr, layouts);
481 W.update(workspace_size);
482 }
483 AlgoProxy<Opr, arity>::exec(opr, tensors, W.workspace());
484 }
485
486 virtual ~OprProxyProfilingBase() {}
487};

Callers 5

execMethod · 0.45
execMethod · 0.45
execMethod · 0.45
execMethod · 0.45
execMethod · 0.45

Calls 13

WorkspaceWrapperClass · 0.85
serialize_write_podFunction · 0.85
flatten_search_spaceFunction · 0.85
searchFunction · 0.85
get_workspace_in_bytesFunction · 0.50
execFunction · 0.50
sizeMethod · 0.45
validMethod · 0.45
handleMethod · 0.45
push_backMethod · 0.45
paramMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected