| 38 | } |
| 39 | |
| 40 | void 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 | |
| 59 | void ExecutionMask::enable(bool flag) { |
| 60 | m_enabled = flag; |