[Mlir-commits] [mlir] f30822d - [mlir][sparse][bufferization] fix a few memory leaks

Aart Bik llvmlistbot at llvm.org
Thu Jul 14 15:05:22 PDT 2022


Author: Aart Bik
Date: 2022-07-14T15:05:12-07:00
New Revision: f30822d29c8be75f6db6b4855eaa6aedea1eb777

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

LOG: [mlir][sparse][bufferization] fix a few memory leaks

Fixed some new memory leaks after migration to new
bufferization. One is expected, the other may need
some more careful analysis.

Reviewed By: jpienaar

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

Added: 
    

Modified: 
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
index 25ff5fd99d1a..19052498c86b 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
@@ -239,6 +239,13 @@ module {
     sparse_tensor.release %7 : tensor<4x4xf64, #CSR>
     sparse_tensor.release %8 : tensor<4x4xf64, #DCSR>
 
+    // TODO(springerm): needed?
+    %m0 = bufferization.to_memref %0 : memref<4x4xf64>
+    memref.dealloc %m0 : memref<4x4xf64>
+    %m3 = bufferization.to_memref %3 : memref<4x4xf64>
+    memref.dealloc %m3 : memref<4x4xf64>
+    %m6 = bufferization.to_memref %6 : memref<4x4xf64>
+    memref.dealloc %m6 : memref<4x4xf64>
     return
   }
 }

diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir
index 13b4737f1881..4ce6f1cabfba 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir
@@ -113,6 +113,7 @@ module {
     // Release resources.
     sparse_tensor.release %a : tensor<3x4xf64, #DCSR>
     sparse_tensor.release %0 : tensor<4x3xf64, #DCSR>
+    sparse_tensor.release %1 : tensor<4x3xf64, #DCSR>
 
     return
   }


        


More information about the Mlir-commits mailing list