@@ -282,7 +282,7 @@ StatusPrivArr2Reg LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst *
282
282
283
283
allowedAllocaSizeInBytes = (allowedAllocaSizeInBytes * 8 ) / SIMDSize;
284
284
}
285
- SOALayoutChecker checker (*pAlloca, m_ctx->type == ShaderType::OPENCL_SHADER);
285
+ SOALayoutChecker checker (*pAlloca, m_ctx->type == ShaderType::OPENCL_SHADER, true );
286
286
SOALayoutInfo SOAInfo = checker.getOrGatherInfo ();
287
287
if (!SOAInfo.canUseSOALayout ) {
288
288
return StatusPrivArr2Reg::CannotUseSOALayout;
@@ -357,7 +357,7 @@ StatusPrivArr2Reg LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst *
357
357
return StatusPrivArr2Reg::OK;
358
358
}
359
359
360
- SOALayoutChecker::SOALayoutChecker (AllocaInst &allocaToCheck, bool isOCL) : allocaRef(allocaToCheck) {
360
+ SOALayoutChecker::SOALayoutChecker (AllocaInst &allocaToCheck, bool isOCL, bool mismatchedWidthsSupport ) : allocaRef(allocaToCheck), mismatchedWidthsSupport(mismatchedWidthsSupport ) {
361
361
auto F = allocaToCheck.getParent ()->getParent ();
362
362
pDL = &F->getParent ()->getDataLayout ();
363
363
newAlgoControl = IGC_GET_FLAG_VALUE (EnablePrivMemNewSOATranspose);
@@ -571,9 +571,12 @@ bool IGC::SOALayoutChecker::MismatchDetected(Instruction &I) {
571
571
return false ;
572
572
573
573
Type *allocaTy = allocaRef.getAllocatedType ();
574
- bool allocaIsVecOrArr = allocaTy->isVectorTy () || allocaTy->isArrayTy ();
574
+ bool allocaIsVecOrArrOrStruct = allocaTy->isVectorTy () || allocaTy->isArrayTy () || allocaTy-> isStructTy ();
575
575
576
- if (!allocaIsVecOrArr)
576
+ if (!allocaIsVecOrArrOrStruct)
577
+ return false ;
578
+
579
+ if (mismatchedWidthsSupport)
577
580
return false ;
578
581
579
582
auto DL = I.getParent ()->getParent ()->getParent ()->getDataLayout ();
@@ -590,15 +593,26 @@ bool IGC::SOALayoutChecker::MismatchDetected(Instruction &I) {
590
593
allocaTy = arrTy->getElementType ();
591
594
} else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(allocaTy)) {
592
595
allocaTy = vec->getElementType ();
596
+ } else if (auto *strct = dyn_cast<StructType>(allocaTy)){
597
+ if (auto *arrTy = dyn_cast<ArrayType>(strct->getStructElementType (0 ))) {
598
+ allocaTy = arrTy->getElementType ();
599
+ } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(strct->getStructElementType (0 ))){
600
+ allocaTy = vec->getElementType ();
601
+ }
593
602
}
594
603
595
604
if (auto *arrTy = dyn_cast<ArrayType>(pUserTy)) {
596
605
pUserTy = arrTy->getElementType ();
597
606
} else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(pUserTy)) {
598
607
pUserTy = vec->getElementType ();
608
+ } else if (auto *strct = dyn_cast<StructType>(pUserTy)){
609
+ if (auto *arrTy = dyn_cast<ArrayType>(strct->getStructElementType (0 ))) {
610
+ pUserTy = arrTy->getElementType ();
611
+ } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(strct->getStructElementType (0 ))){
612
+ pUserTy = vec->getElementType ();
613
+ }
599
614
}
600
615
}
601
-
602
616
auto allocaSize = DL.getTypeAllocSize (allocaTy);
603
617
auto vecTySize = DL.getTypeAllocSize (pUserTy);
604
618
0 commit comments