| 32 | inline namespace MIGRAPHX_INLINE_NS { |
| 33 | |
| 34 | void preallocate_param::apply(module& m) const |
| 35 | { |
| 36 | auto last = std::prev(m.end()); |
| 37 | for(auto ins : iterator_for(m)) |
| 38 | { |
| 39 | if(ins->name() != "@param") |
| 40 | continue; |
| 41 | if(param != any_cast<builtin::param>(ins->get_operator()).parameter) |
| 42 | continue; |
| 43 | std::string id = m.name() + ":" + param; |
| 44 | auto r = m.insert_instruction(ins, model.preallocate(ins->get_shape(), id)); |
| 45 | m.replace_instruction(ins, r); |
| 46 | m.move_instruction(ins, m.end()); |
| 47 | } |
| 48 | m.remove_instructions(std::next(last), m.end()); |
| 49 | } |
| 50 | |
| 51 | } // namespace MIGRAPHX_INLINE_NS |
| 52 | } // namespace migraphx |
nothing calls this directly
no test coverage detected