This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Generalize affine fusion to work on `Block` instead of `FuncOp`
ClosedPublic

Authored by bondhugula on Dec 4 2022, 10:21 PM.

Details

Summary

The affine fusion pass can actually work on the top-level of a Block
and doesn't require to be called on a FuncOp. Remove this restriction
and generalize the pass to work on any Block. This allows fusion to be
performed, for example, on multiple blocks of a FuncOp or any
region-holding op like an scf.while, scf.if or even at an inner depth of
an affine.for or affine.if op. This generalization has no effect on
existing functionality. No changes to the fusion logic or its
transformational power were needed.

Update fusion pass to be a generic operation pass (instead of FuncOp
pass) and remove references and assumptions on the parent being a
FuncOp.

Diff Detail

Event Timeline

bondhugula created this revision.Dec 4 2022, 10:21 PM
bondhugula requested review of this revision.Dec 4 2022, 10:21 PM

Missed adding a couple of test cases. These should be in soon.

Add missing test case.

Update escape check.

bondhugula edited reviewers, added: vinayaka-polymage; removed: sumesh13.Dec 8 2022, 10:39 AM
dcaballe accepted this revision.Dec 12 2022, 7:08 PM

Nice generalization! Thanks!

mlir/include/mlir/Dialect/Affine/Passes.td
51

too many whitespaces

This revision is now accepted and ready to land.Dec 12 2022, 7:08 PM
bondhugula marked an inline comment as done.

Fix extra whitespace in doc comments.

This revision was landed with ongoing or failed builds.Dec 14 2022, 9:27 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review, @dcaballe