Allow unroll and jam loops forced by user.
LoopUnrollAndJamPass is still disabled by default in the NPM pipeline, and can be controlled by -enable-npm-unroll-and-jam.
Details
- Reviewers
hfinkel bmahjour etiotto Meinersbur dmgreen - Group Reviewers
Restricted Project - Commits
- rG1cee33e9dbb6: [LoopUnrollAndJam] Allow unroll and jam loops forced by user.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
90 ms | windows > LLVM.Other::change-printer.ll |
Event Timeline
Why is this specific to the PowerPC-backend. Doesn't the LoopUnrollAndJamPass pick-up the transformation metadata already?
When -enable-npm-unroll-and-jam is false (default), LoopUnrollAndJamPass doesn't unroll and jam any loops, no matter UP.UnrollAndJam is true or not.
When -enable-npm-unroll-and-jam is true, LoopUnrollAndJamPass try to unroll and jam all loops with UP.UnrollAndJam set to true.
When invoking LoopUnrollAndJamPass directly, LoopUnrollAndJamPass doesn't unroll and jam any loops when UP.UnrollAndJam is false, even if the loops have the unroll and jam metadata.
UP.UnrollAndJam is only set to true on ARM, or by option allow-unroll-and-jam. We want to allow unroll and jam loops on PowerPC, but only if they are forced by user for now.
I guess in my mind unroll and jam was a lot like runtime loop unrolling, which has to be enabled per target.
If there is an explicit pragma though, that does sound like it should override the targets default decision. I think the logic in tryToUnrollAndJamLoop could be updated to handle that.
A test for that would be good to see too.
Nice. I was worried this would be a bit convoluted, but it's clean like this just setting UP.UnrollAndJam.
LGTM
Thanks for the fix!
llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp | ||
---|---|---|
303–304 ↗ | (On Diff #292497) | Seems the culprit was probably this line, making the backend's decision to not unroll a higher priority than the user's. |
llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp | ||
---|---|---|
303–304 ↗ | (On Diff #292497) | I think now we get the priority right, 1. Option AllowUnrollAndJam 2. User pragma 3. backend's decision. :) |