This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Handle null attributes on TiledLoopOp creation.
AbandonedPublic

Authored by tpopp on Aug 23 2021, 8:51 AM.

Details

Summary

This is to simplify creating TiledLoops without having conditional code
at every call site to see if a previous TiledLoop had the attribute set
or not.

Diff Detail

Event Timeline

tpopp created this revision.Aug 23 2021, 8:51 AM
tpopp requested review of this revision.Aug 23 2021, 8:51 AM
frgossen added inline comments.
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
1763

Is this a check for a nullptr? This seems dangerous, especially when distributionTypes is optional, I would expect this to not happen.

tpopp added inline comments.Aug 24 2021, 6:00 AM
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
1763

Yes, this is because of the fact that TiledLoopOpAdaptor returns a null attribute when there are no distributionTypes, while TiledLoopOp returns llvm::none. This is bad, so I'm trying to handle that case until I see how much work fixing this Adaptor vs Op inconsistency will be (as that will affect all code rather than being localized). The alternative is handling all call sites that currently exist, but that's more work/uglier and would only be temporary.

frgossen accepted this revision.Aug 25 2021, 12:56 AM
frgossen added inline comments.
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
1763

In that case, maybe add a comment/TODO here that this is only temporary and when it will disappear?
It would also be good to explain this in the change description.

This revision is now accepted and ready to land.Aug 25 2021, 12:56 AM
tpopp abandoned this revision.Aug 25 2021, 7:34 AM

I've been somewhat convinced that this could lead to subtle bugs in the future, so we should leave it to the callers to handle this issue each time they want to build this op during dialect conversion, so I'm going to abandon this.