| 79 | } |
| 80 | |
| 81 | void EagerEvalManager::init_waiting_spec(OperatorNodeBase* opr) { |
| 82 | CompNode::UnorderedSet cur_used_cn; |
| 83 | CompNode::UnorderedMap<ThinHashSet<VarNode*>> vars_to_wait; |
| 84 | using NodeProp = OperatorNodeBase::NodeProp; |
| 85 | |
| 86 | OperatorNodeBase::InputWaitingSpec waiting_spec; |
| 87 | for (auto ovar : opr->output()) { |
| 88 | auto cn = ovar->comp_node(); |
| 89 | if (!cur_used_cn.insert(cn).second) |
| 90 | continue; |
| 91 | |
| 92 | vars_to_wait.clear(); |
| 93 | |
| 94 | for (auto&& i : opr->node_prop().dep_map()) { |
| 95 | if (i.first->contain_flag(VarNode::Flag::PERSISTENT_DEVICE_VALUE)) { |
| 96 | // do not wait on PERSISTENT_DEVICE_VALUE vars |
| 97 | continue; |
| 98 | } |
| 99 | if (NodeProp::is_device_comp_order_dep(i.second) && |
| 100 | i.first->comp_node() != cn) { |
| 101 | vars_to_wait[i.first->comp_node()].insert(i.first); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | if (!vars_to_wait.empty()) { |
| 106 | waiting_spec.emplace_back(); |
| 107 | waiting_spec.back().comp_node = cn; |
| 108 | for (auto&& i : vars_to_wait) { |
| 109 | for (auto j : i.second) { |
| 110 | waiting_spec.back().dev_ready.push_back(j); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | opr->input_waiting_spec(std::move(waiting_spec)); |
| 117 | } |
| 118 | |
| 119 | void EagerEvalManager::on_opr_insert(OperatorNodeBase* opr) { |
| 120 | if (m_first_opr_enable_status == -1) { |
nothing calls this directly
no test coverage detected