aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAart Bik <39774503+aartbik@users.noreply.github.com>2023-12-08 12:44:57 -0800
committerGitHub <noreply@github.com>2023-12-08 12:44:57 -0800
commit21213f39e29921c58d0ee25228b4ba5be7324602 (patch)
tree9e720eadfeeae2b9506cc10f72e3d3cfb0a3b5da
parent8f6f5ec77615e2ae137d0b1e306abbac6f7fc0e8 (diff)
downloadllvm-21213f39e29921c58d0ee25228b4ba5be7324602.zip
llvm-21213f39e29921c58d0ee25228b4ba5be7324602.tar.gz
llvm-21213f39e29921c58d0ee25228b4ba5be7324602.tar.bz2
[mlir][sparse] fix uninitialized dense tensor out in conv2d test (#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.
-rw-r--r--mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir16
1 files changed, 8 insertions, 8 deletions
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir
index 4f5ceda..41071ea 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir
@@ -55,15 +55,15 @@ module {
func.func @conv2d_CSR_dense_rotated(%arg0: tensor<8x8xi32, #CSR>,
%arg1: tensor<3x3xi32>) -> tensor<6x6xi32> {
- %s = tensor.empty() : tensor<6x6xi32>
+ %s = arith.constant dense<0> : tensor<6x6xi32>
%0 = linalg.generic {indexing_maps = [#map, #map1, #map2],
- iterator_types = ["parallel", "reduction", "reduction", "parallel"]}
- ins(%arg0, %arg1 : tensor<8x8xi32, #CSR>, tensor<3x3xi32>)
- outs(%s : tensor<6x6xi32>) attrs = {sorted = true} {
- ^bb0(%in: i32, %in_0: i32, %out: i32):
- %1 = arith.muli %in, %in_0 : i32
- %2 = arith.addi %out, %1 : i32
- linalg.yield %2 : i32
+ iterator_types = ["parallel", "reduction", "reduction", "parallel"]}
+ ins(%arg0, %arg1 : tensor<8x8xi32, #CSR>, tensor<3x3xi32>)
+ outs(%s : tensor<6x6xi32>) attrs = {sorted = true} {
+ ^bb0(%in: i32, %in_0: i32, %out: i32):
+ %1 = arith.muli %in, %in_0 : i32
+ %2 = arith.addi %out, %1 : i32
+ linalg.yield %2 : i32
} -> tensor<6x6xi32>
return %0 : tensor<6x6xi32>
}