Skip to content

Commit 603021d

Browse files
pratikasharigcbot
authored andcommitted
Consider shader private memory when calculating scratch offset for gtpin
Scratch memory is used by IGC to store private data and by VISA to store spill/fill. gtpin may require scratch space to store temporaries. gtpin can start using scratch space only beyond what's used as private+spill/fill memory. When reporting out scratch space start offset to gtpin, we need to add private memory size and spill/fill size.
1 parent 4c3e2b1 commit 603021d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6889,9 +6889,14 @@ namespace IGC
68896889
jitInfo->stats.spillMemUsed, pFGA,
68906890
jitInfo->numBytesScratchGtpin);
68916891

6892-
pMainKernel->GetGTPinBuffer(pOutput->m_gtpinBuffer,
6893-
pOutput->m_gtpinBufferSize,
6894-
pOutput->m_scratchSpaceUsedBySpills);
6892+
unsigned int scratchUsage = 0;
6893+
if (pOutput->m_UseScratchSpacePrivateMemory &&
6894+
!pOutput->m_SeparatingSpillAndPrivateScratchMemorySpace)
6895+
scratchUsage = pOutput->m_scratchSpaceUsedByShader;
6896+
6897+
pMainKernel->GetGTPinBuffer(
6898+
pOutput->m_gtpinBuffer, pOutput->m_gtpinBufferSize,
6899+
pOutput->m_scratchSpaceUsedBySpills + scratchUsage);
68956900

68966901
createSymbolAndGlobalHostAccessTables(
68976902
hasSymbolTable, *pMainKernel, pOutput->m_scratchSpaceUsedBySpills);

0 commit comments

Comments
 (0)