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

Method Impl

src/gopt/impl/inference.cpp:405–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405ParamRedistributePass::Impl::Impl(OptState& state)
406 : RecursiveSubGraphRewriteHelper{state},
407 m_cvprop{ConstVarType::IMMUTABLE_AND_PARAM},
408 m_uniq_reader_check{state.graph()} {
409 auto cg = state.graph().comp_graph();
410 auto on_new_opr = [this](const cg::event::OprInserted& ev) {
411 if (!ev.is_dedup && !ev.exc) {
412 // call add_opr eagerly to avoid deep recursion
413 m_cvprop.add_opr(ev.opr);
414 }
415 };
416 auto hdl = cg->event().register_receiver<cg::event::OprInserted>(on_new_opr);
417 apply();
418}
419
420void ParamRedistributePass::apply(OptState& state) const {
421 MIDOUT_B("ParamRedistributePass::apply")

Callers

nothing calls this directly

Calls 4

comp_graphMethod · 0.80
applyFunction · 0.50
graphMethod · 0.45
add_oprMethod · 0.45

Tested by

no test coverage detected