Skip to content

Commit ab89555

Browse files
bcheng0127igcbot
authored andcommitted
regsiter allocation support for NoMask WA
regsiter allocation support for NoMask WA
1 parent 115daaf commit ab89555

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
@@ -9765,27 +9765,28 @@ int GlobalRA::coloringRegAlloc()
97659765
}
97669766

97679767

9768-
//
9769-
// If the graph has stack calls, then add the caller-save/callee-save pseudo
9770-
// declares and code. This currently must be done after flag/addr RA due to
9771-
// the assumption about the location of the pseudo save/restore instructions
9772-
//
9773-
bool euWADone = false;
9774-
if (hasStackCall)
9768+
if (builder.hasFusedEUWA())
97759769
{
9776-
if (builder.hasFusedEUWA() && !euWADone)
9770+
G4_BB* entryBB = (*kernel.fg.begin());
9771+
if (entryBB->getInstList().size() > 1)
97779772
{
9778-
G4_INST* euWAInst = builder.createEUWASpill(false);
9779-
G4_BB* entryBB = (*kernel.fg.begin());
97809773
INST_LIST_ITER inst_it = entryBB->begin();
9781-
while ((*inst_it)->isLabel())
9774+
while ((*inst_it)->isLabel() && inst_it != entryBB->end())
97829775
{
97839776
inst_it++;
97849777
}
9778+
G4_INST* euWAInst = builder.createEUWASpill(false);
97859779
entryBB->insertBefore(inst_it, euWAInst);
9786-
euWADone = true;
97879780
}
9781+
}
97889782

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

97919792
// Only GENX sub-graphs require callee-save code.
@@ -10192,19 +10193,6 @@ int GlobalRA::coloringRegAlloc()
1019210193
bool success = spillGRF.insertSpillFillCode(&kernel, pointsToAnalysis);
1019310194
nextSpillOffset = spillGRF.getNextOffset();
1019410195

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

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);
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 (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)