Skip to content

Commit 0df88e0

Browse files
bcheng0127igcbot
authored andcommitted
fixup and solve the dst/src overlap issue caused by spill
1 parent 896707d commit 0df88e0

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

visa/GraphColor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9763,7 +9763,8 @@ int GlobalRA::coloringRegAlloc()
97639763
spillRegSize,
97649764
indrSpillRegSize,
97659765
enableSpillSpaceCompression,
9766-
useScratchMsgForSpill);
9766+
useScratchMsgForSpill,
9767+
builder.avoidDstSrcOverlap());
97679768

97689769
bool success = spillGRF.insertSpillFillCode(&kernel, pointsToAnalysis);
97699770
nextSpillOffset = spillGRF.getNextOffset();
@@ -9887,7 +9888,6 @@ int GlobalRA::coloringRegAlloc()
98879888
computePhyReg();
98889889

98899890
stopTimer(TimerID::GRF_GLOBAL_RA);
9890-
98919891
//
98929892
// Report failure to allocate due to excessive register pressure.
98939893
//

visa/LinearScanRA.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,8 @@ int LinearScanRA::linearScanRA()
10311031
&l,
10321032
&spillLRs,
10331033
enableSpillSpaceCompression,
1034-
useScratchMsgForSpill);
1034+
useScratchMsgForSpill,
1035+
builder.avoidDstSrcOverlap());
10351036

10361037
spillGRF.spillLiveRanges(&kernel);
10371038
nextSpillOffset = spillGRF.getNextOffset();;

visa/SpillManagerGMRF.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ SpillManagerGRF::SpillManagerGRF(
143143
unsigned spillRegSize,
144144
unsigned indrSpillRegSize,
145145
bool enableSpillSpaceCompression,
146-
bool useScratchMsg)
146+
bool useScratchMsg,
147+
bool avoidDstSrcOverlap)
147148
: gra(g)
148149
, builder_(g.kernel.fg.builder)
149150
, varIdCount_(varIdCount)
@@ -158,6 +159,7 @@ SpillManagerGRF::SpillManagerGRF(
158159
, spillIntf_(intf)
159160
, mem_(1024)
160161
, useScratchMsg_(useScratchMsg)
162+
, avoidDstSrcOverlap_(avoidDstSrcOverlap)
161163
{
162164
const unsigned size = sizeof(unsigned) * varIdCount;
163165
spillRangeCount_ = (unsigned*)allocMem(size);
@@ -194,7 +196,8 @@ SpillManagerGRF::SpillManagerGRF(
194196
const LivenessAnalysis* lvInfo,
195197
LSLR_LIST* spilledLSLRs,
196198
bool enableSpillSpaceCompression,
197-
bool useScratchMsg)
199+
bool useScratchMsg,
200+
bool avoidDstSrcOverlap)
198201
: gra(g)
199202
, builder_(g.kernel.fg.builder)
200203
, varIdCount_(varIdCount)
@@ -206,6 +209,7 @@ SpillManagerGRF::SpillManagerGRF(
206209
, failSafeSpill_(false)
207210
, mem_(1024)
208211
, useScratchMsg_(useScratchMsg)
212+
, avoidDstSrcOverlap_(avoidDstSrcOverlap)
209213
{
210214
const unsigned size = sizeof(unsigned) * varIdCount;
211215
spillRangeCount_ = (unsigned*)allocMem(size);
@@ -2950,12 +2954,13 @@ void SpillManagerGRF::insertSpillRangeCode(
29502954
initMWritePayload(
29512955
spillRangeDcl, mRangeDcl, spilledRegion, execSize);
29522956

2957+
29532958
{
29542959
spillSendInst = createSpillSendInstr(
29552960
spillRangeDcl, mRangeDcl, spilledRegion, execSize, spillSendOption);
29562961
}
29572962

2958-
if (failSafeSpill_)
2963+
if (failSafeSpill_ && !avoidDstSrcOverlap_)
29592964
{
29602965
spillRegOffset_ = spillRegStart_;
29612966
}

visa/SpillManagerGMRF.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ class SpillManagerGRF
8989
unsigned spillRegSize,
9090
unsigned indrSpillRegSize,
9191
bool enableSpillSpaceCompression,
92-
bool useScratchMsg
92+
bool useScratchMsg,
93+
bool avoidDstSrcOverlap
9394
);
9495

9596
SpillManagerGRF(
@@ -99,7 +100,9 @@ class SpillManagerGRF
99100
const LivenessAnalysis* lvInfo,
100101
LSLR_LIST* spilledLSLRs,
101102
bool enableSpillSpaceCompression,
102-
bool useScratchMsg);
103+
bool useScratchMsg,
104+
bool avoidDstSrcOverlap
105+
);
103106

104107
~SpillManagerGRF() {}
105108

@@ -638,7 +641,7 @@ class SpillManagerGRF
638641
int globalScratchOffset;
639642

640643
bool useScratchMsg_;
641-
644+
bool avoidDstSrcOverlap_;
642645
// spilled declares that represent a scalar immediate (created due to encoding restrictions)
643646
// We rematerialize the immediate value instead of spill/fill them
644647
std::unordered_map<G4_Declare*, G4_Imm*> scalarImmSpill;

0 commit comments

Comments
 (0)