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

Function is_sorted

test/module_test.cpp:40–54  ·  view source on GitHub ↗

Check the module is topologically sorted TODO: Use test::make_predicate

Source from the content-addressed store, hash-verified

38// Check the module is topologically sorted
39// TODO: Use test::make_predicate
40static bool is_sorted(migraphx::module& m)
41{
42 std::unordered_set<migraphx::instruction_ref> visited;
43 for(auto ins : migraphx::iterator_for(m))
44 {
45 visited.insert(ins);
46 if(std::any_of(ins->inputs().begin(), ins->inputs().end(), [&](auto i) {
47 return not visited.count(i);
48 }))
49 {
50 return false; // Found an input that has not been visited yet
51 }
52 }
53 return true;
54}
55
56static void shuffle_module(migraphx::module& m)
57{

Callers 4

TEST_CASEFunction · 0.70
TEST_CASEFunction · 0.70
TEST_CASEFunction · 0.70
TEST_CASEFunction · 0.50

Calls 6

iterator_forFunction · 0.85
any_ofFunction · 0.50
insertMethod · 0.45
beginMethod · 0.45
inputsMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected