Skip to content

Commit ede3418

Browse files
fangliu2020igcbot
authored andcommitted
Fix the issue in scalarMerge pass introduced by " [IGC BugFix][vISA]: Fix issue in mergeScalarInst pass (#18778)"
1 parent 31d4f77 commit ede3418

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

visa/MergeScalar.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,19 @@ bool BUNDLE_INFO::doMerge(IR_Builder& builder,
8989
}
9090

9191
int roundDownPow2Size = (int)Round_Down_Pow2(size);
92-
int roundUpPow2Size = (int)Round_Up_Pow2(size);
93-
if (size > roundDownPow2Size && size < roundUpPow2Size)
92+
if (size > roundDownPow2Size)
9493
{
9594
for (int pos = 0, numSrc = inst[0]->getNumSrc(); pos < numSrc; ++pos)
9695
{
9796
if (srcPattern[pos] == OPND_PATTERN::CONTIGUOUS)
9897
{
9998
// since we are rounding up esize to roundUpPow2Size, we have to make sure the source is
100-
// not out of bound. If it is we merge the first roundDownPow2Size insts instead.
101-
G4_SrcRegRegion* lastSrc = inst[size - 1]->getSrc(pos)->asSrcRegRegion();
102-
if ((lastSrc->getLeftBound() + lastSrc->getTypeSize() * (roundUpPow2Size - size)) >=
103-
lastSrc->getTopDcl()->getByteSize())
99+
// not out of bound. To make it safe, we merge the first roundDownPow2Size insts instead.
100+
while (size > roundDownPow2Size)
104101
{
105-
while (size > roundDownPow2Size)
106-
{
107-
deleteLastInst();
108-
}
109-
break;
102+
deleteLastInst();
110103
}
104+
break;
111105
}
112106
}
113107
}

0 commit comments

Comments
 (0)