This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add shift ops support
ClosedPublic

Authored by aartbik on Jul 14 2021, 11:25 AM.

Details

Summary

Arbitrary shifts have some complications, but shift by invariants
(viz. tensor index exp only at left hand side) can be easily
handled with the conjunctive rule.

Diff Detail

Event Timeline

aartbik created this revision.Jul 14 2021, 11:25 AM
aartbik requested review of this revision.Jul 14 2021, 11:25 AM
gussmith23 accepted this revision.Jul 15 2021, 9:16 AM

This looks good -- I have some minor comments, do with them what you will!

mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
211–214

Are c and inv in these comments referencing the same thing? An invariant? Mostly just wondering if we should use the same symbol for both.

238

Is this tested anywhere? I can't help but think the new way of storing the op symbols may lead to a bug someday (if you forget to add a symbol for a new op, for example).

This revision is now accepted and ready to land.Jul 15 2021, 9:16 AM
aartbik marked 2 inline comments as done.Jul 15 2021, 9:40 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
211–214

For divs, it is really a nonzero const, and for shifts, any invariant. Hence, this difference. I will add some asserts in a follow up CL to make sure we keep that property.

238

Agreed. I will do a follow up CL that adds a unit test + some asserts on this.

This revision was automatically updated to reflect the committed changes.
aartbik marked 2 inline comments as done.