Skip to content

Commit 9fa20a2

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: a932f9c: Make GRF selection in Pre-RA less conservative
1 parent 73b4d7b commit 9fa20a2

File tree

3 files changed

+9
-30
lines changed

3 files changed

+9
-30
lines changed

visa/G4_Kernel.cpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,8 +2118,7 @@ unsigned G4_Kernel::getSRFInWords() {
21182118

21192119
// GRF modes supported by HW
21202120
// There must be at least one Config that is VRTEnable for each platform
2121-
GRFMode::GRFMode(const TARGET_PLATFORM plat, Options *op)
2122-
: platform(plat), options(op) {
2121+
GRFMode::GRFMode(const TARGET_PLATFORM platform, Options *op) : options(op) {
21232122
switch (platform) {
21242123
case Xe_XeHPSDV:
21252124
case Xe_DG2:
@@ -2180,7 +2179,7 @@ GRFMode::GRFMode(const TARGET_PLATFORM plat, Options *op)
21802179
unsigned GRFMode::setModeByRegPressure(unsigned maxRP, unsigned largestInputReg,
21812180
bool forceGRFModeUp) {
21822181
unsigned size = configs.size(), i = 0;
2183-
bool spillAllowed = getSpillThreshold() > 0;
2182+
bool spillAllowed = options->getuInt32Option(vISA_SpillAllowed) > 256;
21842183
// find appropiate GRF based on reg pressure
21852184
for (; i < size; i++) {
21862185
if (configs[i].VRTEnable && configs[i].numGRF >= lowerBoundGRF &&
@@ -2198,22 +2197,10 @@ unsigned GRFMode::setModeByRegPressure(unsigned maxRP, unsigned largestInputReg,
21982197
currentMode = newGRFMode < maxGRFMode ? newGRFMode : maxGRFMode;
21992198
}
22002199

2201-
if (spillAllowed && currentMode > 0) {
2202-
unsigned lowerGRFNum = configs[currentMode - 1].numGRF;
2203-
// Select a lower GRF number in PreRA in case the register
2204-
// pressure computed is a bit higher (e.g. 5%) than the lower GRF
2205-
// config. If spills are detected, RA will still bump up the GRF
2206-
// number to avoid them.
2207-
// For example, if reg pressure is 167, we select 160GRF since
2208-
// we have spill threshold enabled and the diff between 167 and 160
2209-
// is less than 5%.
2210-
if ((lowerGRFNum * 1.05 >= maxRP ||
2211-
configs[currentMode].numGRF == getMaxGRF()) &&
2212-
lowerGRFNum >= (largestInputReg + 8) &&
2213-
lowerGRFNum >= lowerBoundGRF)
2214-
return configs[--currentMode].numGRF;
2215-
}
2216-
return configs[currentMode].numGRF;
2200+
if (spillAllowed && currentMode > 0)
2201+
return configs[--currentMode].numGRF;
2202+
else
2203+
return configs[currentMode].numGRF;
22172204
}
22182205
}
22192206
}
@@ -2233,8 +2220,6 @@ bool GRFMode::hasLargerGRFSameThreads() const {
22332220

22342221
// Get spill threshold for current GRF mode
22352222
unsigned GRFMode::getSpillThreshold() const {
2236-
if (platform < Xe3)
2237-
return 0;
22382223
if (configs[currentMode].numGRF == 256 &&
22392224
options->getuInt32Option(vISA_SpillAllowed256GRF) > 0)
22402225
return options->getuInt32Option(vISA_SpillAllowed256GRF);

visa/G4_Kernel.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ class GRFMode {
266266
unsigned lowerBoundGRF;
267267
unsigned upperBoundGRF;
268268
unsigned GRFModeUpValue;
269-
const TARGET_PLATFORM platform;
270269
Options *options;
271270
};
272271

visa/GraphColor.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11299,20 +11299,15 @@ GlobalRA::abortOnSpill(unsigned int GRFSpillFillCount,
1129911299

1130011300
// vISA_AbortOnSpillThreshold is defined as [0..200]
1130111301
// where 0 means abort on any spill and 200 means never abort
11302-
auto underSpillThreshold = [this](int numSpill, int asmCount,
11303-
GraphColor &coloring) {
11302+
auto underSpillThreshold = [this](int numSpill, int asmCount) {
1130411303
int threshold = std::min(
1130511304
builder.getOptions()->getuInt32Option(vISA_AbortOnSpillThreshold),
1130611305
200u);
11307-
unsigned spillSize = computeSpillSize(coloring.getSpilledLiveRanges());
11308-
11309-
return (numSpill * 200) < (threshold * asmCount) ||
11310-
spillSize < kernel.grfMode.getSpillThreshold();
11306+
return (numSpill * 200) < (threshold * asmCount);
1131111307
};
1131211308

1131311309
unsigned int instNum = instCount();
11314-
bool isUnderThreshold =
11315-
underSpillThreshold(GRFSpillFillCount, instNum, coloring);
11310+
bool isUnderThreshold = underSpillThreshold(GRFSpillFillCount, instNum);
1131611311
isUnderThreshold = builder.getFreqInfoManager().underFreqSpillThreshold(
1131711312
coloring.getSpilledLiveRanges(), instNum, GRFSpillFillCount,
1131811313
isUnderThreshold);

0 commit comments

Comments
 (0)