This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Fold tensor.pad(linalg.fill) with the same value
ClosedPublic

Authored by antiagainst on Feb 7 2022, 10:11 AM.

Diff Detail

Event Timeline

antiagainst created this revision.Feb 7 2022, 10:11 AM
antiagainst requested review of this revision.Feb 7 2022, 10:11 AM
mravishankar requested changes to this revision.Feb 7 2022, 2:43 PM
mravishankar added inline comments.
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
421

THere are functions in here that do the same. Might as well use those.

479

Seems like the tensor.pad operation does not support the ReifyRankedShapedTypeOpInterface. Before move to tensor dialect, it did support the interface (when it was linalg.pad). Do you mind just adding the interface to the tensor.pad op back?

This revision now requires changes to proceed.Feb 7 2022, 2:43 PM
antiagainst marked 2 inline comments as done.

Address comments

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
421

Removed, N/A anymore.

479

Good point. I didn't know that we have such logic in the reify* interface already! It's still there but moved to an external model: https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp#L214. I changed the implementation to use that.

mravishankar accepted this revision.Feb 9 2022, 11:30 PM
This revision is now accepted and ready to land.Feb 9 2022, 11:30 PM
This revision was landed with ongoing or failed builds.Feb 10 2022, 5:39 AM
This revision was automatically updated to reflect the committed changes.