| 207 | } |
| 208 | |
| 209 | void propagate_precision::apply(module_pass_manager& mpm) const |
| 210 | { |
| 211 | auto upgrade = find_instruction_to_upgrade(mpm.get_module()); |
| 212 | for(const auto& p : upgrade) |
| 213 | { |
| 214 | auto ins = p.first; |
| 215 | auto t = p.second; |
| 216 | auto convert1 = mpm.get_module().insert_instruction( |
| 217 | std::next(ins), make_op("convert", {{"target_type", ins->get_shape().type()}}), ins); |
| 218 | mpm.get_module().replace_instruction(ins, convert1); |
| 219 | std::vector<instruction_ref> inputs; |
| 220 | std::transform(ins->inputs().begin(), |
| 221 | ins->inputs().end(), |
| 222 | std::back_inserter(inputs), |
| 223 | [&](auto input) { |
| 224 | return mpm.get_module().insert_instruction( |
| 225 | ins, make_op("convert", {{"target_type", t}}), input); |
| 226 | }); |
| 227 | mpm.get_module().replace_instruction(ins, ins->get_operator(), inputs); |
| 228 | } |
| 229 | mpm.run_pass(eliminate_convert{}); |
| 230 | } |
| 231 | |
| 232 | } // namespace MIGRAPHX_INLINE_NS |
| 233 | } // namespace migraphx |
nothing calls this directly
no test coverage detected