[mlir][sparse] generalize sparse_tensor.convert on static/dynamic dimension sizes
authorAart Bik <ajcbik@google.com>
Fri, 15 Oct 2021 23:10:30 +0000 (16:10 -0700)
committerAart Bik <ajcbik@google.com>
Mon, 18 Oct 2021 20:54:03 +0000 (13:54 -0700)
commit9d1db3d4a1970ebb88803fdd862ce1d633b46bdc
treec8feac9ffaf9c59aa12f2a57e36d7be75e50541c
parentcdf9df65f48cc7a9e6e85f10f7575d89762727aa
[mlir][sparse] generalize sparse_tensor.convert on static/dynamic dimension sizes

This revison lifts the artificial restriction on having exact matches between
source and destination type shapes. A static size may become dynamic. We still
reject changing a dynamic size into a static size to avoid the need for a
runtime "assert" on the conversion. This revision also refactors some of the
conversion code to share same-content buffers.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D111915
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
mlir/test/Dialect/SparseTensor/conversion.mlir
mlir/test/Dialect/SparseTensor/invalid.mlir
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_convert.mlir [new file with mode: 0644]