MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / replace

Method replace

src/instruction.cpp:76–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74};
75
76void instruction::replace(const shape& r)
77{
78 if(r != result)
79 {
80 result = r;
81 if(output.empty())
82 {
83 return;
84 }
85 auto start = std::find_if(output.front()->inputs().begin(),
86 output.front()->inputs().end(),
87 [&](instruction_ref x) { return this == as_address(x); });
88 assert(as_address(*start) == this);
89 std::priority_queue<instruction_ref, std::vector<instruction_ref>, replace_shape_order> q(
90 output.begin(), output.end(), replace_shape_order{*start});
91 while(not q.empty())
92 {
93 instruction_ref ins = q.top();
94 q.pop();
95 assert(ins->name() == "@return" or ins->name().front() != '@');
96 shape new_r = compute_shape(ins->op, ins->arguments, ins->module_args);
97 if(new_r != ins->result)
98 {
99 ins->result = new_r;
100 std::copy(ins->output.begin(), ins->output.end(), migraphx::push_inserter(q));
101 }
102 }
103 }
104}
105
106void instruction::replace(operation o)
107{

Callers

nothing calls this directly

Calls 12

as_addressFunction · 0.85
push_inserterFunction · 0.85
replaceFunction · 0.85
frontMethod · 0.80
compute_shapeFunction · 0.70
find_ifFunction · 0.50
copyFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
inputsMethod · 0.45
endMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected