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

Method register_to_opr

src/core/impl/graph/execution_mask.cpp:40–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void ExecutionMask::register_to_opr(OperatorNodeBase* opr) {
41 auto&& acc = opr->node_prop().attribute().accessory;
42 if (m_owner) {
43 mgb_assert(m_owner->owner_graph() == opr->owner_graph());
44 }
45 mgb_assert(
46 !acc.exec_mask, "multiple ExecutionMask objects registered to %s{%s}",
47 opr->cname(), opr->dyn_typeinfo()->name);
48 acc.exec_mask = this;
49 RefHolder::get(opr->owner_graph()).add(shared_from_this());
50#if MGB_ENABLE_JSON
51 (*opr->to_json_extra_json)["execution_mask"] = json::NumberInt::make(m_id);
52#endif
53 // require all vars to use dynamic mem since this opr may be disabled
54 for (auto i : opr->output()) {
55 i->add_flag(VarNode::Flag::NO_SYS_STATIC_MEM_ALLOC);
56 }
57}
58
59void ExecutionMask::enable(bool flag) {
60 m_enabled = flag;

Callers 2

TESTFunction · 0.80
on_new_oprMethod · 0.80

Calls 7

getFunction · 0.85
makeFunction · 0.70
attributeMethod · 0.45
owner_graphMethod · 0.45
cnameMethod · 0.45
addMethod · 0.45
outputMethod · 0.45

Tested by 1

TESTFunction · 0.64