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

Function TEST_CASE

test/gpu/adjust_allocation.cpp:62–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62TEST_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
102TEST_CASE(no_copy_dead_param)
103{

Callers

nothing calls this directly

Calls 13

iterator_forFunction · 0.85
run_passesFunction · 0.85
make_precompile_opFunction · 0.85
get_main_moduleMethod · 0.80
add_parameterMethod · 0.80
run_loweringFunction · 0.70
create_programFunction · 0.50
make_opFunction · 0.50
to_valueFunction · 0.50
add_instructionMethod · 0.45
nameMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected