Files
clang-p2996/mlir/test/Dialect/SparseTensor/codegen_sparse_dealloc.mlir
Yinying Li e2e429d994 [mlir][sparse] Migrate more tests to new syntax (#66309)
CSR:
`lvlTypes = [ "dense", "compressed" ]` to `map = (d0, d1) -> (d0 :
dense, d1 : compressed)`

CSC:
`lvlTypes = [ "dense", "compressed" ], dimToLvl = affine_map<(d0, d1) ->
(d1, d0)>` to `map = (d0, d1) -> (d1 : dense, d0 : compressed)`

This is an ongoing effort: #66146
2023-09-14 12:21:13 -04:00

27 lines
1.1 KiB
MLIR

// 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<{ map = (d0, d1) -> (d0 : dense, d1 : compressed)}>
#CSC = #sparse_tensor.encoding<{
map = (d0, d1) -> (d1 : dense, d0 : compressed),
}>
//
// 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>
}