Skip to content

Commit 4509c04

Browse files
jgu222igcbot
authored andcommitted
regsiter allocation support for NoMask WA
regsiter allocation support for NoMask WA
1 parent 0df1e81 commit 4509c04

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

visa/GraphColor.cpp

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9767,27 +9767,28 @@ int GlobalRA::coloringRegAlloc()
97679767
}
97689768

97699769

9770-
//
9771-
// If the graph has stack calls, then add the caller-save/callee-save pseudo
9772-
// declares and code. This currently must be done after flag/addr RA due to
9773-
// the assumption about the location of the pseudo save/restore instructions
9774-
//
9775-
bool euWADone = false;
9776-
if (hasStackCall)
9770+
if (builder.hasFusedEUWA() && !builder.getIsPayload())
97779771
{
9778-
if (builder.hasFusedEUWA() && !euWADone)
9772+
G4_BB* entryBB = (*kernel.fg.begin());
9773+
if (entryBB)
97799774
{
9780-
G4_INST* euWAInst = builder.createEUWASpill(false);
9781-
G4_BB* entryBB = (*kernel.fg.begin());
97829775
INST_LIST_ITER inst_it = entryBB->begin();
9783-
while ((*inst_it)->isLabel())
9776+
while (inst_it != entryBB->end() && (*inst_it)->isLabel())
97849777
{
97859778
inst_it++;
97869779
}
9780+
G4_INST* euWAInst = builder.createEUWASpill(false);
97879781
entryBB->insertBefore(inst_it, euWAInst);
9788-
euWADone = true;
97899782
}
9783+
}
97909784

9785+
//
9786+
// If the graph has stack calls, then add the caller-save/callee-save pseudo
9787+
// declares and code. This currently must be done after flag/addr RA due to
9788+
// the assumption about the location of the pseudo save/restore instructions
9789+
//
9790+
if (hasStackCall)
9791+
{
97919792
addCallerSavePseudoCode();
97929793

97939794
// Only GENX sub-graphs require callee-save code.
@@ -10194,19 +10195,6 @@ int GlobalRA::coloringRegAlloc()
1019410195
bool success = spillGRF.insertSpillFillCode(&kernel, pointsToAnalysis);
1019510196
nextSpillOffset = spillGRF.getNextOffset();
1019610197

10197-
if (builder.hasFusedEUWA() && !euWADone)
10198-
{
10199-
G4_INST * euWAInst = builder.createEUWASpill(false);
10200-
G4_BB* entryBB = (*kernel.fg.begin());
10201-
INST_LIST_ITER inst_it = entryBB->begin();
10202-
while ((*inst_it)->isLabel())
10203-
{
10204-
inst_it++;
10205-
}
10206-
entryBB->insertBefore(inst_it, euWAInst);
10207-
euWADone = true;
10208-
}
10209-
1021010198
if (builder.hasScratchSurface() && !hasStackCall &&
1021110199
(nextSpillOffset + globalScratchOffset) > SCRATCH_MSG_LIMIT)
1021210200
{

visa/HWCaps.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ SPDX-License-Identifier: MIT
785785
bool hasFusedEUWA() const
786786
{
787787
return ((getuint32Option(vISA_noMaskWA) & 0x3) > 0 ||
788-
getOption(vISA_forceNoMaskWA));
788+
getOption(vISA_forceNoMaskWA)) && !getOption(vISA_LinearScan) && hasFusedEU();
789789
}
790790

791791
bool hasFusedEU() const

visa/LocalRA.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,10 @@ void PhyRegsLocalRA::markPhyRegs(G4_Declare* topdcl)
23432343
unsigned numwords = 0;
23442344
unsigned int regnum = 0;
23452345

2346+
if (builder->hasFusedEUWA() && rvar->getPhyReg() == nullptr)
2347+
{
2348+
return;
2349+
}
23462350
// Calculate number of physical registers required by this dcl
23472351
if (numrows == 1)
23482352
{

0 commit comments

Comments
 (0)