Skip to content

Commit bfc0b7c

Browse files
authored
[mlir][linalg] Document ops not supported by the vectoriser (nfc) (#81500)
Adds a test to help document Linalg Ops that are currently not supported by the vectoriser (i.e. the logic to vectorise these is missing). The list is not exhaustive.
1 parent 97088b2 commit bfc0b7c

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// RUN: mlir-opt %s -transform-interpreter -split-input-file -verify-diagnostics
2+
3+
func.func @conv1d_nwc_wcf_dyn_ch_dim(%input: memref<4x6x?xf32>, %filter: memref<1x?x8xf32>, %output: memref<4x2x8xf32>) {
4+
// expected-error @+1 {{Attempted to vectorize, but failed}}
5+
linalg.conv_1d_nwc_wcf
6+
{dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>}
7+
ins(%input, %filter : memref<4x6x?xf32>, memref<1x?x8xf32>)
8+
outs(%output : memref<4x2x8xf32>)
9+
return
10+
}
11+
12+
module attributes {transform.with_named_sequence} {
13+
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
14+
%0 = transform.structured.match ops{["linalg.conv_1d_nwc_wcf"]} in %arg1 : (!transform.any_op) -> !transform.any_op
15+
transform.structured.vectorize %0 : !transform.any_op
16+
transform.yield
17+
}
18+
}
19+
20+
// -----
21+
22+
func.func @depthwise_conv1d_nwc_wc_dyn_ch_dim(%input: memref<3x5x?xf32>, %filter: memref<2x?xf32>, %output: memref<3x2x?xf32>) {
23+
// expected-error @+1 {{Attempted to vectorize, but failed}}
24+
linalg.depthwise_conv_1d_nwc_wc
25+
{dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>}
26+
ins(%input, %filter : memref<3x5x?xf32>, memref<2x?xf32>)
27+
outs(%output : memref<3x2x?xf32>)
28+
return
29+
}
30+
31+
module attributes {transform.with_named_sequence} {
32+
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
33+
%0 = transform.structured.match ops{["linalg.depthwise_conv_1d_nwc_wc"]} in %arg1 : (!transform.any_op) -> !transform.any_op
34+
transform.structured.vectorize %0 : !transform.any_op
35+
transform.yield
36+
}
37+
}
38+
39+
// -----
40+
41+
func.func @depthwise_conv1d_nwc_wc_dyn_w_dim(%input: memref<3x?x3xf32>, %filter: memref<2x3xf32>, %output: memref<3x?x3xf32>) {
42+
// expected-error @+1 {{Attempted to vectorize, but failed}}
43+
linalg.depthwise_conv_1d_nwc_wc
44+
{dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>}
45+
ins(%input, %filter : memref<3x?x3xf32>, memref<2x3xf32>)
46+
outs(%output : memref<3x?x3xf32>)
47+
return
48+
}
49+
50+
module attributes {transform.with_named_sequence} {
51+
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
52+
%0 = transform.structured.match ops{["linalg.depthwise_conv_1d_nwc_wc"]} in %arg1 : (!transform.any_op) -> !transform.any_op
53+
transform.structured.vectorize %0 : !transform.any_op
54+
transform.yield
55+
}
56+
}
57+
58+
// -----
59+
60+
func.func @conv1d_dyn_w_dim(%input: tensor<?xf32>, %filter: tensor<4xf32>, %output: tensor<?xf32>) -> tensor<?xf32> {
61+
// expected-error @+1 {{Attempted to vectorize, but failed}}
62+
%0 = linalg.conv_1d ins(%input, %filter : tensor<?xf32>, tensor<4xf32>)
63+
outs(%output : tensor<?xf32>) -> tensor<?xf32>
64+
return %0 : tensor<?xf32>
65+
}
66+
67+
module attributes {transform.with_named_sequence} {
68+
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
69+
%0 = transform.structured.match ops{["linalg.conv_1d"]} in %arg1 : (!transform.any_op) -> !transform.any_op
70+
transform.structured.vectorize %0 : !transform.any_op
71+
transform.yield
72+
}
73+
}

0 commit comments

Comments
 (0)