| 60 | } |
| 61 | |
| 62 | TEST_CASE(tanh_shape) |
| 63 | { |
| 64 | auto create_program = [] { |
| 65 | migraphx::program p; |
| 66 | auto* mm = p.get_main_module(); |
| 67 | migraphx::shape s{migraphx::shape::float_type, {2, 3}}; |
| 68 | auto x = mm->add_parameter("x", s); |
| 69 | auto tx = mm->add_instruction(migraphx::op::transpose{{1, 0}}, x); |
| 70 | auto txh = mm->add_instruction(migraphx::op::tanh{}, tx); |
| 71 | auto sum = mm->add_instruction(migraphx::op::add{}, txh, txh); |
| 72 | mm->add_instruction(migraphx::op::contiguous{}, sum); |
| 73 | |
| 74 | return p; |
| 75 | }; |
| 76 | |
| 77 | auto p1 = create_program(); |
| 78 | auto p2 = create_program(); |
| 79 | EXPECT(p1 == p2); |
| 80 | |
| 81 | run_lowering(p1); |
| 82 | run_lowering(p2); |
| 83 | |
| 84 | EXPECT(p1 == p2); |
| 85 | |
| 86 | for(auto ins : iterator_for(*p1.get_main_module())) |
| 87 | { |
| 88 | if(ins->name() == "hip::allocate") |
| 89 | { |
| 90 | migraphx::shape new_s{migraphx::shape::float_type, {3, 2}, {1, 3}}; |
| 91 | ins->replace(migraphx::gpu::hip_allocate{new_s}); |
| 92 | } |
| 93 | } |
| 94 | EXPECT(p1 != p2); |
| 95 | |
| 96 | migraphx::run_passes(*p2.get_main_module(), |
| 97 | {migraphx::adjust_allocation{migraphx::gpu::gpu_allocation_model{}}, |
| 98 | migraphx::dead_code_elimination{}}); |
| 99 | EXPECT(p1 == p2); |
| 100 | } |
| 101 | |
| 102 | TEST_CASE(no_copy_dead_param) |
| 103 | { |
nothing calls this directly
no test coverage detected