Skip to content

Commit b743469

Browse files
houjenkoigcbot
authored andcommitted
Enable vISA LTO by default
Enable vISA LTO by default
1 parent 8873b97 commit b743469

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

IGC/common/igc_flags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SPDX-License-Identifier: MIT
1212
// releaseMode - The value is responsible for the availability of the flag in the Linux release
1313

1414
DECLARE_IGC_GROUP("VISA optimization")
15-
DECLARE_IGC_REGKEY(DWORD, VISALTO, 0, "vISA LTO optimization flags. check LINKER_TYPE for more details", false)
15+
DECLARE_IGC_REGKEY(DWORD, VISALTO, 0x3F, "vISA LTO optimization flags. check LINKER_TYPE for more details", false)
1616
DECLARE_IGC_REGKEY(bool, DisableSendS, false, "Setting this to 1/true adds a compiler switch to not generate sends commands, default is to enable sends ", false)
1717
DECLARE_IGC_REGKEY(bool, ForcePreserveR0, false, "Setting this to true makes VISA preserve r0 in r0", true)
1818
DECLARE_IGC_REGKEY(bool, EnablePreemption, true, "Enable generating preeemptable code (SKL+)", false)

visa/BuildCISAIRImpl.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,13 @@ void CISA_IR_Builder::ResetHasStackCall(
513513
for (auto &it : callsites) {
514514
G4_INST *fcall = *it;
515515
vASSERT(fcall->opcode() == G4_pseudo_fcall);
516-
bool isInSgInvokeList =
517-
std::find(sgInvokeList.begin(), sgInvokeList.end(), it) !=
518-
sgInvokeList.end();
516+
bool isInSgInvokeList = false;
517+
for (auto &it2 : sgInvokeList) {
518+
G4_INST *inst = *it2;
519+
if (inst == fcall) {
520+
isInSgInvokeList = true;
521+
}
522+
}
519523
if (!isInSgInvokeList) {
520524
hasStackCall = true;
521525
break;
@@ -1164,6 +1168,15 @@ void CISA_IR_Builder::LinkTimeOptimization(
11641168
inst = fret->cloneInst(builder);
11651169
}
11661170

1171+
// restore fcall info for indirect calls
1172+
if (inst->opcode() == G4_pseudo_fcall) {
1173+
auto orig_fcallinfo = callee->fg.builder->getFcallInfo(fret);
1174+
if (orig_fcallinfo) {
1175+
builder->addFcallInfo(inst, orig_fcallinfo->getArgSize(),
1176+
orig_fcallinfo->getRetSize());
1177+
}
1178+
}
1179+
11671180
// Based on vISA's assumption, after visiting fret in callee,
11681181
// it is entering subroutines' instructions (callee #7-#9 below)
11691182
// inside the callee.
@@ -1243,6 +1256,14 @@ void CISA_IR_Builder::LinkTimeOptimization(
12431256
visited.insert(callee);
12441257
for (G4_INST *fret : calleeInsts) {
12451258
G4_INST *inst = fret->cloneInst(caller->fg.builder);
1259+
// restore fcall info for indirect calls
1260+
if (inst->opcode() == G4_pseudo_fcall) {
1261+
auto orig_fcallinfo = callee->fg.builder->getFcallInfo(fret);
1262+
if (orig_fcallinfo) {
1263+
caller->fg.builder->addFcallInfo(inst, orig_fcallinfo->getArgSize(),
1264+
orig_fcallinfo->getRetSize());
1265+
}
1266+
}
12461267
for (int i = 0, numSrc = inst->getNumSrc(); i < numSrc; ++i) {
12471268
cloneDcl(inst->getSrc(i));
12481269
}
@@ -1611,18 +1632,14 @@ int CISA_IR_Builder::Compile(const char *nameInput, std::ostream *os,
16111632

16121633
if (m_options.getuInt32Option(vISA_Linker) & (1U << Linker_Subroutine)) {
16131634
std::map<std::string, G4_Kernel *> functionsNameMap;
1614-
G4_Kernel *mainFunc = m_kernelsAndFunctions.front()->getKernel();
16151635
vISA_ASSERT(m_kernelsAndFunctions.front()->getIsKernel(),
1616-
"mainFunc must be the kernel entry");
1636+
"the first function must be the kernel entry");
16171637
std::unordered_map<G4_Kernel *, std::list<std::list<G4_INST *>::iterator>>
16181638
callSites;
16191639
std::list<std::list<G4_INST *>::iterator> sgInvokeList;
16201640
CollectCallSites(m_kernelsAndFunctions, callSites, sgInvokeList);
16211641

16221642
if (sgInvokeList.size()) {
1623-
vASSERT(callSites.begin()->first == mainFunc);
1624-
CheckHazardFeatures(sgInvokeList, callSites);
1625-
16261643
ResetHasStackCall(sgInvokeList, callSites);
16271644

16281645
RemoveOptimizingFunction(sgInvokeList);

0 commit comments

Comments
 (0)