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

Method on_comp_seq_determined

src/plugin/impl/infkern_finder.cpp:199–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void InfkernFinder::on_comp_seq_determined(
200 const cg::event::CompSeqOrderDetermined& ev) {
201 m_current_comp_seq = ev.exec;
202 m_opr_seq.clear();
203 m_opr2state.clear();
204 auto cb = [&](OperatorNodeBase* opr) {
205 m_opr_seq.emplace_back(this, opr, ev.graph);
206 m_global_state->oprid2ptr[opr->id()] = opr;
207 for (auto&& i : get_opr_comp_node_set(opr))
208 m_global_state->cn2marker_dev[i];
209 return true;
210 };
211 ev.exec->iter_opr_seq(cb);
212 for (auto&& i : m_opr_seq)
213 m_opr2state[i.opr()] = &i;
214
215 for (auto&& i : m_global_state->cn2marker_dev) {
216 if (i.second.shape().ndim)
217 continue;
218 HostTensorND hv{i.first, dtype::Int32()};
219 hv.resize({1}).ptr<dt_int32>()[0] = OprState::EVENT_STATE_MARKER_VALUE;
220 i.second.copy_from(hv).sync();
221 }
222}
223
224void InfkernFinder::on_comp_seq_finished(const cg::event::CompSeqExecFinished& ev) {
225 mgb_assert(ev.exec == m_current_comp_seq);

Callers

nothing calls this directly

Calls 8

emplace_backMethod · 0.80
resizeMethod · 0.80
clearMethod · 0.45
idMethod · 0.45
oprMethod · 0.45
shapeMethod · 0.45
syncMethod · 0.45
copy_fromMethod · 0.45

Tested by

no test coverage detected