Page MenuHomePhabricator

[MLIR] Add folder for zero trip count affine.for
ClosedPublic

Authored by bondhugula on Jul 15 2021, 8:59 PM.

Details

Summary

AffineForOp's folding hook is expected to fold away trivially empty
affine.for. This allows simplification to happen as part of the
canonicalizer and from wherever the folding hook is used. While more
complex analysis based zero trip count detection is available from other
passes in analysis and transforms, simple and inexpensive folding had
been missing.

Also, update/improve affine.for op documentation clarifying semantics of
the result values for zero trip count loops.

Diff Detail

Event Timeline

bondhugula created this revision.Jul 15 2021, 8:59 PM
bondhugula requested review of this revision.Jul 15 2021, 8:59 PM

Looks good, minor documentation nits.

mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
191–192

Nit: loop variables is used here, it would be good to stick to loop-carried varaibles (iter-args), as the same term is used elsewhere.

Nit: bethe -> be the

bondhugula marked an inline comment as done.

Typo fixes.

Minor comments.

mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
183

Replace " with `

190

surround affine.for with `

bondhugula marked 2 inline comments as done.

Address review comments.

nmostafa accepted this revision.Jul 21 2021, 7:56 AM
This revision is now accepted and ready to land.Jul 21 2021, 7:56 AM

Address comments.

This revision was landed with ongoing or failed builds.Jul 21 2021, 7:59 AM
This revision was automatically updated to reflect the committed changes.