Skip to content

Commit a2d9ca0

Browse files
bcheng0127igcbot
authored andcommitted
localRA: Fix bug when input variable occupies EOT registers
Local RA cannot handle the EOT live range interference, because EOT variables are handled seperately. The solution is the if EOT register is occupied by input variable, fail local RA and use global RA to handle. Global RA can do spill/fill to the EOT variables.
1 parent 58fe931 commit a2d9ca0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

visa/LocalRA.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,31 @@ bool LocalRA::assignUniqueRegisters(bool twoBanksRA, bool twoDirectionsAssign,
676676
if (dclLR && dclLR->isEOT() && builder.hasEOTGRFBinding()) {
677677
// For EOT use r112 - r127
678678
// for simplicity we assign each EOT source unique GRFs
679+
int rows = dcl->getNumRows();
680+
bool found = false;
681+
while (nextEOTGRF + rows <= kernel.getNumRegTotal()) {
682+
bool isGood = true;
683+
for (int i = 0; i < dcl->getNumRows(); i++) {
684+
// Only handle it when the register is available.
685+
// If occupied by input, it will only be set busy.
686+
// If not avaialable(Such as vISA_Debug) keep the old way.
687+
if (pregs->isGRFAvailable(nextEOTGRF + i)) {
688+
if (pregs->isGRFBusy(nextEOTGRF + i)) {
689+
nextEOTGRF = nextEOTGRF + i + 1;
690+
isGood = false;
691+
break;
692+
}
693+
}
694+
}
695+
if (isGood) {
696+
found = true;
697+
break;
698+
}
699+
}
700+
if (!found) {
701+
return true;
702+
}
703+
679704
G4_Greg *phyReg = builder.phyregpool.getGreg(nextEOTGRF);
680705
dcl->getRegVar()->setPhyReg(phyReg, 0);
681706
dclLR->setPhyReg(phyReg, 0);

0 commit comments

Comments
 (0)