Skip to content

Commit 78191e6

Browse files
ViacheslavRbfda0
authored andcommitted
Fixing global offsets in retry
IGC always uses global buffer prepared in the first compilation try, therefore original global offsets must be used in retry compilations. (cherry picked from commit 0f62beb)
1 parent 9e146a0 commit 78191e6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

IGC/Compiler/CodeGenPublic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,8 @@ namespace IGC
995995
// Ignore per module fast math flag and use only per instruction fast math flags
996996
// Add few changes to CustomUnsafeOptPass related to fast flag propagation
997997
bool m_checkFastFlagPerInstructionInCustomUnsafeOptPass = false;
998+
// Map to store global offsets in original global buffer
999+
std::map<std::string, uint64_t> inlineProgramScopeGlobalOffsets;
9981000

9991001
private:
10001002
//For storing error message

IGC/Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantAnalysis.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,17 @@ bool ProgramScopeConstantAnalysis::runOnModule(Module& M)
348348
const bool changed = !inlineProgramScopeOffsets.empty();
349349
for (auto offset : inlineProgramScopeOffsets)
350350
{
351-
m_pModuleMd->inlineProgramScopeOffsets[offset.first] = static_cast<uint64_t>(offset.second);
351+
std::string globalName = offset.first->getName().str();
352+
if (Ctx->m_retryManager.IsFirstTry())
353+
{
354+
m_pModuleMd->inlineProgramScopeOffsets[offset.first] = static_cast<uint64_t>(offset.second);
355+
Ctx->inlineProgramScopeGlobalOffsets[globalName] = static_cast<uint64_t>(offset.second);
356+
}
357+
else
358+
{
359+
IGC_ASSERT_MESSAGE(Ctx->inlineProgramScopeGlobalOffsets[globalName], "No offset recorded for global during initial compilation");
360+
m_pModuleMd->inlineProgramScopeOffsets[offset.first] = Ctx->inlineProgramScopeGlobalOffsets[globalName];
361+
}
352362
}
353363

354364
// Update LLVM metadata based on IGC MetadataUtils

0 commit comments

Comments
 (0)