This is an archive of the discontinued LLVM Phabricator instance.

[mlir][scf] Add option to loop pipelining to not peel the epilogue
ClosedPublic

Authored by ThomasRaoux on May 31 2022, 10:47 PM.

Details

Summary

Add an option to predicate the epilogue within the kernel instead of
peeling the epilogue. This is a useful option to prevent generating
large amount of code for deep pipeline. This currently require a user
lambda to implement operation predication.

Diff Detail

Event Timeline

ThomasRaoux created this revision.May 31 2022, 10:47 PM
ThomasRaoux requested review of this revision.May 31 2022, 10:47 PM
christopherbate accepted this revision.Jun 2 2022, 1:36 PM

Thanks, just one small question below, LGTM otherwise.

mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp
151

What do you mean by this? Why would it be better?

This revision is now accepted and ready to land.Jun 2 2022, 1:36 PM
bondhugula added inline comments.
mlir/include/mlir/Dialect/SCF/Transforms.h
147

Nit: If epilogue -> If the epilogus
Comma after 'predicated'.
user -> the user
predicated version -> the predicated version

155

You don't need the PatternRewriter. The `OpBuilder is enough? That allows wider usage outside of pattern rewrites.

158

Please remove reference to the undef op -- it's completely vague/missing information as to why.

require -> requires

mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
236

This second sentence is broken. Rewrite?

266

Nit: Create

326

predicated

mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp
127

I think "skip-epilogue-peeling" isn't fully accurate. no-epilogue-peeling?

149

version of op.

152

Yes, this last line is vague. Instead, please mark a TODO if there is a future scope for improvement.

Address review comments

ThomasRaoux marked 6 inline comments as done.Jun 2 2022, 9:06 PM
ThomasRaoux added inline comments.
mlir/include/mlir/Dialect/SCF/Transforms.h
155

I want to allow user to potentially erase the operation and return a new one which requires a PatternRewriter.

158

Removed.

mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp
151

What I meant is that in general it is probably better to speculatively execute operations without side effect than adding control flow. This was just to point out how it is meant to be used but I think this is more confusing than anything else so I removed this comment.

152

Removed, this is not about future improvements just a comment on how it is expected to be used but looks like it is more confusing than helping.

This revision was landed with ongoing or failed builds.Jun 2 2022, 9:20 PM
This revision was automatically updated to reflect the committed changes.