Skip to content

Commit 98b8ff7

Browse files
sys-igcigcbot
authored andcommitted
"[Autobackout][FunctionalRegression]Revert of change: 8326cad: Allow unconstrained ranges to use RR policy even when other
variables use FF Unconstrained variables at bottom of coloring stack cannot spill and are guaranteed to get an allocation. So even when rest of the variables use first fit, we make unconstrained variables use round robin as that can ease reuse, giving more leeway to postRA scheduler and postRA spill cleanup. Note that we do this only for non sub-reg allocations only. Because sub-reg allocations are packed together so they don't necessarily even honor first fit."
1 parent 6a71ee2 commit 98b8ff7

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

visa/GraphColor.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7061,8 +7061,6 @@ void GraphColor::determineColorOrdering() {
70617061
//This will not change the order unless SPGSS is turned on
70627062
builder.getFreqInfoManager().sortBasedOnFreq(sorted);
70637063

7064-
bool isStackCall = kernel.fg.getIsStackCallFunc();
7065-
70667064
for (unsigned i = 0; i < numUnassignedVar; i++) {
70677065
LiveRange *lr = sorted[i];
70687066
unsigned availColor = numColor;
@@ -7071,12 +7069,9 @@ void GraphColor::determineColorOrdering() {
70717069
if (lr->getDegree() + lr->getNumRegNeeded() <= availColor) {
70727070
unconstrainedWorklist.push_back(lr);
70737071
lr->setActive(false);
7074-
if (!isStackCall &&
7075-
(lr->getRegKind() & G4_GRF)) {
7072+
if (lr->getRegKind() == G4_GRF) {
70767073
// Mark current lr as unconstrained, which means RR algorithm can always
7077-
// be applied to the variable. We should not apply this for stackcall
7078-
// functions because if we do RR, we may end up using GRFs from callee
7079-
// saved partition, requiring save/restore.
7074+
// be applied to the variable.
70807075
lr->setUnconstrained(true);
70817076
}
70827077
} else {
@@ -7330,7 +7325,12 @@ bool GraphColor::assignColors(ColorHeuristic colorHeuristicGRF,
73307325
}
73317326

73327327
if (kernel.getOption(vISA_GCRRInFF)) {
7333-
if (heuristic == FIRST_FIT && !lr->getIsUnconstrained()) {
7328+
if (lr->getRegKind() != G4_GRF) {
7329+
// None GRF assignment, keep single FF or RR algorithm
7330+
if (heuristic == FIRST_FIT) {
7331+
parms.setStartGRF(0);
7332+
}
7333+
} else if (heuristic == FIRST_FIT && !lr->getIsUnconstrained()) {
73347334
// GRF assignment, start GRF is always 0 if first fit algorithm is
73357335
// used and the variable is constrainted
73367336
parms.setStartGRF(0);

visa/PhyRegUsage.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,9 @@ PhyRegUsage::findGRFSubReg(const BitSet *forbidden, bool calleeSaveBias,
726726
G4_SubReg_Align subAlign, unsigned nwords) {
727727
int startReg = 0, endReg = totalGRFNum;
728728
PhyReg phyReg = {-1, -1};
729+
if (builder.getOption(vISA_GCRRInFF)) {
730+
startReg = AS.startGRFReg;
731+
}
729732

730733
if (calleeSaveBias) {
731734
startReg = builder.kernel.stackCall.calleeSaveStart();
@@ -775,7 +778,17 @@ PhyRegUsage::findGRFSubReg(const BitSet *forbidden, bool calleeSaveBias,
775778
}
776779

777780
// Find sub-GRF allocation throughout GRF file
778-
phyReg = findSubGRFAlloc(0, totalGRFNum);
781+
if (builder.getOption(vISA_GCRRInFF)) {
782+
phyReg = findSubGRFAlloc(startReg, totalGRFNum);
783+
if (phyReg.subreg == -1) {
784+
phyReg = findSubGRFAlloc(0, AS.startGRFReg);
785+
}
786+
if (phyReg.subreg != -1) {
787+
AS.startGRFReg = (phyReg.reg + 1) % totalGRFNum;
788+
}
789+
} else {
790+
phyReg = findSubGRFAlloc(0, totalGRFNum);
791+
}
779792

780793
return phyReg;
781794
}
@@ -958,14 +971,11 @@ bool PhyRegUsage::assignRegs(bool highInternalConflict, LiveRange *varBasis,
958971

959972
bool forceCalleeSaveAlloc = builder.kernel.fg.isPseudoVCEDcl(decl);
960973
unsigned short occupiedBundles = getOccupiedBundle(decl);
961-
int GRFForFF = AS.startGRFReg;
962974
bool success = findContiguousGRF(
963975
FPR.availableGregs, forbidden, occupiedBundles,
964976
getAlignToUse(align, bankAlign), decl->getNumRows(), endGRFReg,
965977
AS.startGRFReg, i, forceCalleeSaveAlloc, varBasis->getEOTSrc());
966978
if (!success && occupiedBundles) {
967-
if (colorHeuristic == FIRST_FIT && !varBasis->getIsUnconstrained())
968-
AS.startGRFReg = GRFForFF;
969979
success = findContiguousGRF(
970980
FPR.availableGregs, forbidden, 0,
971981
getAlignToUse(align, bankAlign), decl->getNumRows(), endGRFReg,

visa/include/VISAOptionsDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ DEF_VISA_OPTION(vISA_FailSafeRALimit, ET_INT32, "-failSafeRALimit", UNUSED, 3)
487487
DEF_VISA_OPTION(vISA_DenseMatrixLimit, ET_INT32, "-denseMatrixLimit", UNUSED,
488488
0x800)
489489
DEF_VISA_OPTION(vISA_FillConstOpt, ET_BOOL, "-nofillconstopt", UNUSED, true)
490-
DEF_VISA_OPTION(vISA_GCRRInFF, ET_BOOL_TRUE, "-GCRRinFF", UNUSED, true)
490+
DEF_VISA_OPTION(vISA_GCRRInFF, ET_BOOL, "-GCRRinFF", UNUSED, false)
491491
DEF_VISA_OPTION(vISA_IncrementalRA, ET_INT32, "-incrementalra",
492492
"USAGE: -incrementalra <0|1|2> where 0 is disabled, 1 is enabled, 2 is enabled with verification", 0)
493493
DEF_VISA_OPTION(vISA_SplitAlignedScalarMinDist, ET_INT32,

0 commit comments

Comments
 (0)