[Mlir-commits] [mlir] 0078f72 - [mlir][sparse] fix some asan detected leaks in integration tests

Aart Bik llvmlistbot at llvm.org
Fri Sep 9 17:01:05 PDT 2022


Author: Aart Bik
Date: 2022-09-09T17:00:53-07:00
New Revision: 0078f7234e5e77ff08c252166f504af743480604

URL: https://github.com/llvm/llvm-project/commit/0078f7234e5e77ff08c252166f504af743480604
DIFF: https://github.com/llvm/llvm-project/commit/0078f7234e5e77ff08c252166f504af743480604.diff

LOG: [mlir][sparse] fix some asan detected leaks in integration tests

One was an oversight, but the others seem something that regressed.
Matthias to have look later.

https://github.com/llvm/llvm-project/issues/57663

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D133624

Added: 
    

Modified: 
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
index 135e26f6424c..e14a1e866221 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
@@ -32,6 +32,7 @@ module {
     %d2_0 = tensor.dim %t2, %c0 : tensor<?x?xf64, #DCSR>
     %d1_1 = tensor.dim %t1, %c1 : tensor<4x5xf64, #DCSR>
     %d2_1 = tensor.dim %t2, %c1 : tensor<?x?xf64, #DCSR>
+
     // CHECK: 4
     vector.print %d1_0 : index
     // CHECK-NEXT: 2
@@ -40,6 +41,11 @@ module {
     vector.print %d1_1 : index
     // CHECK-NEXT: 3
     vector.print %d2_1 : index
+
+    // Release resources.
+    bufferization.dealloc_tensor %t1 : tensor<4x5xf64, #DCSR>
+    bufferization.dealloc_tensor %t2 : tensor<?x?xf64, #DCSR>
+
     return
   }
 }

diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
index b1c122c4cffb..abe4ab995242 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
@@ -101,6 +101,10 @@ module {
     // Release the resources.
     bufferization.dealloc_tensor %a : tensor<?x?xi32, #SparseMatrix>
 
+    // TODO(springerm): auto release!
+    bufferization.dealloc_tensor %b : tensor<?xi32>
+    bufferization.dealloc_tensor %x : tensor<?xi32>
+
     return
   }
 }

diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
index f47bc0bedd56..b8c2bb187b74 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
@@ -124,6 +124,11 @@ module {
     // Release the resources.
     bufferization.dealloc_tensor %b : tensor<?x?x?xf64, #SparseTensor>
 
+    // TODO(springerm): auto release!
+    bufferization.dealloc_tensor %a : tensor<?x?xf64>
+    bufferization.dealloc_tensor %c : tensor<?x?xf64>
+    bufferization.dealloc_tensor %d : tensor<?x?xf64>
+
     return
   }
 }

diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
index 0a106f58cc5b..ecb551b67984 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
@@ -119,6 +119,11 @@ module {
     // Release the resources.
     bufferization.dealloc_tensor %s : tensor<?x?xf32, #SparseMatrix>
 
+    // TODO(springerm): auto release!
+    bufferization.dealloc_tensor %x : tensor<?x?xf32>
+    bufferization.dealloc_tensor %a : tensor<?x?xf32>
+    bufferization.dealloc_tensor %b : tensor<?x?xf32>
+
     return
   }
 }

diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
index 57b028422d91..9ae063e7d714 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
@@ -84,7 +84,7 @@ module {
     ^bb0(%i : index, %j : index):
       tensor.yield %i0 : f64
     } : tensor<?x?xf64>
-  
+
     // Call kernel.
     %0 = call @kernel_spmm(%a, %b, %x)
       : (tensor<?x?xf64, #SparseMatrix>, tensor<?x?xf64>, tensor<?x?xf64>) -> tensor<?x?xf64>
@@ -99,6 +99,10 @@ module {
     // Release the resources.
     bufferization.dealloc_tensor %a : tensor<?x?xf64, #SparseMatrix>
 
+    // TODO(springerm): auto release!
+    bufferization.dealloc_tensor %b : tensor<?x?xf64>
+    bufferization.dealloc_tensor %x : tensor<?x?xf64>
+
     return
   }
 }


        


More information about the Mlir-commits mailing list