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

Function find_pointwise_modules

src/fuse_pointwise.cpp:274–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274static bool find_pointwise_modules(module_pass_manager& mpm, bool multi_out)
275{
276 bool changed = false;
277 auto last = std::prev(mpm.get_module().end());
278 for(auto ins : iterator_for(mpm.get_module()))
279 {
280 if(ins != last and is_dead(ins))
281 continue;
282 auto pw_outs = find_output_pointwise(mpm.get_module(), ins, multi_out);
283
284 if(pw_outs.size() > 1)
285 {
286 (void)std::accumulate(
287 pw_outs.begin() + 1, pw_outs.end(), pw_outs.front(), [&](auto input, auto output) {
288 return merge_instruction(mpm, input, output);
289 });
290 changed = true;
291 }
292 else if(ins->name() == "pointwise")
293 {
294 auto it = find_input_pointwise(mpm.get_module(), ins, multi_out);
295 if(it == ins->inputs().end())
296 continue;
297 auto input = *it;
298 if(is_dead(input))
299 continue;
300 merge_instruction(mpm, input, ins);
301
302 changed = true;
303 }
304 }
305 return changed;
306}
307
308namespace {
309struct pointwise_reshape : rewrite_reshapes_base

Callers 1

applyMethod · 0.85

Calls 13

iterator_forFunction · 0.85
is_deadFunction · 0.85
find_output_pointwiseFunction · 0.85
accumulateFunction · 0.85
merge_instructionFunction · 0.85
find_input_pointwiseFunction · 0.85
get_moduleMethod · 0.80
frontMethod · 0.80
endMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected