Skip to content

Commit 0d06030

Browse files
weiyu-chensys_zuul
authored andcommitted
Avoid read-modify-write for spills on NoMask sends.
Change-Id: I2dce8fa2cdafd6fdcdf896c00f6cc196fdc1bfca
1 parent 0cab4e5 commit 0d06030

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

visa/SpillManagerGMRF.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@ SpillManagerGRF::insertSpillRangeCode (
31653165
// offset to the spill range and create the instructions to load the
31663166
// save the spill range to spill memory.
31673167

3168-
if ((*spilledInstIter)->mayExceedTwoGRF())
3168+
if (inst->mayExceedTwoGRF())
31693169
{
31703170
INST_LIST::iterator sendOutIter = spilledInstIter;
31713171
assert (getRFType (spilledRegion) == G4_GRF);
@@ -3175,13 +3175,19 @@ SpillManagerGRF::insertSpillRangeCode (
31753175
createAndInitMHeader (
31763176
(G4_RegVarTransient *) spillRangeDcl->getRegVar ());
31773177

3178-
sendInSpilledRegVarPortions (
3179-
spillRangeDcl, mRangeDcl, 0,
3180-
spillRangeDcl->getNumRows (),
3181-
spilledRegion->getRegOff());
3178+
// Assumption here is that a NoMask send doesn't need read-modify-write
3179+
// since it writes the entire GRF(s).
3180+
// May need to revisit if we have some strange sends that update partial GRFs. (e.g., SIMD4 scatter read)
3181+
if (!inst->isWriteEnableInst())
3182+
{
3183+
sendInSpilledRegVarPortions(
3184+
spillRangeDcl, mRangeDcl, 0,
3185+
spillRangeDcl->getNumRows(),
3186+
spilledRegion->getRegOff());
31823187

3183-
INST_LIST::iterator insertPos = sendOutIter;
3184-
bb->splice (insertPos, builder_->instList);
3188+
INST_LIST::iterator insertPos = sendOutIter;
3189+
bb->splice(insertPos, builder_->instList);
3190+
}
31853191

31863192
sendOutSpilledRegVarPortions (
31873193
spillRangeDcl, mRangeDcl, 0, spillRangeDcl->getNumRows (),

0 commit comments

Comments
 (0)