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

Method prepare_for_exec

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

Source from the content-addressed store, hash-verified

172}
173
174void EagerEvalManager::prepare_for_exec(OperatorNodeBase* opr) {
175 // validate inputs
176 opr->add_input_layout_constraint();
177 for (auto&& i : opr->node_prop().dep_map()) {
178 using NodeProp = OperatorNodeBase::NodeProp;
179 bool is_empty = !i.first->shape().ndim;
180 if (NodeProp::is_device_value_dep(i.second)) {
181 mgb_assert(
182 i.first->dev_tensor_valid(),
183 "var value not valid, but required for opr input: "
184 "var=%s reader=%s{%s}",
185 cg::dump_var_info({i.first}).c_str(), opr->cname(),
186 opr->dyn_typeinfo()->name);
187 if (i.first->dev_tensor().empty()) {
188 is_empty = true;
189 } else {
190 ensure_input_layout(i.first);
191 }
192 }
193 if (is_empty) {
194 mgb_assert(
195 i.second & NodeProp::DepType::VALUE_ALLOW_EMPTY,
196 "var value is empty but the reader opr does not allow "
197 "this: var=%s reader=%s{%s}",
198 cg::dump_var_info({i.first}).c_str(), opr->cname(),
199 opr->dyn_typeinfo()->name);
200 }
201 }
202
203 // add input ready events
204 for (auto&& i : opr->input_waiting_spec()) {
205 for (auto j : i.dev_ready) {
206 auto mgr = VarNodeMemManager::var_node_cn_sync_manager(j);
207 if (!mgr->m_ready_event) {
208 mgr->m_ready_event = mgr->m_comp_node.create_event();
209 mgr->m_ready_event->record();
210 }
211 }
212 }
213}
214
215void EagerEvalManager::update_static_infer_result(OperatorNodeBase* opr) {
216 auto&& mgr =

Callers

nothing calls this directly

Calls 9

dev_tensor_validMethod · 0.80
input_waiting_specMethod · 0.80
shapeMethod · 0.45
cnameMethod · 0.45
emptyMethod · 0.45
dev_tensorMethod · 0.45
create_eventMethod · 0.45
recordMethod · 0.45

Tested by

no test coverage detected