This is an archive of the discontinued LLVM Phabricator instance.

[mlir][SCF] Fix loop pipelining unable to handle ops with regions
ClosedPublic

Authored by christopherbate on Sep 15 2022, 12:42 PM.

Details

Summary

This change allows the SCF LoopPipelining transform to handle ops with
nested regions within the pipelined scf.for body. The op and nested
regions are treated as a single unit from the transform's perspective.
This change also makes explicit the requirement that only ops whose
parent Block is the loop body Block are allowed to be scheduled by the
caller.

Diff Detail

Event Timeline

christopherbate requested review of this revision.Sep 15 2022, 12:42 PM

Fix formatting issues.

nicolasvasilache added inline comments.
mlir/test/Dialect/SCF/loop-pipelining.mlir
541

typo: pipeline

623

nl

This revision is now accepted and ready to land.Sep 16 2022, 12:55 AM
ThomasRaoux accepted this revision.Sep 16 2022, 8:44 AM
ThomasRaoux added inline comments.
mlir/test/Dialect/SCF/loop-pipelining.mlir
609

Can we add a value coming from above (from the loop block) in the test just to confirm that the mapping works fine.

mlir/test/Dialect/SCF/loop-pipelining.mlir
609

You're right, that broke it. I'm making some adjustments now.

Handle uses of nested values defined above in same stage / different stage.
May need some additional cleanup.

More general solution

Cleanup fix some mistakes and inefficiencies.

Fix missing doc

ThomasRaoux added inline comments.Sep 19 2022, 1:38 PM
mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
159

can those two for be unified into a clone->walk(? This would also support nested regions.

306

nit: typo: cloend

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

nit: Do we actually need to register LinalgDialect here? Linalg op is already in the IR

ThomasRaoux accepted this revision.Sep 19 2022, 2:35 PM

Looks good to me. I don't see a simpler way right now.

christopherbate marked 3 inline comments as done.

Address reviewer comments

christopherbate marked 2 inline comments as done.

Address more comments.

Address remaining comments.

christopherbate marked an inline comment as done.Sep 20 2022, 11:52 AM

Remove unused changes to RegionUtils.h