Skip to content

Commit 81ead8a

Browse files
[mlir][Linalg] Temporarily circumvent TensorConstant bufferize bug
The TensorConstantOp bufferize conversion pattern has a bug that makes it incorrect in the case of vectors whose alignment is not the natural alignment. Circumvent it temporarily by using a power of 2. Differential Revision: https://reviews.llvm.org/D89265
1 parent 4a96b2e commit 81ead8a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mlir/integration_test/Dialect/Linalg/CPU/test-tensor-matmul.mlir

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44
// RUN: | FileCheck %s
55

66
func @main() {
7-
%A = constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> : tensor<2x3xf32>
7+
%A = constant dense<[[1.0, 2.0], [4.0, 5.0]]> : tensor<2x2xf32>
88
%B = constant dense<[[1.0, 2.0, 3.0, 4.0],
9-
[5.0, 6.0, 7.0, 8.0],
10-
[9.0, 10.0, 11.0, 12.0]]> : tensor<3x4xf32>
9+
[5.0, 6.0, 7.0, 8.0]]> : tensor<2x4xf32>
1110
%C = constant dense<1000.0> : tensor<2x4xf32>
1211

13-
%D = linalg.matmul ins(%A, %B: tensor<2x3xf32>, tensor<3x4xf32>)
12+
%D = linalg.matmul ins(%A, %B: tensor<2x2xf32>, tensor<2x4xf32>)
1413
init(%C: tensor<2x4xf32>) -> tensor<2x4xf32>
1514

1615
%unranked = tensor_cast %D : tensor<2x4xf32> to tensor<*xf32>
1716
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
1817

1918
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
2019
// CHECK-SAME: rank = 2 offset = 0 sizes = [2, 4] strides = [4, 1] data =
21-
// CHECK-NEXT: [1038, 1044, 1050, 1056]
22-
// CHECK-NEXT: [1065, 1074, 1083, 1092]
20+
// CHECK-NEXT: [1011, 1014, 1017, 1020]
21+
// CHECK-NEXT: [1029, 1038, 1047, 1056]
2322

2423
return
2524
}

0 commit comments

Comments
 (0)