| 167 | } |
| 168 | |
| 169 | TEST_CASE(conv) |
| 170 | { |
| 171 | std::string mlir_output = R"__migraphx__( |
| 172 | module { |
| 173 | func.func @mlir_convolution(%arg0: !migraphx.shaped<2x8x3x3xf32, 72x9x3x1>, %arg1: !migraphx.shaped<1x8x4x4xf32, 128x16x4x1>) -> !migraphx.shaped<1x2x2x2xf32, 8x4x2x1> attributes ${attrs} { |
| 174 | %0 = migraphx.convolution %arg1, %arg0 {dilation = [1, 1], group = 1 : i64, padding = [0, 0, 0, 0], padding_mode = 0 : i64, stride = [1, 1]} : <1x8x4x4xf32, 128x16x4x1>, <2x8x3x3xf32, 72x9x3x1> -> <1x2x2x2xf32, 8x4x2x1> |
| 175 | return %0 : !migraphx.shaped<1x2x2x2xf32, 8x4x2x1> |
| 176 | } |
| 177 | } |
| 178 | )__migraphx__"; |
| 179 | migraphx::module m; |
| 180 | auto x = m.add_parameter("x", {migraphx::shape::float_type, {1, 8, 4, 4}}); |
| 181 | auto w = m.add_parameter("w", {migraphx::shape::float_type, {2, 8, 3, 3}}); |
| 182 | auto conv = m.add_instruction(migraphx::make_op("convolution"), x, w); |
| 183 | m.add_return({conv}); |
| 184 | auto s = migraphx::gpu::dump_mlir(m); |
| 185 | // Skip test if MLIR is not enabled |
| 186 | if(s.empty()) |
| 187 | return; |
| 188 | auto mlir_output_with_attrs = |
| 189 | migraphx::interpolate_string(mlir_output, {{"attrs", get_attrs()}}); |
| 190 | CHECK(encode(s) == encode(mlir_output_with_attrs)); |
| 191 | EXPECT(verify_mlir(m)); |
| 192 | } |
| 193 | |
| 194 | TEST_CASE(conv_nhwc) |
| 195 | { |
nothing calls this directly
no test coverage detected