Skip to content

Commit 73e70e0

Browse files
[mlir][linalg] Fix Linalg runtime verification test (#167814)
This integration test has been broken for a while. This commit partially fixes it. - Use `CHECK` + `CHECK-NEXT` to ensure that the correct error lines are matched together. - Move all `CHECK-NOT` to the end. Having a `CHECK` with the same string does not make sense after a `CHECK-NOT`. - Add a missing `CHECK: ERROR` for one of the test cases. - Deactivate `reverse_from_3`, which is broken, and put a TODO.
1 parent d4e9982 commit 73e70e0

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

mlir/test/Integration/Dialect/Linalg/CPU/runtime-verification.mlir

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@ func.func @main() {
2424
%d5x = tensor.cast %c5x : tensor<5xf32> to tensor<?xf32>
2525
%d4x = tensor.cast %c4x : tensor<4xf32> to tensor<?xf32>
2626

27-
// CHECK-NOT: ERROR: Runtime op verification failed
28-
func.call @simple_add(%d5x, %d5x) : (tensor<?xf32>, tensor<?xf32>) -> (tensor<?xf32>)
29-
3027
// CHECK: ERROR: Runtime op verification failed
31-
// CHECK: linalg.generic
32-
// CHECK: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
28+
// CHECK-NEXT: linalg.generic
29+
// CHECK-NEXT: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
3330
func.call @simple_add(%d5x, %d4x) : (tensor<?xf32>, tensor<?xf32>) -> (tensor<?xf32>)
3431

3532
// CHECK: ERROR: Runtime op verification failed
36-
// CHECK: linalg.generic
37-
// CHECK: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
33+
// CHECK-NEXT: linalg.generic
34+
// CHECK-NEXT: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
3835
func.call @simple_add(%d4x, %d5x) : (tensor<?xf32>, tensor<?xf32>) -> (tensor<?xf32>)
3936

4037
%c1x1 = arith.constant dense<0.0> : tensor<1x1xf32>
@@ -48,71 +45,81 @@ func.func @main() {
4845
%d4x5 = tensor.cast %c4x5 : tensor<4x5xf32> to tensor<?x?xf32>
4946
%d5x4 = tensor.cast %c5x4 : tensor<5x4xf32> to tensor<?x?xf32>
5047

51-
// CHECK-NOT: ERROR: Runtime op verification failed
52-
func.call @broadcast_add(%d1x1, %d1x1) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
53-
54-
// CHECK-NOT: ERROR: Runtime op verification failed
55-
func.call @broadcast_add(%d1x1, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
56-
57-
// CHECK-NOT: ERROR: Runtime op verification failed
58-
func.call @broadcast_add(%d4x4, %d1x4) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
48+
// CHECK: ERROR: Runtime op verification failed
49+
// CHECK-NEXT: linalg.generic
50+
// CHECK-NEXT: ^ dimension #1 of input/output operand #1 is incompatible with inferred dimension size
5951

6052
// CHECK: ERROR: Runtime op verification failed
61-
// CHECK: linalg.generic
62-
// CHECK: ^ dimension #1 of input/output operand #1 is incompatible with inferred dimension size
53+
// CHECK-NEXT: linalg.generic
54+
// CHECK-NEXT: ^ dimension #1 of input/output operand #2 is incompatible with inferred dimension size
6355
func.call @broadcast_add(%d1x4, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
6456

6557
// CHECK: ERROR: Runtime op verification failed
66-
// CHECK: linalg.generic
67-
// CHECK: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
58+
// CHECK-NEXT: linalg.generic
59+
// CHECK-NEXT: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
60+
6861
// CHECK: ERROR: Runtime op verification failed
69-
// CHECK: linalg.generic
70-
// CHECK: ^ dimension #1 of input/output operand #1 is incompatible with inferred dimension size
62+
// CHECK-NEXT: linalg.generic
63+
// CHECK-NEXT: ^ dimension #1 of input/output operand #1 is incompatible with inferred dimension size
64+
7165
// CHECK: ERROR: Runtime op verification failed
72-
// CHECK: linalg.generic
73-
// CHECK: ^ dimension #1 of input/output operand #2 is incompatible with inferred dimension size
66+
// CHECK-NEXT: linalg.generic
67+
// CHECK-NEXT: ^ dimension #1 of input/output operand #2 is incompatible with inferred dimension size
7468
func.call @broadcast_add(%d5x4, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
7569

76-
// CHECK-NOT: ERROR: Runtime op verification failed
77-
func.call @matmul_generic(%d5x4, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
78-
7970
// CHECK: ERROR: Runtime op verification failed
80-
// CHECK: linalg.generic
81-
// CHECK: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
71+
// CHECK-NEXT: linalg.generic
72+
// CHECK-NEXT: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
8273
func.call @matmul_generic(%d4x5, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
8374

84-
// CHECK-NOT: ERROR: Runtime op verification failed
85-
func.call @matmul_named(%d5x4, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
86-
8775
// CHECK: ERROR: Runtime op verification failed
88-
// CHECK: linalg.matmul
89-
// CHECK: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
76+
// CHECK-NEXT: linalg.matmul
77+
// CHECK-NEXT: ^ dimension #0 of input/output operand #1 is incompatible with inferred dimension size
9078
func.call @matmul_named(%d4x5, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
9179

9280
%c64x57 = arith.constant dense<0.0> : tensor<16x29xf32>
9381
%c3x4 = arith.constant dense<0.0> : tensor<3x4xf32>
9482

83+
// TODO: BROKEN CHK: ERROR: Runtime op verification failed
84+
// TODO: BROKEN CHK-NEXT: linalg.generic
85+
// TODO: BROKEN CHK-NEXT: unexpected negative result on dimension #0 of input/output operand #0
86+
// TODO: BROKEN func.call @reverse_from_3(%d5x) : (tensor<?xf32>) -> (tensor<?xf32>)
87+
88+
%c0x = arith.constant dense<1.0> : tensor<0xf32>
89+
%d0x = tensor.cast %c0x : tensor<0xf32> to tensor<?xf32>
90+
91+
%c0x5 = arith.constant dense<0.0> : tensor<0x5xf32>
92+
%d0x5 = tensor.cast %c0x5 : tensor<0x5xf32> to tensor<?x?xf32>
93+
94+
// CHECK-NOT: ERROR: Runtime op verification failed
95+
func.call @fill_empty_1d(%d0x) : (tensor<?xf32>) -> (tensor<?xf32>)
96+
97+
// CHECK-NOT: ERROR: Runtime op verification failed
98+
func.call @simple_add(%d5x, %d5x) : (tensor<?xf32>, tensor<?xf32>) -> (tensor<?xf32>)
99+
100+
// CHECK-NOT: ERROR: Runtime op verification failed
101+
func.call @fill_empty_2d(%d0x5) : (tensor<?x?xf32>) -> (tensor<?x?xf32>)
102+
95103
// CHECK-NOT: ERROR: Runtime op verification failed
96104
func.call @conv(%c64x57, %c3x4) : (tensor<16x29xf32>, tensor<3x4xf32>) -> (tensor<5x7xf32>)
97105

98106
// CHECK-NOT: ERROR: Runtime op verification failed
99107
func.call @reverse_from_3(%d4x) : (tensor<?xf32>) -> (tensor<?xf32>)
100108

101-
// CHECK: ERROR: Runtime op verification failed
102-
// CHECK: linalg.generic
103-
// CHECK: unexpected negative result on dimension #0 of input/output operand #0
104-
func.call @reverse_from_3(%d5x) : (tensor<?xf32>) -> (tensor<?xf32>)
109+
// CHECK-NOT: ERROR: Runtime op verification failed
110+
func.call @matmul_named(%d5x4, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
105111

106-
%c0x = arith.constant dense<1.0> : tensor<0xf32>
107-
%d0x = tensor.cast %c0x : tensor<0xf32> to tensor<?xf32>
108112
// CHECK-NOT: ERROR: Runtime op verification failed
109-
func.call @fill_empty_1d(%d0x) : (tensor<?xf32>) -> (tensor<?xf32>)
113+
func.call @matmul_generic(%d5x4, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
110114

111-
%c0x5 = arith.constant dense<0.0> : tensor<0x5xf32>
112-
%d0x5 = tensor.cast %c0x5 : tensor<0x5xf32> to tensor<?x?xf32>
115+
// CHECK-NOT: ERROR: Runtime op verification failed
116+
func.call @broadcast_add(%d1x1, %d1x1) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
113117

114118
// CHECK-NOT: ERROR: Runtime op verification failed
115-
func.call @fill_empty_2d(%d0x5) : (tensor<?x?xf32>) -> (tensor<?x?xf32>)
119+
func.call @broadcast_add(%d1x1, %d4x5) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
120+
121+
// CHECK-NOT: ERROR: Runtime op verification failed
122+
func.call @broadcast_add(%d4x4, %d1x4) : (tensor<?x?xf32>, tensor<?x?xf32>) -> (tensor<?x?xf32>)
116123

117124
return
118125
}

0 commit comments

Comments
 (0)