Skip to content

Commit 5fa5b28

Browse files
bcheng0127igcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: ea2fcf4
BCR tuning BCR tuning
1 parent c0617d7 commit 5fa5b28

File tree

3 files changed

+17
-27
lines changed

3 files changed

+17
-27
lines changed

visa/GraphColor.cpp

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ void BankConflictPass::setupBankConflictsForBBTGL(G4_BB *bb,
10221022
} else {
10231023
setupBankConflictsforMad(inst);
10241024
}
1025-
} else if (gra.forceBCR && !forGlobal &&
1025+
} else if (gra.kernel.getOption(vISA_forceBCR) && !forGlobal &&
10261026
inst->getNumSrc() == 2) {
10271027
threeSourceInstNum++;
10281028
setupBankConflictsforMad(inst);
@@ -3499,7 +3499,7 @@ bool Augmentation::markNonDefaultMaskDef() {
34993499
nonDefaultMaskDefFound = true;
35003500
}
35013501

3502-
if (gra.favorBCR &&
3502+
if (kernel.getOption(vISA_forceBCR) &&
35033503
gra.getBankConflict(dcl) != BANK_CONFLICT_NONE) {
35043504
gra.setAugmentationMask(dcl, AugmentationMasks::NonDefault);
35053505
nonDefaultMaskDefFound = true;
@@ -6660,6 +6660,7 @@ bool GraphColor::assignColors(ColorHeuristic colorHeuristicGRF,
66606660

66616661
bool failed_alloc = false;
66626662
G4_Declare *dcl = lrVar->getDeclare();
6663+
66636664
if (!(noIndirForceSpills && liveAnalysis.isAddressSensitive(lr_id)) &&
66646665
forceSpill &&
66656666
(dcl->getRegFile() == G4_GRF || dcl->getRegFile() == G4_FLAG) &&
@@ -6722,7 +6723,7 @@ bool GraphColor::assignColors(ColorHeuristic colorHeuristicGRF,
67226723
// pass) then abort on spill
67236724
//
67246725
if ((heuristic == ROUND_ROBIN ||
6725-
(doBankConflict && !gra.forceBCR)) &&
6726+
(doBankConflict && !kernel.getOption(vISA_forceBCR))) &&
67266727
(lr->getRegKind() == G4_GRF || lr->getRegKind() == G4_FLAG)) {
67276728
return false;
67286729
} else if (kernel.fg.isPseudoDcl(dcl)) {
@@ -7344,7 +7345,7 @@ bool GraphColor::regAlloc(bool doBankConflictReduction,
73447345
return false;
73457346
}
73467347

7347-
if (!gra.forceBCR) {
7348+
if (!kernel.getOption(vISA_forceBCR)) {
73487349
if (!success && doBankConflictReduction) {
73497350
resetTemporaryRegisterAssignments();
73507351
assignColors(FIRST_FIT);
@@ -10112,16 +10113,6 @@ bool GlobalRA::tryHybridRA() {
1011210113
return true;
1011310114
}
1011410115

10115-
//Skip hybridRA if BCR is needed
10116-
if (favorBCR) {
10117-
lra.undoLocalRAAssignments(true);
10118-
// Restore alignment in case LRA modified it
10119-
copyAlignment();
10120-
//reset favorBCR
10121-
favorBCR = forceBCR;
10122-
return false;
10123-
}
10124-
1012510116
if (useHybridRAwithSpill) {
1012610117
insertPhyRegDecls();
1012710118
} else {
@@ -10442,14 +10433,14 @@ std::pair<bool, bool> GlobalRA::bankConflict() {
1044210433
bool doBankConflictReduction = false, highInternalConflict = false;
1044310434
if (builder.getOption(vISA_LocalBankConflictReduction) &&
1044410435
builder.hasBankCollision()) {
10445-
bool reduceBC = false;
10446-
bool threeSouceBCR = false;
10436+
bool reduceBCInRR = false;
10437+
bool reduceBCInTAandFF = false;
1044710438
BankConflictPass bc(*this, true);
1044810439

10449-
reduceBC = bc.setupBankConflictsForKernel(
10450-
true, threeSouceBCR, SECOND_HALF_BANK_START_GRF * 2,
10440+
reduceBCInRR = bc.setupBankConflictsForKernel(
10441+
true, reduceBCInTAandFF, SECOND_HALF_BANK_START_GRF * 2,
1045110442
highInternalConflict);
10452-
doBankConflictReduction = reduceBC && threeSouceBCR;
10443+
doBankConflictReduction = reduceBCInRR && reduceBCInTAandFF;
1045310444
}
1045410445
return std::make_pair(doBankConflictReduction, highInternalConflict);
1045510446
}
@@ -10780,8 +10771,11 @@ GlobalRA::insertSpillCode(bool enableSpillSpaceCompression,
1078010771

1078110772
bool GlobalRA::rerunGRAIter(bool rerunGRA)
1078210773
{
10783-
if (getIterNo() == 0 && (rerunGRA || forceBCR)) {
10784-
forceBCR = false;
10774+
if (getIterNo() == 0 && (rerunGRA || kernel.getOption(vISA_forceBCR))) {
10775+
if (kernel.getOption(vISA_forceBCR)) {
10776+
// FIXME: We shouldn't modify options. Use local bool flag instead.
10777+
kernel.getOptions()->setOption(vISA_forceBCR, false);
10778+
}
1078510779
return true;
1078610780
}
1078710781
return false;
@@ -10999,7 +10993,6 @@ int GlobalRA::coloringRegAlloc() {
1099910993
if (!fastCompile) {
1100010994
rpe.run();
1100110995
writeVerboseRPEStats(rpe);
11002-
favorBCR |= doBankConflictReduction && (rpe.getMaxRP() < kernel.getNumRegTotal() - 16);
1100310996
}
1100410997
GraphColor coloring(liveAnalysis, false, forceSpill);
1100510998

visa/GraphColor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,8 +1485,6 @@ class GlobalRA {
14851485
bool useFastRA = false;
14861486
bool useHybridRAwithSpill = false;
14871487
bool useLocalRA = false;
1488-
bool favorBCR = false;
1489-
bool forceBCR = false;
14901488
uint32_t nextSpillOffset = 0;
14911489
uint32_t scratchOffset = 0;
14921490

@@ -1920,7 +1918,7 @@ class GlobalRA {
19201918
if (kernel.getOptions()->getOption(vISA_VerifyAugmentation)) {
19211919
verifyAugmentation = std::make_unique<VerifyAugmentation>();
19221920
}
1923-
favorBCR = forceBCR = kernel.getOption(vISA_forceBCR);
1921+
19241922
// Set callWA condition.
19251923
// Call return ip and mask need wa only for non-entry functions. As call
19261924
// WA also needs a temp, we conservatively add WA for

visa/LocalRA.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ bool LocalRA::localRA() {
428428
}
429429

430430
if (!doRoundRobin) {
431-
if (gra.forceBCR && doBCR) {
431+
if (kernel.getOption(vISA_forceBCR) && doBCR) {
432432
RA_TRACE(std::cout << "\t--first-fit BCR RA\n");
433433
needGlobalRA = localRAPass(false, doSplitLLR);
434434
}
@@ -444,7 +444,6 @@ bool LocalRA::localRA() {
444444
specialAlign();
445445
needGlobalRA = localRAPass(false, doSplitLLR);
446446
}
447-
gra.favorBCR |= doBCR;
448447
}
449448

450449
if (needGlobalRA == false) {

0 commit comments

Comments
 (0)