Skip to content

Commit

Permalink
[mlir][sparse] fix some asan detected leaks in integration tests
Browse files Browse the repository at this point in the history
One was an oversight, but the others seem something that regressed.
Matthias to have look later.

#57663

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D133624
  • Loading branch information
aartbik committed Sep 10, 2022
1 parent 27731f0 commit 0078f72
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
Expand Up @@ -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
Expand All @@ -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
}
}
Expand Down
Expand Up @@ -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
}
}
Expand Up @@ -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
}
}
Expand Up @@ -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
}
}
Expand Up @@ -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>
Expand All @@ -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
}
}

0 comments on commit 0078f72

Please sign in to comment.