Skip to content

Commit 57cc5fc

Browse files
pratikasharsys_zuul
authored andcommitted
[Autobackout][FuncReg]Revert of change: 87fce2b
Internal change. Change-Id: I7916f439af20bfa8de02a1bff36fefce18d455d4
1 parent f79824b commit 57cc5fc

File tree

6 files changed

+19
-60
lines changed

6 files changed

+19
-60
lines changed

visa/BuildIRImpl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ G4_Declare* IR_Builder::getSpillFillHeader()
727727
{
728728
spillFillHeader = createTempVar(1, Type_UD, GRFALIGN, "spillHeader");
729729
spillFillHeader->setLiveOut();
730-
spillFillHeader->setDoNotSpill();
731730
}
732731
return spillFillHeader;
733732
}

visa/GraphColor.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9256,6 +9256,8 @@ bool GlobalRA::hybridRA(bool doBankConflictReduction, bool highInternalConflict,
92569256
coloring.addSaveRestoreCode(0);
92579257
}
92589258

9259+
expandSpillFillIntrinsics();
9260+
92599261
if (verifyAugmentation)
92609262
{
92619263
assignRegForAliasDcl();
@@ -9324,14 +9326,14 @@ int GlobalRA::coloringRegAlloc()
93249326
flagRegAlloc();
93259327
}
93269328

