Skip to content

Commit 21213f3

Browse files
authored
[mlir][sparse] fix uninitialized dense tensor out in conv2d test (llvm#74884)
Note, tensor.empty may feed into SPARSE output (meaning it truly has no values yet), but for a DENSE output, it should always have an initial value. We ran a verifier over all our tests and this is the only remaining omission.
1 parent 8f6f5ec commit 21213f3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ module {
5555

5656
func.func @conv2d_CSR_dense_rotated(%arg0: tensor<8x8xi32, #CSR>,
5757
%arg1: tensor<3x3xi32>) -> tensor<6x6xi32> {
58-
%s = tensor.empty() : tensor<6x6xi32>
58+
%s = arith.constant dense<0> : tensor<6x6xi32>
5959
%0 = linalg.generic {indexing_maps = [#map, #map1, #map2],
60-
iterator_types = ["parallel", "reduction", "reduction", "parallel"]}
61-
ins(%arg0, %arg1 : tensor<8x8xi32, #CSR>, tensor<3x3xi32>)
62-
outs(%s : tensor<6x6xi32>) attrs = {sorted = true} {
63-
^bb0(%in: i32, %in_0: i32, %out: i32):
64-
%1 = arith.muli %in, %in_0 : i32
65-
%2 = arith.addi %out, %1 : i32
66-
linalg.yield %2 : i32
60+
iterator_types = ["parallel", "reduction", "reduction", "parallel"]}
61+
ins(%arg0, %arg1 : tensor<8x8xi32, #CSR>, tensor<3x3xi32>)
62+
outs(%s : tensor<6x6xi32>) attrs = {sorted = true} {
63+
^bb0(%in: i32, %in_0: i32, %out: i32):
64+
%1 = arith.muli %in, %in_0 : i32
65+
%2 = arith.addi %out, %1 : i32
66+
linalg.yield %2 : i32
6767
} -> tensor<6x6xi32>
6868
return %0 : tensor<6x6xi32>
6969
}

0 commit comments

Comments
 (0)