Skip to content

Commit bed3ead

Browse files
bcheng0127igcbot
authored andcommitted
Fix the bug in the dst/src overlap checking in local RA
Wrong calcuation formula failed to check the potential overlap
1 parent 04fd0e1 commit bed3ead

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

visa/LocalRA.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,15 +1408,16 @@ void LocalRA::calculateInputIntervals() {
14081408

14091409
bool LocalRA::hasDstSrcOverlapPotential(G4_DstRegRegion *dst,
14101410
G4_SrcRegRegion *src) {
1411-
int dstOpndNumRows = 0;
1411+
bool dstOpndNumRows = false;
14121412

14131413
if (dst->getBase()->isRegVar()) {
14141414
G4_Declare *dstDcl = dst->getBase()->asRegVar()->getDeclare();
14151415
if (dstDcl != nullptr) {
14161416
int dstOffset = (dstDcl->getOffsetFromBase() + dst->getLeftBound()) /
14171417
kernel.numEltPerGRF<Type_UB>();
14181418
G4_DstRegRegion *dstRgn = dst;
1419-
dstOpndNumRows = dstRgn->getSubRegOff() * dstRgn->getTypeSize() + dstRgn->getLinearizedEnd() -
1419+
dstOpndNumRows = dstRgn->getSubRegOff() * dstRgn->getTypeSize() +
1420+
dstRgn->getLinearizedEnd() -
14201421
dstRgn->getLinearizedStart() + 1 >
14211422
kernel.numEltPerGRF<Type_UB>();
14221423

@@ -1426,7 +1427,7 @@ bool LocalRA::hasDstSrcOverlapPotential(G4_DstRegRegion *dst,
14261427
G4_Declare *srcDcl = src->getBase()->asRegVar()->getDeclare();
14271428
int srcOffset = (srcDcl->getOffsetFromBase() + src->getLeftBound()) /
14281429
kernel.numEltPerGRF<Type_UB>();
1429-
bool srcOpndNumRows = srcRgn->getSubRegOff() * dstRgn->getTypeSize() +
1430+
bool srcOpndNumRows = srcRgn->getSubRegOff() * srcRgn->getTypeSize() +
14301431
srcRgn->getLinearizedEnd() -
14311432
srcRgn->getLinearizedStart() + 1 >
14321433
kernel.numEltPerGRF<Type_UB>();
@@ -2541,6 +2542,7 @@ bool LinearScan::allocateRegs(LocalLiveRange *lr, G4_BB *bb,
25412542
int nrows = 0;
25422543
int size = lr->getSizeInWords();
25432544
G4_Declare *dcl = lr->getTopDcl();
2545+
25442546
G4_SubReg_Align subalign = gra.getSubRegAlign(dcl);
25452547
BankAlign preBank = BankAlign::Either;
25462548
unsigned short occupiedBundles =

0 commit comments

Comments
 (0)