File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -286,7 +286,10 @@ StatusPrivArr2Reg LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst*
286
286
bool useAssumeUniform = pAlloca->getMetadata (" UseAssumeUniform" ) != nullptr ;
287
287
unsigned int allocaSize = extractConstAllocaSize (pAlloca);
288
288
unsigned int allowedAllocaSizeInBytes = MAX_ALLOCA_PROMOTE_GRF_NUM * 4 ;
289
- unsigned int SIMDSize = numLanes (SIMDMode::SIMD8);
289
+ unsigned int SIMDSize = numLanes (m_ctx->platform .getMinDispatchMode ());
290
+
291
+ // consider GRF width in alloca register promotion limit
292
+ allowedAllocaSizeInBytes = allowedAllocaSizeInBytes * m_ctx->platform .getGRFSize () / 32 ;
290
293
291
294
// scale alloc size based on the number of GRFs we have
292
295
float grfRatio = m_ctx->getNumGRFPerThread () / 128 .0f ;
@@ -298,9 +301,10 @@ StatusPrivArr2Reg LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst*
298
301
SubGroupSizeMetaDataHandle subGroupSize = funcInfoMD->getSubGroupSize ();
299
302
if (subGroupSize->hasValue ())
300
303
{
301
- SIMDSize = (uint32_t )subGroupSize->getSIMD_size ();
302
- allowedAllocaSizeInBytes = (allowedAllocaSizeInBytes * 8 ) / SIMDSize;
304
+ SIMDSize = std::max ((uint32_t )subGroupSize->getSIMD_size (), SIMDSize);
303
305
}
306
+
307
+ allowedAllocaSizeInBytes = (allowedAllocaSizeInBytes * 8 ) / SIMDSize;
304
308
}
305
309
Type* baseType = nullptr ;
306
310
bool allUsesAreVector = false ;
You can’t perform that action at this time.
0 commit comments