Skip to content

Commit 18a4200

Browse files
jfuentesigcbot
authored andcommitted
Changes in code.
1 parent 4e160b3 commit 18a4200

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

visa/GraphColor.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11302,31 +11302,31 @@ bool GlobalRA::convertToFailSafe(bool reserveSpillReg, GraphColor &coloring,
1130211302
return reserveSpillReg;
1130311303
}
1130411304

11305-
std::pair<bool, unsigned int>
11306-
GlobalRA::abortOnSpill(unsigned int GRFSpillFillCount,
11307-
GraphColor &coloring) {
11305+
std::tuple<bool, unsigned int, unsigned int>
11306+
GlobalRA::abortOnSpill(unsigned int GRFSpillFillCount, unsigned int spillSize,
11307+
GraphColor &coloring) {
1130811308
// Calculate the spill caused by send to decide if global splitting is
1130911309
// required or not
1131011310
for (auto spilled : coloring.getSpilledLiveRanges()) {
1131111311
GRFSpillFillCount += spilled->getRefCount();
1131211312
}
1131311313

11314+
spillSize += computeSpillSize(coloring.getSpilledLiveRanges());
11315+
1131411316
// vISA_AbortOnSpillThreshold is defined as [0..200]
1131511317
// where 0 means abort on any spill and 200 means never abort
11316-
auto underSpillThreshold = [this](int numSpill, int asmCount,
11317-
GraphColor &coloring) {
11318+
auto underSpillThreshold = [this](int numSpill, unsigned spillSize,
11319+
int asmCount, GraphColor &coloring) {
1131811320
int threshold = std::min(
1131911321
builder.getOptions()->getuInt32Option(vISA_AbortOnSpillThreshold),
1132011322
200u);
11321-
unsigned spillSize = computeSpillSize(coloring.getSpilledLiveRanges());
11322-
1132311323
return (numSpill * 200) < (threshold * asmCount) ||
1132411324
spillSize < kernel.grfMode.getSpillThreshold();
1132511325
};
1132611326

1132711327
unsigned int instNum = instCount();
1132811328
bool isUnderThreshold =
11329-
underSpillThreshold(GRFSpillFillCount, instNum, coloring);
11329+
underSpillThreshold(GRFSpillFillCount, spillSize, instNum, coloring);
1133011330
isUnderThreshold = builder.getFreqInfoManager().underFreqSpillThreshold(
1133111331
coloring.getSpilledLiveRanges(), instNum, GRFSpillFillCount,
1133211332
isUnderThreshold);
@@ -11345,9 +11345,9 @@ GlobalRA::abortOnSpill(unsigned int GRFSpillFillCount,
1134511345
jitInfo->stats.numGRFSpillFillWeighted = GRFSpillFillCount;
1134611346
}
1134711347

11348-
return std::make_pair(true, GRFSpillFillCount);
11348+
return std::make_tuple(true, GRFSpillFillCount, spillSize);
1134911349
}
11350-
return std::make_pair(false, GRFSpillFillCount);
11350+
return std::make_tuple(false, GRFSpillFillCount, spillSize);
1135111351
}
1135211352

1135311353
unsigned GlobalRA::computeSpillSize(std::list<LSLiveRange *> &spilledLRs) {
@@ -11650,6 +11650,7 @@ int GlobalRA::coloringRegAlloc() {
1165011650
builder.getOption(vISA_SpillSpaceCompression);
1165111651

1165211652
uint32_t GRFSpillFillCount = 0;
11653+
uint32_t spillSize = 0;
1165311654
if (builder.getFreqInfoManager().isFreqBasedSpillSelectionEnabled())
1165411655
builder.getFreqInfoManager().initGRFSpillFillFreq();
1165511656

@@ -11803,8 +11804,8 @@ int GlobalRA::coloringRegAlloc() {
1180311804
VISA_DEBUG_VERBOSE(reportSpillInfo(liveAnalysis, coloring));
1180411805
}
1180511806

11806-
std::tie(abort, GRFSpillFillCount) =
11807-
abortOnSpill(GRFSpillFillCount, coloring);
11807+
std::tie(abort, GRFSpillFillCount, spillSize) =
11808+
abortOnSpill(GRFSpillFillCount, spillSize, coloring);
1180811809
if (abort) {
1180911810
// Early exit when -abortonspill is passed, instead of
1181011811
// spending time inserting spill code and then aborting.

visa/GraphColor.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,9 +2193,10 @@ class GlobalRA {
21932193
}
21942194
return instNum;
21952195
}
2196-
// pair of abort, updated GRFSpillFillCount
2197-
std::pair<bool, unsigned int> abortOnSpill(unsigned int GRFSpillFillCount,
2198-
GraphColor &coloring);
2196+
// tuple of abort, updated GRFSpillFillCount, updated spillSize
2197+
std::tuple<bool, unsigned int, unsigned int>
2198+
abortOnSpill(unsigned int GRFSpillFillCount, unsigned int spillSize,
2199+
GraphColor &coloring);
21992200
void verifyNoInfCostSpill(GraphColor &coloring, bool reserveSpillReg);
22002201
void setupA0Dot2OnSpill(bool hasStackCall, unsigned int nextSpillOffset,
22012202
int globalScratchOffset);

0 commit comments

Comments
 (0)