Skip to content

Commit 9be324c

Browse files
fangliu2020igcbot
authored andcommitted
Revert of "[IGC BugFix][vISA]: Fix issue in mergeScalarInst pass #18778"
1 parent bf54626 commit 9be324c

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

visa/MergeScalar.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,21 @@ bool BUNDLE_INFO::doMerge(IR_Builder& builder,
8888
return false;
8989
}
9090

91-
int roundDownPow2Size = (int)Round_Down_Pow2(size);
92-
if (size > roundDownPow2Size)
91+
if (size == 3)
9392
{
9493
for (int pos = 0, numSrc = inst[0]->getNumSrc(); pos < numSrc; ++pos)
9594
{
9695
if (srcPattern[pos] == OPND_PATTERN::CONTIGUOUS)
9796
{
98-
// since we are rounding up esize to roundUpPow2Size, we have to make sure the source is
99-
// not out of bound. To make it safe, we merge the first roundDownPow2Size insts instead.
100-
while (size > roundDownPow2Size)
97+
// since we are rounding up esize to 4, we have to make sure the source is
98+
// not out of bound. If it is we merge the first two inst instead
99+
G4_SrcRegRegion* lastSrc = inst[size - 1]->getSrc(pos)->asSrcRegRegion();
100+
if (lastSrc->getLeftBound() + lastSrc->getTypeSize() >=
101+
lastSrc->getTopDcl()->getByteSize())
101102
{
102103
deleteLastInst();
104+
break;
103105
}
104-
break;
105106
}
106107
}
107108
}
@@ -367,7 +368,7 @@ static bool checkContiguous(
367368
// the conditions are:
368369
// -- arithmetic, logic, mov, math, or pseudo_mad instructions
369370
// -- simd1, NoMask, no predicates or conditional modifier
370-
// -- dst must be direct GRF whose declare has no alias
371+
// -- dst must be direct GRF whose declare is a single element without alias
371372
// -- all sources must be either direct GRF or immediates
372373
bool BUNDLE_INFO::isMergeCandidate(G4_INST* inst, const IR_Builder& builder, bool isInSimdFlow)
373374
{
@@ -408,6 +409,7 @@ bool BUNDLE_INFO::isMergeCandidate(G4_INST* inst, const IR_Builder& builder, boo
408409
G4_Declare* dstDcl = dstBase->isRegVar() ? dstBase->asRegVar()->getDeclare() : nullptr;
409410
if (dstDcl != nullptr &&
410411
(dstDcl->getAliasDeclare() != nullptr ||
412+
dstDcl->getTotalElems() != 1 ||
411413
inst->getDst()->getTypeSize() != dstDcl->getElemSize() ||
412414
!dstDcl->useGRF()))
413415
{

visa/Optimizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8553,7 +8553,7 @@ void Optimizer::recomputeBound(std::unordered_set<G4_Declare*>& declares)
85538553
}
85548554

85558555
//
8556-
// Given a sequence of simd1 instructions (max 8), try to merge them into a single instruction
8556+
// Given a sequence of simd1 instructions (max 4), try to merge them into a single instruction
85578557
// e.g.,
85588558
// mul (1) r0.4<1>:f r0.0<0;1,0>:f r6.5<0;1,0>:f {NoMask}
85598559
// mul (1) r0.5<1>:f r0.1<0;1,0>:f r6.5<0;1,0>:f {NoMask}
@@ -8571,7 +8571,7 @@ void Optimizer::mergeScalarInst()
85718571
int bundleSizeLimit = BUNDLE_INFO::maxBundleSize;
85728572
if (kernel.getInt32KernelAttr(Attributes::ATTR_Target) == VISA_3D)
85738573
{
8574-
bundleSizeLimit = 8;
8574+
bundleSizeLimit = 4;
85758575
}
85768576

85778577
Mem_Manager mergeManager(1024);

0 commit comments

Comments
 (0)