Skip to content

Commit 0d2de10

Browse files
dlei6gigcbot
authored andcommitted
Stack Pointer 64-bit support for 32-bit PrivateBase
If the PrivateBase variable is 32-bits, we need to extend it to 64-bit before adding to the SP, since SP/FP are always 64-bits.
1 parent b7c0f04 commit 0d2de10

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11826,6 +11826,23 @@ void EmitPass::InitializeKernelStack(Function* pKernel)
1182611826
CVariable* pHWTID = m_currShader->GetHWTID();
1182711827
CVariable* pSize = nullptr;
1182811828

11829+
// If the private base is a 32-bit pointer, extend it to 64-bits to match SP/FP
11830+
if (pStackBufferBase->GetType() == ISA_TYPE_UD || pStackBufferBase->GetType() == ISA_TYPE_D)
11831+
{
11832+
CVariable* dst = m_currShader->GetNewVariable(1, ISA_TYPE_UQ, EALIGN_QWORD, true, 1, "PrivateBase64");
11833+
CVariable* dstAsUD = m_currShader->BitCast(dst, ISA_TYPE_UD);
11834+
m_encoder->SetDstRegion(2);
11835+
m_encoder->Copy(dstAsUD, pStackBufferBase);
11836+
m_encoder->Push();
11837+
11838+
m_encoder->SetDstSubReg(1);
11839+
m_encoder->SetDstRegion(2);
11840+
m_encoder->Copy(dstAsUD, m_currShader->ImmToVariable(0, ISA_TYPE_UD));
11841+
m_encoder->Push();
11842+
11843+
pStackBufferBase = dst;
11844+
}
11845+
1182911846
IGC_ASSERT(pModMD->FuncMD.find(pKernel) != pModMD->FuncMD.end());
1183011847
unsigned kernelAllocaSize = pModMD->FuncMD[pKernel].privateMemoryPerWI;
1183111848

0 commit comments

Comments
 (0)