Skip to content

Commit 69a5cbd

Browse files
fangliu2020igcbot
authored andcommitted
[vISA]: Fix the WAW/WAR issue of ACC caused by mul/mulh/madw in local scheduling. #2 try.
on some platforms, mul/mulh/madw will be expanded into mul+mach/macl after local scheduling. Since ACC is used as dst of expanded mul, it is a must to set implicit ACC as dst of mul/mulh/madw. Otherwise, there will be WAW/WAR issue of ACC in local scheduling.
1 parent 414c69c commit 69a5cbd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

visa/HWConformity.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,6 +2122,11 @@ void HWConformity::doGenerateMacl(INST_LIST_ITER it, G4_BB* bb)
21222122
G4_DstRegRegion* tmpDst = insertMovAfter(it, origDst, tmpType, bb, GRFALIGN);
21232123
mulInst->setDest(tmpDst);
21242124
}
2125+
2126+
// set implicit acc dst to the mul instruction as acc will be used as dst of the expanded mul after local scheduling.
2127+
// it is a must to fix the WAR/WAW issue of acc in local scheduling.
2128+
G4_DstRegRegion* accDstOpnd = builder.createDst(builder.phyregpool.getAcc0Reg(), 0, 0, 1, mulInst->getDst()->getType());
2129+
mulInst->setImplAccDst(accDstOpnd);
21252130
}
21262131
else
21272132
{
@@ -2679,6 +2684,11 @@ void HWConformity::fixMULHInst(INST_LIST_ITER& i, G4_BB* bb)
26792684
// this effectivly means sat is broken for mul D D D
26802685
inst->setSaturate(g4::NOSAT);
26812686

2687+
// set implicit acc dst to the mulh instruction as acc will be used as dst of the expanded mul after local scheduling.
2688+
// it is a must to fix the WAR/WAW issue of acc in local scheduling.
2689+
G4_DstRegRegion* accDstOpnd = builder.createDst(builder.phyregpool.getAcc0Reg(), 0, 0, 1, inst->getDst()->getType());
2690+
inst->setImplAccDst(accDstOpnd);
2691+
26822692
if (execSize > builder.getNativeExecSize())
26832693
{
26842694
auto start_iter = i;
@@ -8026,6 +8036,11 @@ INST_LIST_ITER HWConformity::fixMadwInst(INST_LIST_ITER it, G4_BB* bb)
80268036
}
80278037
}
80288038

8039+
// add implicit acc dst to the madw instruction as acc will be used as dst of the expanded mul after local scheduling.
8040+
// it is a must to fix the WAR/WAW issue of acc in local scheduling.
8041+
G4_DstRegRegion* accDstOpnd = builder.createDst(builder.phyregpool.getAcc0Reg(), 0, 0, 1, madwInst->getDst()->getType());
8042+
madwInst->setImplAccDst(accDstOpnd);
8043+
80298044
retIter = std::next(it);
80308045
}
80318046
else

0 commit comments

Comments
 (0)