Skip to content

Commit 36cd3f0

Browse files
lioujheyuigcbot
authored andcommitted
Enable Loop unrolling protmotion for Alloc for some
platforms Enable Loop unrolling protmotion for Alloc after platforms
1 parent ea58eb2 commit 36cd3f0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

IGC/Compiler/GenTTI.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ 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 ) {
321+
if (MaxTripCount && MaxTripCount <= UnrollMaxCountForAlloca &&
322+
IGC_IS_FLAG_ENABLED(EnablePromoteLoopUnrollwithAlloca)) {
322323
unsigned int ThresholdBoost = 0;
323324
for (auto BB : L->blocks()) {
324325
for (auto &I : *BB) {
@@ -362,8 +363,8 @@ void GenIntrinsicsTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
362363
UP.UpperBound = true;
363364
UP.Force = UnrollLoopForCodeSizeOnly ? false : true;
364365

365-
if (IGC_IS_FLAG_ENABLED(EnablePromoteLoopUnrollwithAlloca) &&
366-
ctx->type != ShaderType::OPENCL_SHADER) {
366+
if (ctx->type != ShaderType::OPENCL_SHADER &&
367+
ctx->platform.GetProductFamily() >= IGFX_BMG) {
367368
UP.Threshold += ThresholdBoost;
368369
LLVM_DEBUG(dbgs() << "Increasing L:" << L->getName() << " threshold to " << UP.Threshold
369370
<< " due to Alloca accessed by:");

IGC/common/igc_flags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ DECLARE_IGC_REGKEY(DWORD, SetLoopUnrollMaxPercentThresholdBoostForHighRegPressur
449449
"The LLVM internal value is 400.",
450450
false)
451451
DECLARE_IGC_REGKEY(
452-
bool, EnablePromoteLoopUnrollwithAlloca, false,
452+
bool, EnablePromoteLoopUnrollwithAlloca, true,
453453
"Loop cost estimation assumes Load/Store who accesses Alloca with index deductible to loop count having 0 cost. "
454454
"Disable this flag makes them always cost something as well as disables dynamic threshold increase based on the "
455455
"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)