| 58 | } |
| 59 | |
| 60 | TEST_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 | |
| 109 | int main(int argc, const char* argv[]) { test::run(argc, argv); } |
nothing calls this directly
no test coverage detected