Skip to content

Commit 4c38018

Browse files
Wei-Chen-Inteligcbot
authored andcommitted
(NFC) Clean up spill module's constructor
Clean up SpillManagerGRF's constructor to avoid passing unnecessary arguments (e.g., if it could be derived from other arguments). Fix a bug discovered during refactor where we are initializing a const reference to a temporary object. We didn't hit the bug before as the data structure is apparently never used in that code path. Also avoid keeping count of number of occurrences of each type of spill temp; they are only used as debug variable names for IR dump, so we don't want to pay compilation overhead for them.
1 parent 0798e27 commit 4c38018

File tree

4 files changed

+95
-158
lines changed

4 files changed

+95
-158
lines changed

visa/GraphColor.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9669,14 +9669,15 @@ int GlobalRA::coloringRegAlloc() {
96699669
enableSpillSpaceCompression = false;
96709670
}
96719671
}
9672-
96739672
startTimer(TimerID::SPILL);
96749673
SpillManagerGRF spillGRF(
9675-
*this, nextSpillOffset, liveAnalysis.getNumSelectedVar(),
9676-
&liveAnalysis, coloring.getLiveRanges(), coloring.getIntf(),
9677-
&coloring.getSpilledLiveRanges(), iterationNo++, reserveSpillReg,
9678-
spillRegSize, indrSpillRegSize, enableSpillSpaceCompression,
9679-
useScratchMsgForSpill, builder.avoidDstSrcOverlap());
9674+
*this, nextSpillOffset, &liveAnalysis, coloring.getLiveRanges(),
9675+
coloring.getIntf(), &coloring.getSpilledLiveRanges(),
9676+
reserveSpillReg, spillRegSize, indrSpillRegSize,
9677+
enableSpillSpaceCompression, useScratchMsgForSpill);
9678+
// FIXME: This really should be done at loop end, but keep it here to
9679+
// match old behavior.
9680+
iterationNo++;
96809681

96819682
if (kernel.getOption(vISA_SpillAnalysis)) {
96829683
spillAnalysis->Do(&liveAnalysis, &coloring, &spillGRF);

visa/LinearScanRA.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ int LinearScanRA::linearScanRA() {
801801
kernel.fg.getHasStackCalls() || kernel.fg.getIsStackCallFunc();
802802
int globalScratchOffset =
803803
kernel.getInt32KernelAttr(Attributes::ATTR_SpillMemOffset);
804+
// FXIME: This does not match GCRA's definition (it has an additional
805+
// builder.suppportsLSC())
804806
bool useScratchMsgForSpill =
805807
!hasStackCall && (globalScratchOffset < (int)(SCRATCH_MSG_LIMIT * 0.6));
806808
bool enableSpillSpaceCompression =
@@ -922,10 +924,9 @@ int LinearScanRA::linearScanRA() {
922924
}
923925
}
924926

925-
SpillManagerGRF spillGRF(gra, nextSpillOffset, l.getNumSelectedVar(), &l,
926-
&spillLRs, enableSpillSpaceCompression,
927-
useScratchMsgForSpill,
928-
builder.avoidDstSrcOverlap(), {});
927+
SpillManagerGRF spillGRF(gra, nextSpillOffset, &l, &spillLRs,
928+
enableSpillSpaceCompression,
929+
useScratchMsgForSpill);
929930

930931
spillGRF.spillLiveRanges(&kernel);
931932
nextSpillOffset = spillGRF.getNextOffset();

0 commit comments

Comments
 (0)