@@ -282,7 +282,7 @@ StatusPrivArr2Reg LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst *
282282
283283 allowedAllocaSizeInBytes = (allowedAllocaSizeInBytes * 8 ) / SIMDSize;
284284 }
285- SOALayoutChecker checker (*pAlloca, m_ctx->type == ShaderType::OPENCL_SHADER);
285+ SOALayoutChecker checker (*pAlloca, m_ctx->type == ShaderType::OPENCL_SHADER, true );
286286 SOALayoutInfo SOAInfo = checker.getOrGatherInfo ();
287287 if (!SOAInfo.canUseSOALayout ) {
288288 return StatusPrivArr2Reg::CannotUseSOALayout;
@@ -357,7 +357,7 @@ StatusPrivArr2Reg LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst *
357357 return StatusPrivArr2Reg::OK;
358358}
359359
360- SOALayoutChecker::SOALayoutChecker (AllocaInst &allocaToCheck, bool isOCL) : allocaRef(allocaToCheck) {
360+ SOALayoutChecker::SOALayoutChecker (AllocaInst &allocaToCheck, bool isOCL, bool mismatchedWidthsSupport ) : allocaRef(allocaToCheck), mismatchedWidthsSupport(mismatchedWidthsSupport ) {
361361 auto F = allocaToCheck.getParent ()->getParent ();
362362 pDL = &F->getParent ()->getDataLayout ();
363363 newAlgoControl = IGC_GET_FLAG_VALUE (EnablePrivMemNewSOATranspose);
@@ -571,9 +571,12 @@ bool IGC::SOALayoutChecker::MismatchDetected(Instruction &I) {
571571 return false ;
572572
573573 Type *allocaTy = allocaRef.getAllocatedType ();
574- bool allocaIsVecOrArr = allocaTy->isVectorTy () || allocaTy->isArrayTy ();
574+ bool allocaIsVecOrArrOrStruct = allocaTy->isVectorTy () || allocaTy->isArrayTy () || allocaTy-> isStructTy ();
575575
576- if (!allocaIsVecOrArr)
576+ if (!allocaIsVecOrArrOrStruct)
577+ return false ;
578+
579+ if (mismatchedWidthsSupport)
577580 return false ;
578581
579582 auto DL = I.getParent ()->getParent ()->getParent ()->getDataLayout ();
@@ -590,15 +593,26 @@ bool IGC::SOALayoutChecker::MismatchDetected(Instruction &I) {
590593 allocaTy = arrTy->getElementType ();
591594 } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(allocaTy)) {
592595 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+ }
593602 }
594603
595604 if (auto *arrTy = dyn_cast<ArrayType>(pUserTy)) {
596605 pUserTy = arrTy->getElementType ();
597606 } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(pUserTy)) {
598607 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+ }
599614 }
600615 }
601-
602616 auto allocaSize = DL.getTypeAllocSize (allocaTy);
603617 auto vecTySize = DL.getTypeAllocSize (pUserTy);
604618
0 commit comments