9327-
93289329
//
93299330
// If the graph has stack calls, then add the caller-save/callee-save pseudo declares and code.
93309331
// This currently must be done after flag/addr RA due to the assumption about the location
93319332
// of the pseudo save/restore instructions
93329333
//
93339334
if (hasStackCall)
93349335
{
9336+
93359337
addCallerSavePseudoCode();
93369338

93379339
// Only GENX sub-graphs require callee-save code.
@@ -9363,9 +9365,7 @@ int GlobalRA::coloringRegAlloc()
93639365
{
93649366
assignRegForAliasDcl();
93659367
computePhyReg();
9366-
// TODO: Get correct spillSize from LinearScanRA
9367-
unsigned int spillSize = 0;
9368-
expandSpillFillIntrinsics(spillSize);
9368+
expandSpillFillIntrinsics();
93699369
if (builder.getOption(vISA_verifyLinearScan))
93709370
{
93719371
resetGlobalRAStates();
@@ -9423,10 +9423,10 @@ int GlobalRA::coloringRegAlloc()
94239423
unsigned iterationNo = 0;
94249424

94259425
int globalScratchOffset = kernel.getInt32KernelAttr(Attributes::ATTR_SpillMemOffset);
9426-
bool useScratchMsgForSpill = !hasStackCall && (globalScratchOffset < (int)(SCRATCH_MSG_LIMIT * 0.6)
9427-
);
9426+
bool useScratchMsgForSpill = globalScratchOffset < (int) (SCRATCH_MSG_LIMIT * 0.6) && !hasStackCall;
94289427
bool enableSpillSpaceCompression = builder.getOption(vISA_SpillSpaceCompression);
94299428

9429+
94309430
uint32_t nextSpillOffset = 0;
94319431
uint32_t scratchOffset = 0;
94329432

@@ -9674,7 +9674,6 @@ int GlobalRA::coloringRegAlloc()
96749674
bool success = spillGRF.insertSpillFillCode(&kernel, pointsToAnalysis);
96759675
nextSpillOffset = spillGRF.getNextOffset();
96769676

9677-
96789677
if (builder.getOption(vISA_RATrace))
96799678
{
96809679
std::cout << "\t--# variables spilled: " << coloring.getSpilledLiveRanges().size() << "\n";
@@ -9738,7 +9737,7 @@ int GlobalRA::coloringRegAlloc()
97389737
regChart->dumpRegChart(std::cerr);
97399738
}
97409739

9741-
expandSpillFillIntrinsics(nextSpillOffset);
9740+
expandSpillFillIntrinsics();
97429741

97439742
if (builder.getOption(vISA_OptReport))
97449743
{

visa/GraphColor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ namespace vISA
753753
void fixAlignment();
754754
void expandSpillIntrinsic(G4_BB*);
755755
void expandFillIntrinsic(G4_BB*);
756-
void expandSpillFillIntrinsics(unsigned int);
756+
void expandSpillFillIntrinsics();
757757

758758
RAVarInfo defaultValues;
759759
std::vector<RAVarInfo> vars;

visa/SpillCleanup.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,8 @@ bool CoalesceSpillFills::fillHeuristic(std::list<INST_LIST_ITER>& coalesceableFi
300300
}
301301

302302
min = 0xffffffff, max = 0;
303-
G4_Declare* header = (*coalesceableFills.front())->asFillIntrinsic()->getHeader()->getTopDcl();
304303
for (auto f : coalesceableFills)
305304
{
306-
if ((*f)->asFillIntrinsic()->getHeader()->getTopDcl() != header)
307-
return false;
308-
309305
unsigned int scratchOffset, scratchSize;
310306
getScratchMsgInfo(*f, scratchOffset, scratchSize);
311307

@@ -542,17 +538,9 @@ void CoalesceSpillFills::keepConsecutiveSpills(std::list<INST_LIST_ITER>& instLi
542538
if (sendDstDcl.find(sendDstTopDcl) != sendDstDcl.end())
543539
firstSpillFromSend = true;
544540

545-
G4_Declare* header = (*instList.front())->asSpillIntrinsic()->getHeader()->getTopDcl();
546-
547541
for (auto instIt : instList)
548542
{
549543
auto inst = (*instIt);
550-
551-
if (inst->asSpillIntrinsic()->getHeader()->getTopDcl() != header)
552-
{
553-
return;
554-
}
555-
556544
useNoMask &= inst->isWriteEnableInst();
557545

558546
if (!useNoMask)

visa/SpillManagerGMRF.cpp

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,10 +2586,8 @@ SpillManagerGRF::createSpillSendInstr (
25862586
messageDescImm =
25872587
createSpillSendMsgDesc(spillOff, height, execSize, rvar->getBaseRegVar());
25882588
#ifdef _DEBUG
2589-
{
2590-
int offset = (messageDescImm->getInt() & 0xFFF) * numEltPerGRF(Type_UB);
2591-
MUST_BE_TRUE(offset >= globalScratchOffset, "incorrect offset");
2592-
}
2589+
int offset = (messageDescImm->getInt() & 0xFFF) * numEltPerGRF(Type_UB);
2590+
MUST_BE_TRUE(offset >= globalScratchOffset, "incorrect offset");
25932591
#endif
25942592
}
25952593
else
@@ -2608,8 +2606,7 @@ SpillManagerGRF::createSpillSendInstr (
26082606

26092607
auto off = G4_SpillIntrinsic::InvalidOffset;
26102608
G4_Declare* fp = nullptr;
2611-
if (useScratchMsg_
2612-
)
2609+
if (useScratchMsg_)
26132610
off = (messageDescImm->getInt() & 0xfff);
26142611
else
26152612
{
@@ -2624,9 +2621,6 @@ SpillManagerGRF::createSpillSendInstr (
26242621
off = (offset + spillOff * getGRFSize()) >> SCRATCH_SPACE_ADDRESS_UNIT;
26252622
if (builder_->kernel.fg.getIsStackCallFunc() || builder_->kernel.fg.getHasStackCalls())
26262623
fp = builder_->kernel.fg.getFramePtrDcl();
2627-
2628-
if (!fp && offset < SCRATCH_MSG_LIMIT)
2629-
headerOpnd = builder_->Create_Src_Opnd_From_Dcl(builder_->getBuiltinR0(), builder_->getRegionStride1());
26302624
}
26312625
}
26322626
sendInst = builder_->createSpill(postDst, headerOpnd, srcOpnd, execSize, height, off, fp, InstOpt_WriteEnable);
@@ -2656,8 +2650,7 @@ SpillManagerGRF::createSpillSendInstr (
26562650
)
26572651
{
26582652
#ifdef _DEBUG
2659-
if (useScratchMsg_
2660-
)
2653+
if (useScratchMsg_)
26612654
{
26622655
G4_Imm* messageDescImm =
26632656
createSpillSendMsgDesc(spilledRangeRegion, execSize);
@@ -2678,8 +2671,7 @@ SpillManagerGRF::createSpillSendInstr (
26782671

26792672
auto off = G4_SpillIntrinsic::InvalidOffset;
26802673
G4_Declare* fp = nullptr;
2681-
if (useScratchMsg_
2682-
)
2674+
if (useScratchMsg_)
26832675
{
26842676
G4_Imm* messageDescImm =
26852677
createSpillSendMsgDesc(spilledRangeRegion, execSize);
@@ -2699,9 +2691,6 @@ SpillManagerGRF::createSpillSendInstr (
26992691
off = (offset + regOff * getGRFSize()) >> SCRATCH_SPACE_ADDRESS_UNIT;
27002692
if (builder_->kernel.fg.getIsStackCallFunc() || builder_->kernel.fg.getHasStackCalls())
27012693
fp = builder_->kernel.fg.getFramePtrDcl();
2702-
2703-
if (!fp && offset < SCRATCH_MSG_LIMIT)
2704-
headerOpnd = builder_->Create_Src_Opnd_From_Dcl(builder_->getBuiltinR0(), builder_->getRegionStride1());
27052694
}
27062695
}
27072696
sendInst = builder_->createSpill(postDst, headerOpnd, srcOpnd, execSize, (uint16_t)extMsgLength,
@@ -2915,10 +2904,8 @@ SpillManagerGRF::createFillSendInstr (
29152904
messageDescImm =
29162905
createFillSendMsgDesc (spillOff, height, execSize, rvar->getBaseRegVar());
29172906
#ifdef _DEBUG
2918-
{
2919-
int offset = (messageDescImm->getInt() & 0xFFF) * numEltPerGRF(Type_UB);
2920-
MUST_BE_TRUE(offset >= globalScratchOffset, "incorrect offset");
2921-
}
2907+
int offset = (messageDescImm->getInt() & 0xFFF) * numEltPerGRF(Type_UB);
2908+
MUST_BE_TRUE(offset >= globalScratchOffset, "incorrect offset");
29222909
#endif
29232910
}
29242911
else
@@ -2935,8 +2922,7 @@ SpillManagerGRF::createFillSendInstr (
29352922

29362923
unsigned int off = G4_FillIntrinsic::InvalidOffset;
29372924
G4_Declare* fp = nullptr;
2938-
if (useScratchMsg_
2939-
)
2925+
if (useScratchMsg_)
29402926
off = (messageDescImm->getInt() & 0xfff);
29412927
else
29422928
{
@@ -2952,9 +2938,6 @@ SpillManagerGRF::createFillSendInstr (
29522938
off = (offset + spillOff * getGRFSize()) >> SCRATCH_SPACE_ADDRESS_UNIT;
29532939
if (builder_->kernel.fg.getIsStackCallFunc() || builder_->kernel.fg.getHasStackCalls())
29542940
fp = builder_->kernel.fg.getFramePtrDcl();
2955-
2956-
if (!fp && offset < SCRATCH_MSG_LIMIT)
2957-
payload = builder_->Create_Src_Opnd_From_Dcl(builder_->getBuiltinR0(), builder_->getRegionStride1());
29582941
}
29592942
}
29602943
auto fillInst = builder_->createFill(payload, postDst, execSize, height, off, fp, InstOpt_WriteEnable);
@@ -2990,8 +2973,7 @@ SpillManagerGRF::createFillSendInstr(
29902973
unsigned int off = G4_FillIntrinsic::InvalidOffset;
29912974
unsigned segmentByteSize = getSegmentByteSize(filledRangeRegion, oldExecSize);
29922975
G4_Declare* fp = nullptr;
2993-
if (useScratchMsg_
2994-
)
2976+
if (useScratchMsg_)
29952977
{
29962978
G4_Imm* messageDescImm =
29972979
createFillSendMsgDesc(filledRangeRegion, oldExecSize);
@@ -3013,9 +2995,6 @@ SpillManagerGRF::createFillSendInstr(
30132995
off = offset >> SCRATCH_SPACE_ADDRESS_UNIT;
30142996
if (builder_->kernel.fg.getIsStackCallFunc() || builder_->kernel.fg.getHasStackCalls())
30152997
fp = builder_->kernel.fg.getFramePtrDcl();
3016-
3017-
if (!fp && offset < SCRATCH_MSG_LIMIT)
3018-
payload = builder_->Create_Src_Opnd_From_Dcl(builder_->getBuiltinR0(), builder_->getRegionStride1());
30192998
}
30202999
}
30213000

@@ -4255,10 +4234,6 @@ void GlobalRA::expandSpillNonStackcall(
42554234
G4_SrcRegRegion* headerOpnd = builder->Create_Src_Opnd_From_Dcl(builder->getBuiltinR0(), region);
42564235
G4_Imm* extDesc = builder->createImm(msgDesc->getExtendedDesc(), Type_UD);
42574236
G4_ExecSize execSize = inst->getExecSize(); // numRows > 1 ? 16 : 8;
4258-
if (execSize < g4::SIMD8)
4259-
execSize = g4::SIMD8;
4260-
else if (execSize < g4::SIMD16 && numRows > 1)
4261-
execSize = g4::SIMD16;
42624237

42634238
auto sendInst = builder->createInternalSplitSendInst(nullptr, G4_sends, execSize,
42644239
inst->getDst(), headerOpnd, payloadToUse, msgDescImm,
@@ -4586,10 +4561,8 @@ void GlobalRA::expandFillIntrinsic(G4_BB* bb)
45864561
}
45874562

45884563

4589-
void GlobalRA::expandSpillFillIntrinsics(unsigned int spillSizeInBytes)
4564+
void GlobalRA::expandSpillFillIntrinsics()
45904565
{
4591-
auto globalScratchOffset = kernel.getInt32KernelAttr(Attributes::ATTR_SpillMemOffset);
4592-
45934566
for (auto bb : kernel.fg)
45944567
{
45954568
expandSpillIntrinsic(bb);

visa/include/VISAOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ DEF_VISA_OPTION(vISA_LocalBankConflictReduction, ET_BOOL, "-nolocalBCR", UNUSE
105105
DEF_VISA_OPTION(vISA_FailSafeRA, ET_BOOL, "-nofailsafera", UNUSED, true)
106106
DEF_VISA_OPTION(vISA_FlagSpillCodeCleanup, ET_BOOL, "-disableFlagSpillClean", UNUSED, true)
107107
DEF_VISA_OPTION(vISA_GRFSpillCodeCleanup, ET_BOOL, NULLSTR, UNUSED, true)
108-
DEF_VISA_OPTION(vISA_SpillSpaceCompression, ET_BOOL, "-nospillcompression", UNUSED, true)
108+
DEF_VISA_OPTION(vISA_SpillSpaceCompression, ET_BOOL, NULLSTR, UNUSED, true)
109109
DEF_VISA_OPTION(vISA_ConsiderLoopInfoInRA, ET_BOOL, "-noloopra", UNUSED, true)
110110
DEF_VISA_OPTION(vISA_ReserveR0, ET_BOOL, "-reserveR0", UNUSED, false)
111111
DEF_VISA_OPTION(vISA_SpiltLLR, ET_BOOL, "-nosplitllr", UNUSED, true)

0 commit comments

Comments
 (0)