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

Method process_opr

src/core/impl/graph/operator_node.cpp:707–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707void PostExecActions::process_opr(
708 OperatorNodeBase& opr, OperatorNodeBase::ExecEnv& env) {
709 // PostExecActions should be empty most of the time; so we store the objects
710 // directly in a SmallVector and copy them to a shared_ptr when non-empty
711 SmallVector<PostExecActions> actions;
712 for (auto i : opr.output()) {
713 bool found = false;
714 for (auto&& j : actions) {
715 if (j.m_comp_node == i->comp_node()) {
716 j.add(i);
717 found = true;
718 break;
719 }
720 }
721 if (!found) {
722 actions.emplace_back(i);
723 }
724 }
725
726 for (auto&& i : actions) {
727 if (!i.m_items.empty()) {
728 auto cn = i.m_comp_node;
729 MGB_IF_COND_EXEC(i.m_mask = ExecutionMask::get_from_opr(&opr));
730 auto cb = [action = std::make_shared<PostExecActions>(std::move(i))]() {
731 action->perform();
732 };
733 env.dispatch_on_comp_node_with_mask(cn, cb, nullptr);
734 }
735 }
736}
737
738// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}

Callers

nothing calls this directly

Calls 7

emplace_backMethod · 0.80
outputMethod · 0.45
comp_nodeMethod · 0.45
addMethod · 0.45
emptyMethod · 0.45
performMethod · 0.45

Tested by

no test coverage detected