| 29 | #include <test.hpp> |
| 30 | |
| 31 | TEST_CASE(liveness_single_alias) |
| 32 | { |
| 33 | migraphx::program p; |
| 34 | auto* mm = p.get_main_module(); |
| 35 | auto x = mm->add_literal( |
| 36 | migraphx::literal{migraphx::shape{migraphx::shape::float_type, {2}}, {1.0f, 2.0f}}); |
| 37 | auto p1 = mm->add_instruction(pass_op{}, x); |
| 38 | auto p2 = mm->add_instruction(pass_op{}, p1); |
| 39 | mm->add_return({p2}); |
| 40 | |
| 41 | std::vector<migraphx::instruction_ref> consumed; |
| 42 | migraphx::liveness(*mm, [&](auto ins, const auto&) { consumed.push_back(ins); }); |
| 43 | |
| 44 | // With single alias ops, pass_ops alias to x, so liveness tracks x |
| 45 | // The callback is called when x is "consumed" (last usage) |
| 46 | EXPECT(migraphx::contains(consumed, x)); |
| 47 | } |
| 48 | |
| 49 | TEST_CASE(liveness_multi_alias) |
| 50 | { |
nothing calls this directly
no test coverage detected