Skip to content

Commit aab3aac

Browse files
aratajewpszymich
authored andcommitted
Allocate private memory on the stack for indirect group
If a subroutine is called by indirectly-called function, then it doesn't have an access to `privateBase` implicit argument. The change introduces treating indirect groups as groups with stackcalls in terms of handling private memeory, meaning that `privateBase` implicit argument is no required, since private memory is allocated on the stack.
1 parent d48f6e1 commit aab3aac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ bool PrivateMemoryResolution::runOnModule(llvm::Module& M)
158158
}
159159
bool hasStackCall = (FGA && FGA->getGroup(m_currFunction) && FGA->getGroup(m_currFunction)->hasStackCall()) || m_currFunction->hasFnAttribute("visaStackCall");
160160
bool hasVLA = (FGA && FGA->getGroup(m_currFunction) && FGA->getGroup(m_currFunction)->hasVariableLengthAlloca()) || m_currFunction->hasFnAttribute("hasVLA");
161+
bool isIndirectGroup = FGA && FGA->getGroup(m_currFunction) && isIntelSymbolTableVoidProgram(FGA->getGroupHead(m_currFunction));
161162
if (Ctx.platform.hasScratchSurface() &&
162163
modMD.compOpt.UseScratchSpacePrivateMemory)
163164
{
@@ -175,7 +176,7 @@ bool PrivateMemoryResolution::runOnModule(llvm::Module& M)
175176
#endif
176177
}
177178
// Resolve collected alloca instructions for current function
178-
changed |= resolveAllocaInstructions(hasStackCall || hasVLA);
179+
changed |= resolveAllocaInstructions(hasStackCall || hasVLA || isIndirectGroup);
179180

180181
// Initialize the stack mem usage per function group to the kernel's privateMemPerWI
181182
if (isEntryFunc(m_pMdUtils, m_currFunction))

0 commit comments

Comments
 (0)