| 36 | } |
| 37 | |
| 38 | TEST_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 | |
| 73 | TEST_CASE(cannot_inline_one) |
| 74 | { |
nothing calls this directly
no test coverage detected