This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add full dimension ordering support
ClosedPublic

Authored by aartbik on May 20 2021, 10:20 AM.

Details

Summary

This revision completes the "dimension ordering" feature
of sparse tensor types that enables the programmer to
define a preferred order on dimension access (other than
the default left-to-right order). This enables e.g. selection
of column-major over row-major storage for sparse matrices,
but generalized to any rank, as in:

dimOrdering = affine_map<(i,j,k,l,m,n,o,p) -> (p,o,j,k,i,l,m,n)>

Diff Detail

Event Timeline

aartbik created this revision.May 20 2021, 10:20 AM
aartbik requested review of this revision.May 20 2021, 10:20 AM
bixia accepted this revision.May 21 2021, 10:54 AM
bixia added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
61

Is it true that values.size() == sz? Maybe we can remove sz as a parameter here.

146–147

Would it be better if we push this into the else branch of if(enc), and add perm.resize(sz) to the if branch?

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_flatten.mlir
22

not need?

This revision is now accepted and ready to land.May 21 2021, 10:54 AM
aartbik marked 3 inline comments as done.May 21 2021, 11:53 AM

Thankx Bixia!

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

Fair point. Removed.

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_flatten.mlir
22

Yes, I added this so you could quickly test another value, but we indeed have the requirement of avoiding commented out code. Removed.

aartbik updated this revision to Diff 347091.May 21 2021, 11:55 AM
aartbik marked 2 inline comments as done.

addressed comments

This revision was automatically updated to reflect the committed changes.