[mlir][sparse] use shared util for DimOp generation
authorAart Bik <ajcbik@google.com>
Wed, 18 Aug 2021 17:39:14 +0000 (10:39 -0700)
committerAart Bik <ajcbik@google.com>
Thu, 19 Aug 2021 00:12:32 +0000 (17:12 -0700)
commitd37d72eaf87e386a885d9ce968ecdebebcd9757f
tree7f0955fd5378d9eb2054132fb0344a3299c7a7f3
parentc480792b6ad242d2fae41bf6a850974eb60ff6c4
[mlir][sparse] use shared util for DimOp generation

This shares more code with existing utilities. Also, to be consistent,
we moved dimension permutation on the DimOp to the tensor lowering phase.
This way, both pre-existing DimOps on sparse tensors (not likely but
possible) as well as compiler generated DimOps are handled consistently.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D108309
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
mlir/test/Dialect/SparseTensor/conversion.mlir
mlir/test/Dialect/SparseTensor/sparse_perm_lower.mlir [new file with mode: 0644]