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

Function reaches

src/instruction.cpp:607–620  ·  view source on GitHub ↗

DFS through inputs of `end` to find `start`. `start` must be positioned before `end`.

Source from the content-addressed store, hash-verified

605// DFS through inputs of `end` to find `start`.
606// `start` must be positioned before `end`.
607bool reaches(instruction_ref start, instruction_ref end)
608{
609 if(start == end)
610 return true;
611 std::unordered_set<instruction_ref> visited;
612 return fix<bool>([&](auto self, auto ins) -> bool {
613 if(ins == start)
614 return true;
615 // hit a previously visited instruction
616 if(not visited.insert(ins).second)
617 return false;
618 return std::any_of(ins->inputs().begin(), ins->inputs().end(), self);
619 })(end);
620}
621
622// `reaches` version that checks if instructions are in the module `m`
623// Additional condition that stops if DFS instruction's distance to `end`

Callers 11

TEST_CASEFunction · 0.85
apply_horizontal_finderFunction · 0.85
is_interdependentFunction · 0.85
find_input_pointwiseFunction · 0.85
find_output_pointwiseFunction · 0.85
find_splitsMethod · 0.85
is_dependentMethod · 0.85
find_parallel_reduceFunction · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 9

distanceFunction · 0.85
track_visitsFunction · 0.85
predicateClass · 0.85
any_ofFunction · 0.50
insertMethod · 0.45
beginMethod · 0.45
inputsMethod · 0.45
endMethod · 0.45
has_instructionMethod · 0.45

Tested by

no test coverage detected