Skip to content

Commit

Permalink
[Autobackout][FuncReg]Revert of change: 502f555
Browse files Browse the repository at this point in the history
 Reland the WA that emits a NOP after branch instruction to support single stepping in debugger.

The WA is enabled only when compiling with -O0 currently.
  • Loading branch information
petechou authored and igcbot committed Oct 11, 2023
1 parent 13d376f commit df256df
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 55 deletions.
6 changes: 0 additions & 6 deletions IGC/Compiler/CISACodeGen/CISABuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5105,12 +5105,6 @@ namespace IGC
if (IGC_IS_FLAG_ENABLED(deadLoopForFloatException)) {
SaveOption(vISA_AddIEEEExceptionTrap, true);
}

// WA to support single stepping in debugger. Currently only enabled it
// when compiling with -O0.
if (isOptDisabled && m_program->m_Platform->WaAddNopAfterBranchInst()) {
SaveOption(vISA_GenerateNopAfterCFInst, true);
}
} // InitVISABuilderOptions

// Get a unqiue label for inline asm instruction blocks at the module level.
Expand Down
13 changes: 0 additions & 13 deletions IGC/Compiler/CISACodeGen/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1494,18 +1494,5 @@ unsigned int roundUpTgsmSize(DWORD size) const
return iSTD::RoundPower2(size) * blockSize;
}

bool WaAddNopAfterBranchInst() const
{
if (m_platformInfo.eProductFamily == IGFX_PVC)
return true;

if (m_platformInfo.eProductFamily == IGFX_DG2 &&
(GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID) ||
GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID)))
return true;

return false;
}

};
}//namespace IGC
1 change: 0 additions & 1 deletion visa/Optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ class Optimizer {
void applyNamedBarrierWA(INST_LIST_ITER it, G4_BB *bb);
void insertIEEEExceptionTrap();
void expandIEEEExceptionTrap(INST_LIST_ITER it, G4_BB *bb);
void insertNopAfterCFInst(BB_LIST_ITER ib, INST_LIST_ITER it);

typedef std::vector<vISA::G4_INST *> InstListType;
// create instruction sequence to calculate call offset from ip
Expand Down
33 changes: 0 additions & 33 deletions visa/SWWA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3337,36 +3337,6 @@ void Optimizer::expandIEEEExceptionTrap(INST_LIST_ITER it, G4_BB *bb) {
*it = restoreFlag;
}

void Optimizer::insertNopAfterCFInst(BB_LIST_ITER ib, INST_LIST_ITER ii) {
// If the CF inst is not the last inst of current BB, simply insert
// a nop after it. Otherwise, insert a dummy BB to hold a nop between
// the current BB and the fall-through BB.
G4_BB *bb = *ib;
G4_INST *inst = *ii;
if (inst != bb->back()) {
bb->insertAfter(ii, builder.createNop(InstOpt_NoOpt));
} else {
G4_BB *dummyBB = fg.createNewBBWithLabel("CFInstWA_BB");
dummyBB->push_back(builder.createNop(InstOpt_NoOpt));
BB_LIST_ITER nextBI = std::next(ib);
fg.insert(nextBI, dummyBB);
// Update the pred/succ edges accordingly.
bb->setPhysicalSucc(dummyBB);
dummyBB->setPhysicalPred(bb);
if (nextBI != fg.end()) {
G4_BB *nextBB = *nextBI;
dummyBB->setPhysicalSucc(nextBB);
nextBB->setPhysicalPred(dummyBB);
if (std::any_of(bb->Succs.begin(), bb->Succs.end(),
[=](G4_BB *succ) { return succ == nextBB; } )) {
fg.removePredSuccEdges(bb, nextBB);
fg.addPredSuccEdges(bb, dummyBB);
fg.addPredSuccEdges(dummyBB, nextBB);
}
}
}
}

// For a subroutine, insert a dummy move with {Switch} option immediately
// before the first non-label instruction in BB. Otherwie, for a following
// basic block, insert a dummy move before *any* instruction to ensure that
Expand Down Expand Up @@ -3797,9 +3767,6 @@ void Optimizer::HWWorkaround() {
if (inst->isIEEEExceptionTrap())
expandIEEEExceptionTrap(ii, bb);

if (inst->isCFInst() && builder.getOption(vISA_GenerateNopAfterCFInst))
insertNopAfterCFInst(ib, ii);

ii++;
}
}
Expand Down
2 changes: 0 additions & 2 deletions visa/include/VISAOptionsDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,6 @@ DEF_VISA_OPTION(vISA_noIndirectSrcForCompressedInstWA, ET_BOOL,
DEF_VISA_OPTION(vISA_GenerateDebugInfo, ET_BOOL, "-generateDebugInfo", UNUSED,
false)
DEF_VISA_OPTION(vISA_setStartBreakPoint, ET_BOOL, "-setstartbp", UNUSED, false)
DEF_VISA_OPTION(vISA_GenerateNopAfterCFInst, ET_BOOL,
"-generateNopAfterCFInst", UNUSED, false)
DEF_VISA_OPTION(vISA_InsertHashMovs, ET_BOOL, NULLSTR, UNUSED, false)
DEF_VISA_OPTION(vISA_InsertDummyMovForHWRSWA, ET_BOOL, "-insertRSDummyMov",
UNUSED, false)
Expand Down

0 comments on commit df256df

Please sign in to comment.