Skip to content

Commit 7ad819c

Browse files
lioujheyuigcbot
authored andcommitted
Disable Loop unrolling protmotion for Alloc
Disable Loop unrolling protmotion for Alloc
1 parent ff9e975 commit 7ad819c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

IGC/Compiler/GenTTI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ void GenIntrinsicsTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
318318
// It can potentially do some global cost estimations.
319319
const unsigned UnrollMaxCountForAlloca = IGC_GET_FLAG_VALUE(PromoteLoopUnrollwithAllocaCountThreshold);
320320
bool AllocaFound = false;
321-
if (MaxTripCount && MaxTripCount <= UnrollMaxCountForAlloca &&
322-
IGC_IS_FLAG_ENABLED(EnablePromoteLoopUnrollwithAlloca)) {
321+
if (MaxTripCount && MaxTripCount <= UnrollMaxCountForAlloca ) {
323322
unsigned int ThresholdBoost = 0;
324323
for (auto BB : L->blocks()) {
325324
for (auto &I : *BB) {
@@ -363,7 +362,8 @@ void GenIntrinsicsTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
363362
UP.UpperBound = true;
364363
UP.Force = UnrollLoopForCodeSizeOnly ? false : true;
365364

366-
if (ctx->type != ShaderType::OPENCL_SHADER) {
365+
if (IGC_IS_FLAG_ENABLED(EnablePromoteLoopUnrollwithAlloca) &&
366+
ctx->type != ShaderType::OPENCL_SHADER) {
367367
UP.Threshold += ThresholdBoost;
368368
LLVM_DEBUG(dbgs() << "Increasing L:" << L->getName() << " threshold to " << UP.Threshold
369369
<< " due to Alloca accessed by:");

IGC/common/igc_flags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ DECLARE_IGC_REGKEY(DWORD, SetLoopUnrollMaxPercentThresholdBoostForHighRegPressur
447447
"The LLVM internal value is 400.",
448448
false)
449449
DECLARE_IGC_REGKEY(
450-
bool, EnablePromoteLoopUnrollwithAlloca, true,
450+
bool, EnablePromoteLoopUnrollwithAlloca, false,
451451
"Loop cost estimation assumes Load/Store who accesses Alloca with index deductible to loop count having 0 cost. "
452452
"Disable this flag makes them always cost something as well as disables dynamic threshold increase based on the "
453453
"size of alloca and number of GEP to the alloca in the loop, leading to the loop less likely to be unrolled.",

0 commit comments

Comments
 (0)