Skip to content

Commit 1803372

Browse files
fangliu2020igcbot
authored andcommitted
Changes in code.
1 parent b6e1707 commit 1803372

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

visa/HWConformity.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5363,15 +5363,15 @@ void HWConformity::avoidInstDstSrcOverlap(INST_LIST_ITER it, G4_BB *bb,
53635363
return;
53645364
}
53655365

5366+
unsigned grfSize = builder.getGRFSize();
53665367
G4_Declare *dstDcl = dst->getTopDcl();
53675368
if (dstDcl) {
53685369
G4_DstRegRegion *dstRgn = dst;
53695370
bool dstCrossGRF =
5370-
(dstRgn->getSubRegOff() * dstRgn->getTypeSize() +
5371-
(dstRgn->getLinearizedEnd() - dstRgn->getLinearizedStart()) + 1) >
5372-
kernel.numEltPerGRF<Type_UB>();
5373-
int dstFirstHalf =
5374-
dst->getLinearizedStart() / kernel.numEltPerGRF<Type_UB>();
5371+
((dstRgn->getSubRegOff() * dstRgn->getTypeSize()) % grfSize +
5372+
(dstRgn->getLinearizedEnd() - dstRgn->getLinearizedStart()) + 1) >
5373+
grfSize;
5374+
int dstFirstHalf = dst->getLinearizedStart() / grfSize;
53755375

53765376
bool srcOverlap = false;
53775377
for (int i = 0, nSrcs = inst->getNumSrc(); i < nSrcs; i++) {
@@ -5387,9 +5387,9 @@ void HWConformity::avoidInstDstSrcOverlap(INST_LIST_ITER it, G4_BB *bb,
53875387
if (srcDcl == dstDcl && srcRgn->getRegAccess() == Direct &&
53885388
srcRgn->getBase()->isRegVar()) {
53895389
bool srcCrossGRF =
5390-
(srcRgn->getSubRegOff() * srcRgn->getTypeSize() +
5390+
((srcRgn->getSubRegOff() * srcRgn->getTypeSize()) % grfSize +
53915391
(srcRgn->getLinearizedEnd() - srcRgn->getLinearizedStart()) +
5392-
1) > kernel.numEltPerGRF<Type_UB>();
5392+
1) > grfSize;
53935393
// The half define in region rule "second half of a source operand
53945394
// must not point to the same register as the first half of
53955395
// destination operand in a compressed instruction" is exactly size
@@ -5404,7 +5404,7 @@ void HWConformity::avoidInstDstSrcOverlap(INST_LIST_ITER it, G4_BB *bb,
54045404
((srcRgn->getLinearizedEnd() -
54055405
srcRgn->getLinearizedStart() + 1) /
54065406
2)) /
5407-
kernel.numEltPerGRF<Type_UB>();
5407+
grfSize;
54085408
} else { // For non-congtiguous region, there are holes in the region,
54095409
// the start of second half elements need be calcauted in
54105410
// stride and elemement sizes at same time.
@@ -5427,15 +5427,14 @@ void HWConformity::avoidInstDstSrcOverlap(INST_LIST_ITER it, G4_BB *bb,
54275427
numElePerRow = rowSize / execTypeSize,
54285428
numExecEmePerRow =
54295429
regionDesc->horzStride == 0 ? 1 : regionDesc->width;
5430-
uint16_t totalNumEle =
5431-
(regionDesc->vertStride >= numElePerRow)
5432-
? (numRows * numExecEmePerRow)
5433-
: (srcRgn->getRightBound() - srcRgn->getLeftBound() + 1) /
5434-
execTypeSize;
5430+
uint16_t totalNumEle = (regionDesc->vertStride >= numElePerRow)
5431+
? (numRows * numExecEmePerRow)
5432+
: (srcRgn->getLinearizedEnd() -
5433+
srcRgn->getLinearizedStart() + 1) /
5434+
execTypeSize;
54355435
srcSecondHalf =
5436-
(srcRgn->getLeftBound() % builder.numEltPerGRF<Type_UB>() +
5437-
(totalNumEle / 2) * vertSize) /
5438-
builder.numEltPerGRF<Type_UB>();
5436+
(srcRgn->getLinearizedStart() + (totalNumEle / 2) * vertSize) /
5437+
grfSize;
54395438
}
54405439

54415440
if (dstCrossGRF || srcCrossGRF) {

0 commit comments

Comments
 (0)