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

Function TEST_CASE

test/gpu/fuse_mlir.cpp:101–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101TEST_CASE(dot_reshapes_add)
102{
103 migraphx::shape s{migraphx::shape::float_type, {1, 3, 3}};
104 migraphx::program p1;
105 {
106 auto* mm = p1.get_main_module();
107 auto a = mm->add_parameter("a", s);
108 auto b = mm->add_parameter("b", s);
109 auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {3, 3}});
110 auto dot = mm->add_instruction(migraphx::make_op("dot"), a, b);
111 auto dot_trans =
112 mm->add_instruction(migraphx::make_op("transpose", {{"permutation", {0, 2, 1}}}), dot);
113 auto dot_sq = mm->add_instruction(migraphx::make_op("squeeze"), dot_trans);
114 auto add = add_pointwise(p1, "main:pointwise0", {dot_sq, x}, single_pointwise("add"));
115 mm->add_return({add});
116 }
117 run_pass(p1);
118 migraphx::program p2;
119 {
120 auto* mm = p2.get_main_module();
121 auto a = mm->add_parameter("a", s);
122 auto b = mm->add_parameter("b", s);
123 auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {3, 3}});
124 auto fused =
125 add_mlir(p2, "mlir_main:pointwise0", {a, b, x}, [=](auto* pm, const auto& inputs) {
126 auto dot = pm->add_instruction(migraphx::make_op("dot"), inputs[0], inputs[1]);
127 auto dot_trans = pm->add_instruction(
128 migraphx::make_op("transpose", {{"permutation", {0, 2, 1}}}), dot);
129 auto dot_rsp = pm->add_instruction(migraphx::make_op("squeeze"), dot_trans);
130 auto add = pm->add_instruction(migraphx::make_op("add"), dot_rsp, inputs[2]);
131 return std::make_tuple(dot->get_operator(), add);
132 });
133 mm->add_return({fused});
134 }
135 EXPECT(p1.sort() == p2.sort());
136}
137
138TEST_CASE(dot_add)
139{

Callers

nothing calls this directly

Calls 15

add_pointwiseFunction · 0.85
single_pointwiseFunction · 0.85
add_mlirFunction · 0.85
generate_literalFunction · 0.85
add_reduceFunction · 0.85
squaredFunction · 0.85
add_groupFunction · 0.85
starts_withFunction · 0.85
get_main_moduleMethod · 0.80
add_parameterMethod · 0.80
lensMethod · 0.80
atMethod · 0.80

Tested by

no test coverage detected