Skip to content

Commit 167795e

Browse files
ViacheslavRbpszymich
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 3b4050a commit 167795e

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
@@ -994,6 +994,8 @@ namespace IGC
994994
// Ignore per module fast math flag and use only per instruction fast math flags
995995
// Add few changes to CustomUnsafeOptPass related to fast flag propagation
996996
bool m_checkFastFlagPerInstructionInCustomUnsafeOptPass = false;
997+
// Map to store global offsets in original global buffer
998+
std::map<std::string, uint64_t> inlineProgramScopeGlobalOffsets;
997999

9981000
private:
9991001
//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)