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

Function TEST_CASE

test/optimize_module_test.cpp:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42TEST_CASE(broadcast_transpose_inner_broadcast)
43{
44 // first optimizes broadcast+transpose to just a broadcast,
45 // then finds inner broadcast to become mul+broadcast
46 migraphx::module m1;
47 {
48 auto x = m1.add_parameter("x", {migraphx::shape::float_type, {1}, {0}});
49 auto y = m1.add_parameter("y", {migraphx::shape::float_type, {1}, {0}});
50 auto mb1 =
51 m1.add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {2, 2, 3}}}), x);
52 auto mb2 =
53 m1.add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {2, 3, 2}}}), y);
54 auto t1 =
55 m1.add_instruction(migraphx::make_op("transpose", {{"permutation", {0, 2, 1}}}), mb1);
56 auto mul = m1.add_instruction(migraphx::make_op("mul"), mb2, t1);
57 m1.add_return({mul});
58 }
59 run_pass(m1);
60 migraphx::module m2;
61 {
62 auto x = m2.add_parameter("x", {migraphx::shape::float_type, {1}, {0}});
63 auto y = m2.add_parameter("y", {migraphx::shape::float_type, {1}, {0}});
64 auto mul = m2.add_instruction(migraphx::make_op("mul"), y, x);
65 auto mb =
66 m2.add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {2, 3, 2}}}), mul);
67 m2.add_return({mb});
68 }
69 EXPECT(m1 == m2);
70}
71
72TEST_CASE(broadcast_transpose_inner_broadcast_generic)
73{

Callers

nothing calls this directly

Calls 12

generate_literalFunction · 0.85
add_parameterMethod · 0.80
run_passFunction · 0.70
make_opFunction · 0.50
literalClass · 0.50
add_instructionMethod · 0.45
add_returnMethod · 0.45
add_literalMethod · 0.45
evalMethod · 0.45
get_shapeMethod · 0.45
dataMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected