| 41 | } |
| 42 | |
| 43 | TEST_CASE(propagate_input) |
| 44 | { |
| 45 | migraphx::shape s1{migraphx::shape::half_type, {2, 3}}; |
| 46 | migraphx::shape s2{migraphx::shape::float_type, {2, 3}}; |
| 47 | migraphx::module m1; |
| 48 | { |
| 49 | auto x = m1.add_parameter("x", s1); |
| 50 | auto y = m1.add_parameter("y", s2); |
| 51 | auto two = m1.add_literal(migraphx::literal{{migraphx::shape::half_type}, {2}}); |
| 52 | auto div = migraphx::add_common_op(m1, migraphx::make_op("div"), {x, two}); |
| 53 | auto sqrt = m1.add_instruction(migraphx::make_op("sqrt"), div); |
| 54 | auto convert1 = m1.add_instruction( |
| 55 | migraphx::make_op("convert", {{"target_type", migraphx::shape::float_type}}), sqrt); |
| 56 | auto mul = m1.add_instruction(migraphx::make_op("mul"), convert1, y); |
| 57 | auto convert2 = m1.add_instruction( |
| 58 | migraphx::make_op("convert", {{"target_type", migraphx::shape::half_type}}), mul); |
| 59 | m1.add_return({convert2}); |
| 60 | } |
| 61 | run_pass(m1); |
| 62 | migraphx::module m2; |
| 63 | { |
| 64 | auto x = m2.add_parameter("x", s1); |
| 65 | auto y = m2.add_parameter("y", s2); |
| 66 | auto convert1 = m2.add_instruction( |
| 67 | migraphx::make_op("convert", {{"target_type", migraphx::shape::float_type}}), x); |
| 68 | auto two = m2.add_literal(migraphx::literal{{migraphx::shape::half_type}, {2}}); |
| 69 | auto div = migraphx::add_common_op(m2, migraphx::make_op("div"), {convert1, two}); |
| 70 | auto sqrt = m2.add_instruction(migraphx::make_op("sqrt"), div); |
| 71 | auto mul = m2.add_instruction(migraphx::make_op("mul"), sqrt, y); |
| 72 | auto convert2 = m2.add_instruction( |
| 73 | migraphx::make_op("convert", {{"target_type", migraphx::shape::half_type}}), mul); |
| 74 | m2.add_return({convert2}); |
| 75 | } |
| 76 | EXPECT(m1.sort() == m2.sort()); |
| 77 | } |
| 78 | |
| 79 | TEST_CASE(propagate_output) |
| 80 | { |
nothing calls this directly
no test coverage detected