Skip to content

Commit bf60373

Browse files
bcheng0127sys_zuul
authored andcommitted
relax ACC substitution constraints
Change-Id: I9093708284f580492ac4449429fcbf73f16c8ecb
1 parent a17b6c3 commit bf60373

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

visa/Gen4_IR.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7822,11 +7822,6 @@ bool G4_INST::canSrcBeAcc(Gen4_Operand_Number opndNum) const
78227822
}
78237823

78247824
G4_SrcRegRegion* src = getSrc(srcId)->asSrcRegRegion();
7825-
if (srcId == 1 && src->getModifier() != Mod_src_undef)
7826-
{
7827-
// src1 acc does not support modifiers
7828-
return false;
7829-
}
78307825
if (!src->getRegion()->isContiguous(getExecSize()))
78317826
{
78327827
return false;
@@ -7917,7 +7912,7 @@ bool G4_INST::canSrcBeAcc(Gen4_Operand_Number opndNum) const
79177912
case G4_mad:
79187913
// no int acc if it's used as mul operand
79197914
return builder.canMadHaveAcc() &&
7920-
((srcId == 1 && (IS_FTYPE(src->getType()) || (src->getType() == Type_DF))) || (srcId == 0 && src->getModifier() == Mod_src_undef));
7915+
(IS_FTYPE(src->getType()) || (src->getType() == Type_DF));
79217916
case G4_csel:
79227917
return builder.canMadHaveAcc();
79237918
case G4_mul:

visa/HWConformity.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4392,7 +4392,10 @@ static bool isAccCandidate(G4_INST* inst, G4_Kernel& kernel, int& lastUse, bool&
43924392
}
43934393
else if (opndNum != Opnd_src0)
43944394
{
4395-
return false;
4395+
if (!useInst->canSwapSource())
4396+
{
4397+
return false;
4398+
}
43964399
}
43974400

43984401
if (useInst->getSingleDef(opndNum) == nullptr)
@@ -4503,6 +4506,22 @@ static bool replaceDstWithAcc(G4_INST* inst, int accNum, IR_Builder& builder)
45034506
return false;
45044507
}
45054508
}
4509+
4510+
if (useInst->getNumSrc() == 2)
4511+
{
4512+
if (use.second != Opnd_src0)
4513+
{
4514+
if (useInst->canSwapSource() && !useInst->getSrc(0)->isAccReg())
4515+
{
4516+
useInst->swapSrc(0, 1);
4517+
use.second = Opnd_src0;
4518+
}
4519+
else
4520+
{
4521+
return false;
4522+
}
4523+
}
4524+
}
45064525
}
45074526

45084527
// at this point acc substitution must succeed

0 commit comments

Comments
 (0)