[Mlir-commits] [mlir] 4b28638 - Fix multiple memory leaks in mlir-cpu-runner tests (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Sat Oct 2 16:16:59 PDT 2021
Author: Mehdi Amini
Date: 2021-10-02T23:16:35Z
New Revision: 4b28638bcc7a2134bc16a65ceefb262285fb7210
URL: https://github.com/llvm/llvm-project/commit/4b28638bcc7a2134bc16a65ceefb262285fb7210
DIFF: https://github.com/llvm/llvm-project/commit/4b28638bcc7a2134bc16a65ceefb262285fb7210.diff
LOG: Fix multiple memory leaks in mlir-cpu-runner tests (NFC)
Added:
Modified:
mlir/test/mlir-cpu-runner/copy.mlir
mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
mlir/test/mlir-cpu-runner/memref_reshape.mlir
mlir/test/mlir-cpu-runner/unranked_memref.mlir
Removed:
################################################################################
diff --git a/mlir/test/mlir-cpu-runner/copy.mlir b/mlir/test/mlir-cpu-runner/copy.mlir
index 9a1b93b7cbf6..95ba8abc32db 100644
--- a/mlir/test/mlir-cpu-runner/copy.mlir
+++ b/mlir/test/mlir-cpu-runner/copy.mlir
@@ -49,6 +49,10 @@ func @main() -> () {
%copy_empty = memref.alloc() : memref<3x0x1xf32>
// Copying an empty shape should do nothing (and should not crash).
memref.copy %input_empty, %copy_empty : memref<3x0x1xf32> to memref<3x0x1xf32>
-
+ memref.dealloc %copy_empty : memref<3x0x1xf32>
+ memref.dealloc %input_empty : memref<3x0x1xf32>
+ memref.dealloc %copy_two : memref<3x2xf32>
+ memref.dealloc %copy : memref<2x3xf32>
+ memref.dealloc %input : memref<2x3xf32>
return
}
diff --git a/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir b/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
index 813fd03d19f3..e10d39ed1e64 100644
--- a/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
+++ b/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
@@ -31,6 +31,7 @@ func @main() -> () {
call @cast_ranked_memref_to_dynamic_shape(%input) : (memref<2x3xf32>) -> ()
call @cast_unranked_memref_to_static_shape(%input) : (memref<2x3xf32>) -> ()
call @cast_unranked_memref_to_dynamic_shape(%input) : (memref<2x3xf32>) -> ()
+ memref.dealloc %input : memref<2x3xf32>
return
}
diff --git a/mlir/test/mlir-cpu-runner/memref_reshape.mlir b/mlir/test/mlir-cpu-runner/memref_reshape.mlir
index 8f3cee05ece0..b3b151f893c5 100644
--- a/mlir/test/mlir-cpu-runner/memref_reshape.mlir
+++ b/mlir/test/mlir-cpu-runner/memref_reshape.mlir
@@ -43,6 +43,8 @@ func @main() -> () {
: (memref<2x3xf32>, memref<2xindex>) -> ()
call @reshape_unranked_memref_to_unranked(%input, %shape)
: (memref<2x3xf32>, memref<2xindex>) -> ()
+ memref.dealloc %input : memref<2x3xf32>
+ memref.dealloc %shape : memref<2xindex>
return
}
diff --git a/mlir/test/mlir-cpu-runner/unranked_memref.mlir b/mlir/test/mlir-cpu-runner/unranked_memref.mlir
index 0bec84d0d979..5852df6adc2e 100644
--- a/mlir/test/mlir-cpu-runner/unranked_memref.mlir
+++ b/mlir/test/mlir-cpu-runner/unranked_memref.mlir
@@ -69,6 +69,7 @@ func @main() -> () {
%U4 = memref.cast %I8 : memref<i8> to memref<*xi8>
call @print_memref_i8(%U4) : (memref<*xi8>) -> ()
+ memref.dealloc %U4 : memref<*xi8>
memref.dealloc %A : memref<10x3xf32, 0>
call @return_var_memref_caller() : () -> ()
@@ -113,7 +114,7 @@ func private @printU64(index) -> ()
func private @printNewline() -> ()
func @dim_op_of_unranked() {
- %ranked = memref.alloc() : memref<4x3xf32>
+ %ranked = memref.alloca() : memref<4x3xf32>
%unranked = memref.cast %ranked: memref<4x3xf32> to memref<*xf32>
%c0 = constant 0 : index
More information about the Mlir-commits
mailing list