@@ -11302,31 +11302,31 @@ bool GlobalRA::convertToFailSafe(bool reserveSpillReg, GraphColor &coloring,
11302
11302
return reserveSpillReg;
11303
11303
}
11304
11304
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) {
11308
11308
// Calculate the spill caused by send to decide if global splitting is
11309
11309
// required or not
11310
11310
for (auto spilled : coloring.getSpilledLiveRanges ()) {
11311
11311
GRFSpillFillCount += spilled->getRefCount ();
11312
11312
}
11313
11313
11314
+ spillSize += computeSpillSize (coloring.getSpilledLiveRanges ());
11315
+
11314
11316
// vISA_AbortOnSpillThreshold is defined as [0..200]
11315
11317
// 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) {
11318
11320
int threshold = std::min (
11319
11321
builder.getOptions ()->getuInt32Option (vISA_AbortOnSpillThreshold),
11320
11322
200u );
11321
- unsigned spillSize = computeSpillSize (coloring.getSpilledLiveRanges ());
11322
-
11323
11323
return (numSpill * 200 ) < (threshold * asmCount) ||
11324
11324
spillSize < kernel.grfMode .getSpillThreshold ();
11325
11325
};
11326
11326
11327
11327
unsigned int instNum = instCount ();
11328
11328
bool isUnderThreshold =
11329
- underSpillThreshold (GRFSpillFillCount, instNum, coloring);
11329
+ underSpillThreshold (GRFSpillFillCount, spillSize, instNum, coloring);
11330
11330
isUnderThreshold = builder.getFreqInfoManager ().underFreqSpillThreshold (
11331
11331
coloring.getSpilledLiveRanges (), instNum, GRFSpillFillCount,
11332
11332
isUnderThreshold);
@@ -11345,9 +11345,9 @@ GlobalRA::abortOnSpill(unsigned int GRFSpillFillCount,
11345
11345
jitInfo->stats .numGRFSpillFillWeighted = GRFSpillFillCount;
11346
11346
}
11347
11347
11348
- return std::make_pair (true , GRFSpillFillCount);
11348
+ return std::make_tuple (true , GRFSpillFillCount, spillSize );
11349
11349
}
11350
- return std::make_pair (false , GRFSpillFillCount);
11350
+ return std::make_tuple (false , GRFSpillFillCount, spillSize );
11351
11351
}
11352
11352
11353
11353
unsigned GlobalRA::computeSpillSize (std::list<LSLiveRange *> &spilledLRs) {
@@ -11650,6 +11650,7 @@ int GlobalRA::coloringRegAlloc() {
11650
11650
builder.getOption (vISA_SpillSpaceCompression);
11651
11651
11652
11652
uint32_t GRFSpillFillCount = 0 ;
11653
+ uint32_t spillSize = 0 ;
11653
11654
if (builder.getFreqInfoManager ().isFreqBasedSpillSelectionEnabled ())
11654
11655
builder.getFreqInfoManager ().initGRFSpillFillFreq ();
11655
11656
@@ -11803,8 +11804,8 @@ int GlobalRA::coloringRegAlloc() {
11803
11804
VISA_DEBUG_VERBOSE (reportSpillInfo (liveAnalysis, coloring));
11804
11805
}
11805
11806
11806
- std::tie (abort, GRFSpillFillCount) =
11807
- abortOnSpill (GRFSpillFillCount, coloring);
11807
+ std::tie (abort, GRFSpillFillCount, spillSize ) =
11808
+ abortOnSpill (GRFSpillFillCount, spillSize, coloring);
11808
11809
if (abort) {
11809
11810
// Early exit when -abortonspill is passed, instead of
11810
11811
// spending time inserting spill code and then aborting.
0 commit comments