| 74 | }; |
| 75 | |
| 76 | void 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 | |
| 106 | void instruction::replace(operation o) |
| 107 | { |
nothing calls this directly
no test coverage detected