This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] remove a few rewriting failures
ClosedPublic

Authored by aartbik on Nov 18 2020, 3:48 PM.

Details

Summary

Rationale:
Make sure preconditions are tested already during verfication.
Currently, the only way a sparse rewriting rule can fail is if
(1) the linalg op does not have sparse annotations, or
(2) a yet to be handled operation is encounted inside the op

Diff Detail

Event Timeline

aartbik created this revision.Nov 18 2020, 3:48 PM
aartbik requested review of this revision.Nov 18 2020, 3:48 PM
penpornk accepted this revision.Nov 18 2020, 4:16 PM
penpornk added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
837

Question please. How do you choose between return failure(); and assert()?
The old code return failure(); for op.getNumOutputs() != 1 before.

862

Do we remove this because it's already checked elsewhere?

This revision is now accepted and ready to land.Nov 18 2020, 4:16 PM
aartbik marked 2 inline comments as done.Nov 18 2020, 5:27 PM
aartbik added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
837

The return failure() denotes to the calling method that the rewriting rule has failed (did not apply), but it is not an error condition. I have replaced that with an assert since we now verify that much earlier, and we should never encounter that condition anymore

862

Yes, just like above. We verify that earlier now, so the rewriting rule always applies to something with sparse annotations that passed the verifier.

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