@@ -15835,32 +15835,25 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty)
1583515835 else if (Ty->isStructTy())
1583615836 {
1583715837 IGC_ASSERT(Dst->GetType() == ISA_TYPE_B && Src->GetType() == ISA_TYPE_B);
15838- if (Src->IsUniform() == Dst->IsUniform())
15838+ if (! Src->IsUniform() && Dst->IsUniform())
1583915839 {
15840- IGC_ASSERT(Dst->GetNumberElement() == Src->GetNumberElement());
15841- emitVectorCopy(Dst, Src, Src->GetNumberElement());
15842- }
15843- else if (Src->IsUniform() && !Dst->IsUniform())
15844- {
15845- // Copy from uniform src to non-uniform dst
15846- // We need to expand each element separately since we use the SoA (struct of arrays) layout
15847- StructType* STy = dyn_cast<StructType>(Ty);
15848- const StructLayout* SL = m_DL->getStructLayout(STy);
15849- unsigned nLanes = numLanes(m_currShader->m_dispatchSize);
15850- for (unsigned i = 0; i < STy->getNumElements(); i++)
15851- {
15852- unsigned elementOffset = (unsigned)SL->getElementOffset(i);
15853- Type* elementType = STy->getElementType(i);
15854- unsigned numElements = elementType->isVectorTy() ? elementType->getVectorNumElements() : 1;
15855- VISA_Type visaTy = m_currShader->GetType(elementType);
15856- CVariable* srcElement = m_currShader->GetNewAlias(Src, visaTy, elementOffset, numElements, true);
15857- CVariable* dstElement = m_currShader->GetNewAlias(Dst, visaTy, elementOffset * nLanes, numElements * nLanes, false);
15858- emitCopyAll(dstElement, srcElement, elementType);
15859- }
15840+ IGC_ASSERT(0 && "Does not support non-uniform to uniform struct copy");
1586015841 }
15861- else
15842+
15843+ StructType* STy = dyn_cast<StructType>(Ty);
15844+ const StructLayout* SL = m_DL->getStructLayout(STy);
15845+ unsigned srcLanes = Src->IsUniform() ? 1 : numLanes(m_currShader->m_dispatchSize);
15846+ unsigned dstLanes = Dst->IsUniform() ? 1 : numLanes(m_currShader->m_dispatchSize);
15847+ for (unsigned i = 0; i < STy->getNumElements(); i++)
1586215848 {
15863- IGC_ASSERT(0 && "Does not support non-uniform to uniform struct copy");
15849+ unsigned elementOffset = (unsigned)SL->getElementOffset(i);
15850+ Type* elementType = STy->getElementType(i);
15851+ unsigned numElements = elementType->isVectorTy() ? elementType->getVectorNumElements() : 1;
15852+ VISA_Type visaTy = m_currShader->GetType(elementType);
15853+
15854+ CVariable* srcElement = m_currShader->GetNewAlias(Src, visaTy, elementOffset * srcLanes, numElements * srcLanes, Src->IsUniform());
15855+ CVariable* dstElement = m_currShader->GetNewAlias(Dst, visaTy, elementOffset * dstLanes, numElements * dstLanes, Dst->IsUniform());
15856+ emitCopyAll(dstElement, srcElement, elementType);
1586415857 }
1586515858 }
1586615859 else
0 commit comments