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
8484 bool isUniformAlloca = WI->isUniform (&I);
8585 if (isUniformAlloca)
8686 {
87+ // add the meta-date to the alloca for promotion
8788 IRBuilder<> builder (&I);
8889 MDNode* node = MDNode::get (I.getContext (), ConstantAsMetadata::get (builder.getInt1 (true )));
8990 I.setMetadata (" uniform" , node);
@@ -98,7 +99,25 @@ namespace IGC
9899 if (pIntr->getIntrinsicID () == GenISAIntrinsic::GenISA_assume_uniform)
99100 {
100101 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+ }
101120 }
102121 }
103122 }
104- }
123+ }
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ bool LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst* pAlloca)
274274 return false ;
275275
276276 bool isUniformAlloca = pAlloca->getMetadata (" uniform" ) != nullptr ;
277+ bool useAssumeUniform = pAlloca->getMetadata (" UseAssumeUniform" ) != nullptr ;
277278 unsigned int allocaSize = extractConstAllocaSize (pAlloca);
278279 unsigned int allowedAllocaSizeInBytes = MAX_ALLOCA_PROMOTE_GRF_NUM * 4 ;
279280
@@ -315,7 +316,7 @@ bool LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst* pAlloca)
315316 allocaSize = iSTD::Round (allocaSize, SIMD_PRESSURE_MULTIPLIER) / SIMD_PRESSURE_MULTIPLIER;
316317 }
317318
318- if (allocaSize <= IGC_GET_FLAG_VALUE (ByPassAllocaSizeHeuristic))
319+ if (useAssumeUniform || allocaSize <= IGC_GET_FLAG_VALUE (ByPassAllocaSizeHeuristic))
319320 {
320321 return true ;
321322 }
You can’t perform that action at this time.
0 commit comments