This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] NFC: Clean up for 0-D abstraction.
ClosedPublic

Authored by hanchung on Mar 18 2020, 11:18 PM.

Details

Summary

After D75831 has been landed, both the generic op and indexed_generic op can
handle 0-D edge case. In the previous patch, only generic op has been updated.
This patch updates the lowering to loops for indexed_generic op. Since they are
almost the sanme, the patch also refactors the common part.

Diff Detail

Event Timeline

hanchung created this revision.Mar 18 2020, 11:18 PM
mravishankar accepted this revision.Mar 18 2020, 11:43 PM

Just one suggestion since you are touching these anyways

mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
327–329

This is unrelated to the change, but you can avoid doing these loads here if the corresponding argument of the region has no uses. Would be a bonus to do this here.
I think doing that in a separate change is fine. Can you just add a todo for me here if you dont get to it

This revision is now accepted and ready to land.Mar 18 2020, 11:43 PM
rriddle added inline comments.Mar 19 2020, 12:02 AM
mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
90

Isn't this returning a reference?

95

Can you add a message to this assert?

100

This looks weird, why not just assert the back is a yield?

101

nit: Please cache the end iterator of the loop. This is the LLVM style.

hanchung updated this revision to Diff 251520.Mar 19 2020, 6:09 PM
hanchung marked 6 inline comments as done.

Address comments.

mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
90

Yes, it is. Thanks!

hanchung updated this revision to Diff 251547.Mar 19 2020, 8:31 PM

Fix build.

This revision was automatically updated to reflect the committed changes.