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

Method apply

src/propagate_precision.cpp:209–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209void 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

Callers

nothing calls this directly

Calls 12

get_moduleMethod · 0.80
insert_instructionMethod · 0.80
replace_instructionMethod · 0.80
make_opFunction · 0.70
transformFunction · 0.50
typeMethod · 0.45
get_shapeMethod · 0.45
beginMethod · 0.45
inputsMethod · 0.45
endMethod · 0.45
run_passMethod · 0.45

Tested by

no test coverage detected