This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] generalize sparse_tensor.convert on static/dynamic dimension sizes
ClosedPublic

Authored by aartbik on Oct 15 2021, 5:05 PM.

Details

Summary

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.

Diff Detail

Event Timeline

aartbik created this revision.Oct 15 2021, 5:05 PM
aartbik requested review of this revision.Oct 15 2021, 5:05 PM
aartbik updated this revision to Diff 380126.Oct 15 2021, 5:55 PM

fixed typo in example

bixia accepted this revision.Oct 18 2021, 10:33 AM
bixia added inline comments.
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
244

Shall we add "or 10 vs. ?" ?

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
197

Can we add "for unknown dimension values in type"?

232

No need for this /?

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_convert.mlir
26

s/change/shape/?

This revision is now accepted and ready to land.Oct 18 2021, 10:33 AM
aartbik updated this revision to Diff 380487.Oct 18 2021, 11:36 AM
aartbik marked 3 inline comments as done.

addressed comments

aartbik updated this revision to Diff 380507.Oct 18 2021, 1:16 PM

rebased with main