File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ namespace IGC
84
84
bool isUniformAlloca = WI->isUniform (&I);
85
85
if (isUniformAlloca)
86
86
{
87
+ // add the meta-date to the alloca for promotion
87
88
IRBuilder<> builder (&I);
88
89
MDNode* node = MDNode::get (I.getContext (), ConstantAsMetadata::get (builder.getInt1 (true )));
89
90
I.setMetadata (" uniform" , node);
@@ -98,7 +99,25 @@ namespace IGC
98
99
if (pIntr->getIntrinsicID () == GenISAIntrinsic::GenISA_assume_uniform)
99
100
{
100
101
AssumeToErase.push_back (pIntr);
102
+ // add the meta-date to the alloca for promotion
103
+ auto OpV = pIntr->getOperand (0 );
104
+ while (OpV)
105
+ {
106
+ if (auto CI = dyn_cast<CastInst>(OpV))
107
+ {
108
+ OpV = CI->getOperand (0 );
109
+ continue ;
110
+ }
111
+ if (auto ALI = dyn_cast<AllocaInst>(OpV))
112
+ {
113
+ IRBuilder<> builder (ALI);
114
+ MDNode* node = MDNode::get (ALI->getContext (),
115
+ ConstantAsMetadata::get (builder.getInt1 (true )));
116
+ ALI->setMetadata (" UseAssumeUniform" , node);
117
+ }
118
+ break ;
119
+ }
101
120
}
102
121
}
103
122
}
104
- }
123
+ }
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ bool LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst* pAlloca)
274
274
return false ;
275
275
276
276
bool isUniformAlloca = pAlloca->getMetadata (" uniform" ) != nullptr ;
277
+ bool useAssumeUniform = pAlloca->getMetadata (" UseAssumeUniform" ) != nullptr ;
277
278
unsigned int allocaSize = extractConstAllocaSize (pAlloca);
278
279
unsigned int allowedAllocaSizeInBytes = MAX_ALLOCA_PROMOTE_GRF_NUM * 4 ;
279
280
@@ -315,7 +316,7 @@ bool LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst* pAlloca)
315
316
allocaSize = iSTD::Round (allocaSize, SIMD_PRESSURE_MULTIPLIER) / SIMD_PRESSURE_MULTIPLIER;
316
317
}
317
318
318
- if (allocaSize <= IGC_GET_FLAG_VALUE (ByPassAllocaSizeHeuristic))
319
+ if (useAssumeUniform || allocaSize <= IGC_GET_FLAG_VALUE (ByPassAllocaSizeHeuristic))
319
320
{
320
321
return true ;
321
322
}
You can’t perform that action at this time.
0 commit comments