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

Function TEST_CASE

test/liveness_test.cpp:31–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29#include <test.hpp>
30
31TEST_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
49TEST_CASE(liveness_multi_alias)
50{

Callers

nothing calls this directly

Calls 7

livenessFunction · 0.85
containsFunction · 0.85
get_main_moduleMethod · 0.80
add_literalMethod · 0.45
add_instructionMethod · 0.45
add_returnMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected