[Beignet] [PATCH] Refine custom unrolling policy.
Yang, Rong R
rong.r.yang at intel.com
Thu Mar 17 08:00:52 UTC 2016
LGTM, pushed, thanks.
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Zhigang Gong
> Sent: Friday, March 4, 2016 14:53
> To: beignet at lists.freedesktop.org
> Cc: Zhigang Gong <zhigang.gong at linux.intel.com>
> 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 <zhigang.gong at linux.intel.com>
> ---
> 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
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list