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

Method init_waiting_spec

src/core/impl/graph/eager_eval.cpp:81–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void 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
119void EagerEvalManager::on_opr_insert(OperatorNodeBase* opr) {
120 if (m_first_opr_enable_status == -1) {

Callers

nothing calls this directly

Calls 10

emplace_backMethod · 0.80
backMethod · 0.80
input_waiting_specMethod · 0.80
outputMethod · 0.45
comp_nodeMethod · 0.45
insertMethod · 0.45
clearMethod · 0.45
contain_flagMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected