Skip to content

Commit 15584d1

Browse files
weiyu-chensys_zuul
authored andcommitted
Fix spilled variable offset alignment when scratch space compression is enabled.
Change-Id: I755de9eebd7d9ade87a06100071a77b5b0ac5db4
1 parent 7573d28 commit 15584d1

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

visa/Gen4_IR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,7 +3685,7 @@ void G4_INST::emit_inst(std::ostream& output, bool symbol_dst, bool *symbol_srcs
36853685
}
36863686
if (isSpillIntrinsic())
36873687
{
3688-
output << "Scratch[" << asSpillIntrinsic()->getOffset() << "] ";
3688+
output << "Scratch[" << asSpillIntrinsic()->getOffset() << "x32] ";
36893689
}
36903690
else if (dst)
36913691
{
@@ -3711,7 +3711,7 @@ void G4_INST::emit_inst(std::ostream& output, bool symbol_dst, bool *symbol_srcs
37113711
}
37123712
if (isFillIntrinsic())
37133713
{
3714-
output << "Scratch[" << asFillIntrinsic()->getOffset() << "] ";
3714+
output << "Scratch[" << asFillIntrinsic()->getOffset() << "x32] ";
37153715
}
37163716

37173717
if (isFlowControl() && asCFInst()->getJip())

visa/SpillManagerGMRF.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -560,18 +560,8 @@ SpillManagerGRF::calculateSpillDisp (
560560
break;
561561
unsigned curLocEnd = curLocDisp + getByteSize (*curLoc);
562562
{
563-
if (useScratchMsg_)
564-
{
565-
if(curLocEnd % G4_GRF_REG_NBYTES != 0)
566-
curLocEnd = ROUND(curLocEnd, G4_GRF_REG_NBYTES);
567-
}
568-
else
569-
{
570-
if (owordAligned (curLocEnd) == false) {
571-
curLocEnd =
572-
(curLocEnd & owordMask ()) + OWORD_BYTE_SIZE;
573-
}
574-
}
563+
if (curLocEnd % G4_GRF_REG_NBYTES != 0)
564+
curLocEnd = ROUND(curLocEnd, G4_GRF_REG_NBYTES);
575565
}
576566

577567
regVarLocDisp = (regVarLocDisp > curLocEnd)? regVarLocDisp: curLocEnd;
@@ -607,8 +597,9 @@ G4_RegVar * regVar
607597
{
608598
// Already calculated spill memory disp
609599

610-
if (regVar->getDisp() != UINT_MAX) {
611-
// Do nothing.
600+
if (regVar->getDisp() != UINT_MAX)
601+
{
602+
return regVar->getDisp();
612603
}
613604

614605
// If it is an aliased regvar then calculate the disp for the
@@ -691,6 +682,10 @@ G4_RegVar * regVar
691682
}
692683
}
693684

685+
// ToDo: log this in some dump to help debug
686+
//regVar->getDeclare()->dump();
687+
//std::cerr << "spill offset = " << regVar->getDisp() << "\n";
688+
694689
return regVar->getDisp();
695690
}
696691

0 commit comments

Comments
 (0)