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

Function create_reduce_modules

src/fuse_reduce.cpp:105–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static void create_reduce_modules(module_pass_manager& mpm)
106{
107 std::size_t n = 0;
108 for(auto ins : iterator_for(mpm.get_module()))
109 {
110 if(not ins->get_operator().attributes().get("reduce", false))
111 continue;
112 if(ins->inputs().size() != 1)
113 continue;
114
115 auto* rm =
116 mpm.create_module(mpm.get_module().name() + ":" + ins->name() + std::to_string(n++));
117 rm->set_bypass();
118
119 rm->add_return(rm->fuse({ins}));
120 auto v = ins->get_operator().to_value();
121 mpm.get_module().replace_instruction(
122 ins, make_op("fused_reduce", {{"axes", v["axes"]}}), ins->inputs(), {rm});
123 }
124}
125
126namespace {
127

Callers 1

applyMethod · 0.85

Calls 15

iterator_forFunction · 0.85
get_moduleMethod · 0.80
set_bypassMethod · 0.80
replace_instructionMethod · 0.80
make_opFunction · 0.70
to_stringFunction · 0.50
getMethod · 0.45
attributesMethod · 0.45
sizeMethod · 0.45
inputsMethod · 0.45
create_moduleMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected