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

Function recursive_replace

src/jit/impl/internal_graph.cpp:13–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12namespace {
13void recursive_replace(
14 ThinHashMap<VarNode*, VarNode*>& old2new, OperatorNodeBase* opr) {
15 VarNodeArray rewritten_inputs;
16 for (auto inp : opr->input()) {
17 if (!old2new.count(inp))
18 recursive_replace(old2new, inp->owner_opr());
19 rewritten_inputs.push_back(old2new[inp]);
20 }
21 auto new_opr =
22 serialization::copy_opr_shallow(*opr, rewritten_inputs, opr->config());
23 for (size_t i = 0; i < opr->output().size(); ++i) {
24 if (!opr->output(i)->contain_flag(VarNode::Flag::VOLATILE_CONTENT)) {
25 old2new[opr->output(i)] = new_opr->output(i);
26 }
27 }
28}
29
30InternalGraphPtr expand_executor_opr(const InternalGraphPtr& prev_igraph) {
31 bool has_jit_executor = false;

Callers 1

expand_executor_oprFunction · 0.85

Calls 7

inputMethod · 0.45
countMethod · 0.45
owner_oprMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
outputMethod · 0.45
contain_flagMethod · 0.45

Tested by

no test coverage detected