Skip to content

Commit c622f2f

Browse files
pratikasharsys_zuul
authored and
sys_zuul
committed
Fix in LRA to ensure startGRFReg is less than number of GRFs available
for allocation to linear scan. Change-Id: I3c13467c2c66d237b11e4c47c9c5a4d8789c4f4f
1 parent 442a3c6 commit c622f2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

visa/LocalRA.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,8 @@ void LinearScan::run(G4_BB* bb, IR_Builder& builder, LLR_USE_MAP& LLRUseMap)
25352535
startregnum = endregnum = op->asGreg()->getRegNum();
25362536
endsregnum = startsregnum + (lr->getTopDcl()->getNumElems() * lr->getTopDcl()->getElemSize() / 2) - 1;
25372537

2538+
MUST_BE_TRUE(((unsigned int)startregnum + lr->getTopDcl()->getNumRows() - 1) < numRegLRA, "Linear scan allocated unavailable physical GRF");
2539+
25382540
if (lr->getTopDcl()->getNumRows() > 1) {
25392541
endregnum = startregnum + lr->getTopDcl()->getNumRows() - 1;
25402542

@@ -3225,7 +3227,7 @@ bool LinearScan::allocateRegsFromBanks(LocalLiveRange* lr)
32253227
if (*startGRFReg < SECOND_HALF_BANK_START_GRF)
32263228
{
32273229
*startGRFReg += bank2_start;
3228-
if (*startGRFReg >= gra.kernel.getNumRegTotal())
3230+
if (*startGRFReg >= numRegLRA)
32293231
{
32303232
*startGRFReg = bank2_start;
32313233
return false;

0 commit comments

Comments
 (0)