Skip to content

Commit bd5e98c

Browse files
lioujheyuigcbot
authored andcommitted
Restore part runtime loop unroll preference
Restore runtime loop unroll preference but still diable it at high register pressure
1 parent dfa0289 commit bd5e98c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

IGC/Compiler/GenTTI.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ void GenIntrinsicsTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
520520
(instCount + sendMessage * 4 > unrollLimitInstCount);
521521

522522
// if the loop doesn't have sample, skip the unrolling parameter change
523-
if (!sendMessage && !AllocaFound) {
523+
if (!sendMessage) {
524524
// if the estimated unrolled instruction count is larger than the unrolling threshold, limit unrolling.
525525
if (limitUnrolling) {
526526
UP.Count = MIN(unrollLimitInstCount / (instCount + sendMessage * 4), 4);
@@ -534,7 +534,7 @@ void GenIntrinsicsTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
534534

535535
// if the TripCount is known, and the estimated unrolled count exceed LoopUnrollThreshold, set the unrolling count to
536536
// 4
537-
if (limitUnrolling && !AllocaFound) {
537+
if (limitUnrolling) {
538538
UP.Count = MIN(TripCount, 4);
539539
UP.MaxCount = UP.Count;
540540
}
@@ -550,13 +550,13 @@ void GenIntrinsicsTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
550550
}
551551
}
552552

553-
/*** TESTING for removal
554-
UP.Runtime = true;
555-
UP.Count = 4;
556-
UP.MaxCount = UP.Count;
557-
// The following is only available and required from LLVM 3.7+.
558-
UP.AllowExpensiveTripCount = true;
559-
***/
553+
if (!limitUnrolling) {
554+
UP.Runtime = true;
555+
UP.Count = 4;
556+
UP.MaxCount = UP.Count;
557+
// The following is only available and required from LLVM 3.7+.
558+
UP.AllowExpensiveTripCount = true;
559+
}
560560

561561
if (MDNode *LoopID = L->getLoopID()) {
562562
const llvm::StringRef maxIterMetadataNames = "spv.loop.iterations.max";

0 commit comments

Comments
 (0)