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

Function TEST_CASE

test/inline_module_test.cpp:38–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38TEST_CASE(cannot_inline_both)
39{
40 auto create_program = [] {
41 migraphx::program p;
42 auto* mm = p.get_main_module();
43 migraphx::shape sd{migraphx::shape::float_type, {2, 3}};
44 auto x = mm->add_parameter("x", sd);
45
46 std::vector<float> one(sd.elements(), 1);
47 std::vector<float> two(sd.elements(), 2);
48
49 auto* then_smod = p.create_module("then_smod");
50 auto l1 = then_smod->add_literal(migraphx::literal{sd, one});
51 auto r1 = then_smod->add_instruction(migraphx::make_op("add"), x, l1);
52 then_smod->add_return({r1});
53
54 auto* else_smod = p.create_module("else_smod");
55 auto l2 = else_smod->add_literal(migraphx::literal{sd, two});
56 auto r2 = else_smod->add_instruction(migraphx::make_op("mul"), x, l2);
57 else_smod->add_return({r2});
58
59 migraphx::shape s_cond{migraphx::shape::bool_type, {1}};
60 auto cond = mm->add_parameter("cond", s_cond);
61 auto ret = mm->add_instruction(migraphx::make_op("if"), {cond}, {then_smod, else_smod});
62 mm->add_return({ret});
63
64 return p;
65 };
66
67 auto p = create_program();
68 run_pass(p);
69
70 EXPECT(p == create_program());
71}
72
73TEST_CASE(cannot_inline_one)
74{

Callers

nothing calls this directly

Calls 12

get_main_moduleMethod · 0.80
add_parameterMethod · 0.80
add_outlineMethod · 0.80
run_passFunction · 0.70
make_opFunction · 0.50
create_programFunction · 0.50
literalClass · 0.50
elementsMethod · 0.45
create_moduleMethod · 0.45
add_literalMethod · 0.45
add_instructionMethod · 0.45
add_returnMethod · 0.45

Tested by

no test coverage detected