getDestinationOperands was almost a duplicate of DestinationStyleOpInterface::getOutputOperands. Now that the interface has been moved to mlir/Interfaces, it is no longer needed.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for doing this Matthias. Have a comment on the API/requirements to use the API though.
mlir/include/mlir/Dialect/Tensor/IR/Tensor.h | ||
---|---|---|
135 | I see that this methods asserts if the defining op does not implement one of two interfaces.... Maybe we can make this return an Optional<Value> of FailureOr<Value> to avoid the assert. | |
139 | This one is a bit harder to avoid the assert. One options is LogicalResult getOrCreateDestinations(OpBuilder &b, Location loc, Operation *op, SmallVectorImpl<Value> &destinationValues); Makes the two APIs incosistent, but I am thinking loud here. Having an assert though is the least desirable solution. |
Have a few more comments. With that this should be good to go.
mlir/include/mlir/Dialect/Tensor/IR/Tensor.h | ||
---|---|---|
141 | Nit: Usually return by value is at the end of the arguments list. | |
mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
382 | Do you mind moving this to the start. Basically make this an early failure before any transformations are done. Without this it can get the pattern rewrite driver into an infinite loop (triggering the fails safe of returning failure after 10 iterations or so). | |
393 | This doesnt need to be a failure I think. You can just replace lines 390 onwards to if (auto destinationPassingOp = dyn_cast<DestinationStyleOpInterface>(...)) { SmallVector<Value> destination; if (succeeded(getOrCreateDestination(...)) { updateDestinationOperandsForTiledOp(...) } } | |
577 | Replace lines 578 onwards with the same schema as line 390 onwards above. | |
581 | Replace lines 588 onwards with the same schema as line 390 onwards above. |
I see that this methods asserts if the defining op does not implement one of two interfaces.... Maybe we can make this return an Optional<Value> of FailureOr<Value> to avoid the assert.
At the very least please add the assert requirement in the comments here.