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

Function TEST_CASE

test/gpu/fuse_gemm.cpp:60–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60TEST_CASE(gemm_pointwise_add)
61{
62 migraphx::shape s{migraphx::shape::float_type, {1, 3, 3}};
63 migraphx::program p1;
64 {
65 auto* mm = p1.get_main_module();
66 auto a = mm->add_parameter("a", s);
67 auto b = mm->add_parameter("b", s);
68 auto x = mm->add_parameter("x", s);
69 auto dot = mm->add_instruction(migraphx::make_op("dot"), a, b);
70 auto add = add_pointwise(p1, "main:pointwise0", {dot, x}, single_pointwise("add"));
71 mm->add_return({add});
72 }
73 run_lowering(p1);
74 run_fuse_ops(p1);
75
76 migraphx::program p2;
77 {
78 auto* mm = p2.get_main_module();
79 auto a = mm->add_parameter("a", s);
80 auto b = mm->add_parameter("b", s);
81 auto x = mm->add_parameter("x", s);
82
83 auto output = mm->add_instruction(migraphx::op::allocate{s, std::nullopt});
84
85 if(not(migraphx::string_value_of(MIGRAPHX_SET_GEMM_PROVIDER{}) == "rocblas") and
86 migraphx::gpu::hipblaslt_supported() and not migraphx::gpu::gfx_default_rocblas())
87 {
88 migraphx::op::dot dot_instance;
89 migraphx::gpu::hipblaslt_op hipblaslt_operator;
90 hipblaslt_operator.op = migraphx::gpu::hip_gemm<migraphx::op::dot>{dot_instance, 1, 1};
91 auto add = mm->add_instruction(hipblaslt_operator, a, b, x, output);
92 mm->add_return({add});
93 }
94 else
95 {
96 auto gemm_oper =
97 migraphx::make_op("gpu::gemm",
98 {{"alpha", 1},
99 {"beta", 1},
100 {"compute_fp32", migraphx::gpu::get_compute_fp32_flag()}});
101 auto add = mm->add_instruction(gemm_oper, a, b, x, output);
102 mm->add_return({add});
103 }
104 }
105 EXPECT(p1.sort() == p2.sort());
106}
107#endif
108
109int main(int argc, const char* argv[]) { test::run(argc, argv); }

Callers

nothing calls this directly

Calls 14

add_pointwiseFunction · 0.85
single_pointwiseFunction · 0.85
run_fuse_opsFunction · 0.85
hipblaslt_supportedFunction · 0.85
gfx_default_rocblasFunction · 0.85
get_compute_fp32_flagFunction · 0.85
get_main_moduleMethod · 0.80
add_parameterMethod · 0.80
run_loweringFunction · 0.70
make_opFunction · 0.50
string_value_ofFunction · 0.50
add_instructionMethod · 0.45

Tested by

no test coverage detected