Skip to content

Commit

Permalink
Fix the bug in the dst/src overlap checking in local RA
Browse files Browse the repository at this point in the history
Wrong calcuation formula failed to check the potential overlap
  • Loading branch information
bcheng0127 authored and igcbot committed Jul 18, 2024
1 parent 04fd0e1 commit bed3ead
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions visa/LocalRA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,15 +1408,16 @@ void LocalRA::calculateInputIntervals() {

bool LocalRA::hasDstSrcOverlapPotential(G4_DstRegRegion *dst,
G4_SrcRegRegion *src) {
int dstOpndNumRows = 0;
bool dstOpndNumRows = false;

if (dst->getBase()->isRegVar()) {
G4_Declare *dstDcl = dst->getBase()->asRegVar()->getDeclare();
if (dstDcl != nullptr) {
int dstOffset = (dstDcl->getOffsetFromBase() + dst->getLeftBound()) /
kernel.numEltPerGRF<Type_UB>();
G4_DstRegRegion *dstRgn = dst;
dstOpndNumRows = dstRgn->getSubRegOff() * dstRgn->getTypeSize() + dstRgn->getLinearizedEnd() -
dstOpndNumRows = dstRgn->getSubRegOff() * dstRgn->getTypeSize() +
dstRgn->getLinearizedEnd() -
dstRgn->getLinearizedStart() + 1 >
kernel.numEltPerGRF<Type_UB>();

Expand All @@ -1426,7 +1427,7 @@ bool LocalRA::hasDstSrcOverlapPotential(G4_DstRegRegion *dst,
G4_Declare *srcDcl = src->getBase()->asRegVar()->getDeclare();
int srcOffset = (srcDcl->getOffsetFromBase() + src->getLeftBound()) /
kernel.numEltPerGRF<Type_UB>();
bool srcOpndNumRows = srcRgn->getSubRegOff() * dstRgn->getTypeSize() +
bool srcOpndNumRows = srcRgn->getSubRegOff() * srcRgn->getTypeSize() +
srcRgn->getLinearizedEnd() -
srcRgn->getLinearizedStart() + 1 >
kernel.numEltPerGRF<Type_UB>();
Expand Down Expand Up @@ -2541,6 +2542,7 @@ bool LinearScan::allocateRegs(LocalLiveRange *lr, G4_BB *bb,
int nrows = 0;
int size = lr->getSizeInWords();
G4_Declare *dcl = lr->getTopDcl();

G4_SubReg_Align subalign = gra.getSubRegAlign(dcl);
BankAlign preBank = BankAlign::Either;
unsigned short occupiedBundles =
Expand Down

0 comments on commit bed3ead

Please sign in to comment.