Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir][sparse] add create-sparse-deallocs options to match the create…
…-deallocs in BufferizationOption. Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D147010
- Loading branch information
1 parent
1eb9948
commit c44d307
Showing
8 changed files
with
95 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
mlir/test/Dialect/SparseTensor/codegen_sparse_dealloc.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// RUN: mlir-opt %s --post-sparsification-rewrite="enable-runtime-library=false" \ | ||
// RUN: --sparse-tensor-codegen=create-sparse-deallocs=false \ | ||
// RUN: --canonicalize --cse | FileCheck %s -check-prefix=CHECK-NO-DEALLOC | ||
|
||
// RUN: mlir-opt %s --post-sparsification-rewrite="enable-runtime-library=false" \ | ||
// RUN: --sparse-tensor-codegen=create-sparse-deallocs=true \ | ||
// RUN: --canonicalize --cse | FileCheck %s -check-prefix=CHECK-DEALLOC | ||
|
||
#CSR = #sparse_tensor.encoding<{ dimLevelType = ["dense", "compressed"]}> | ||
#CSC = #sparse_tensor.encoding<{ | ||
dimLevelType = ["dense", "compressed"], | ||
dimOrdering = affine_map<(i,j) -> (j,i)> | ||
}> | ||
|
||
// | ||
// No memref.dealloc is user-requested so | ||
// CHECK-NO-DEALLOC-LABEL: @sparse_convert_permuted | ||
// CHECK-NO-DEALLOC-NOT: memref.dealloc | ||
// | ||
// Otherwise memref.dealloc is created to free temporary sparse buffers. | ||
// CHECK-DEALLOC-LABEL: @sparse_convert_permuted | ||
// CHECK-DEALLOC: memref.dealloc | ||
// | ||
func.func @sparse_convert_permuted(%arg0: tensor<?x?xf32, #CSR>) -> tensor<?x?xf32, #CSC> { | ||
%0 = sparse_tensor.convert %arg0 : tensor<?x?xf32, #CSR> to tensor<?x?xf32, #CSC> | ||
return %0 : tensor<?x?xf32, #CSC> | ||
} |