LGTM, pushed, thanks.
> -----Original Message----- > From: Beignet [mailto:[email protected]] On Behalf Of > Zhigang Gong > Sent: Friday, March 4, 2016 14:53 > To: [email protected] > Cc: Zhigang Gong <[email protected]> > Subject: [Beignet] [PATCH] Refine custom unrolling policy. > > We should use the production of current trip count and parent trip count to > determine whether we should unroll the parent loop. > > Signed-off-by: Zhigang Gong <[email protected]> > --- > backend/src/llvm/llvm_unroll.cpp | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) > > diff --git a/backend/src/llvm/llvm_unroll.cpp > b/backend/src/llvm/llvm_unroll.cpp > index 0f62bdc..a289c11 100644 > --- a/backend/src/llvm/llvm_unroll.cpp > +++ b/backend/src/llvm/llvm_unroll.cpp > @@ -176,6 +176,12 @@ namespace gbe { > if (ExitBlock) > currTripCount = SE->getSmallConstantTripCount(L, ExitBlock); > > + if (currTripCount > 32) { > + shouldUnroll = false; > + setUnrollID(currL, false); > + return shouldUnroll; > + } > + > while(currL) { > Loop *parentL = currL->getParentLoop(); > unsigned parentTripCount = 0; @@ -187,20 +193,17 @@ namespace > gbe { > if (parentExitBlock) > parentTripCount = SE->getSmallConstantTripCount(parentL, > parentExitBlock); > } > - if ((parentTripCount != 0 && currTripCount / parentTripCount > 16) > || > - (currTripCount > 32)) { > - if (currL == L) > - shouldUnroll = false; > - setUnrollID(currL, false); > - if (currL != L) > + if (parentTripCount != 0 && currTripCount * parentTripCount > 32) { > + setUnrollID(parentL, false); > #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8 > - loopInfo.markAsRemoved(currL); > + loopInfo.markAsRemoved(parentL); > #else > - LPM.deleteLoopFromQueue(currL); > + LPM.deleteLoopFromQueue(parentL); > #endif > + return shouldUnroll; > } > currL = parentL; > - currTripCount = parentTripCount; > + currTripCount = parentTripCount * currTripCount; > } > return shouldUnroll; > } > -- > 2.1.4 > > _______________________________________________ > Beignet mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/beignet
