Skip to content

Commit 6329a15

Browse files
bcheng0127igcbot
authored andcommitted
Changes in code.
1 parent 0b3b137 commit 6329a15

File tree

17 files changed

+125
-189
lines changed

17 files changed

+125
-189
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,11 +4308,6 @@ namespace IGC
43084308
SaveOption(vISA_Compaction, false);
43094309
}
43104310

4311-
if (IGC_IS_FLAG_ENABLED(EnableGatherWithImm))
4312-
{
4313-
SaveOption(vISA_EnableGatherWithImm, true);
4314-
}
4315-
43164311
if (IGC_IS_FLAG_ENABLED(EnableGroupScheduleForBC))
43174312
{
43184313
SaveOption(vISA_EnableGroupScheduleForBC, true);

IGC/common/igc_flags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ DECLARE_IGC_REGKEY(bool, EnableIGASWSB, false, "Use IGA for SWS
6666
DECLARE_IGC_REGKEY(bool, EnableSWSBStitch, false, "Insert dependence resolve for kernel stitching", true)
6767
DECLARE_IGC_REGKEY(bool, DisableRegDistDep, false, "distable regDist dependence", true)
6868
DECLARE_IGC_REGKEY(bool, EnableQuickTokenAlloc, false, "Insert dependence resolve for kernel stitching", true)
69-
DECLARE_IGC_REGKEY(bool, EnableGatherWithImm, false, "enable gather send with immediate", true)
7069
DECLARE_IGC_REGKEY(bool, SetA0toTdrForSendc, false, "Set A0 to tdr0 before each sendc/sendsc", true)
7170
DECLARE_IGC_REGKEY(bool, ReplaceIndirectCallWithJmpi, false, "Replace indirect call with jmpi instruction (HW WA)", true)
7271
DECLARE_IGC_REGKEY(bool, AssumeUniformIndirectCall, false, "Assume indirect call is uniform to avoid looping code", false)

visa/BuildIRImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ bool IR_Builder::isOpndAligned(
229229
else if (opnd->getKind() == G4_Operand::dstRegRegion &&
230230
// Only care about GRF or half-GRF alignment.
231231
(align_byte == numEltPerGRF<Type_UB>() || align_byte == numEltPerGRF<Type_UB>() / 2) &&
232-
dcl && (dcl->getRegFile() == G4_ADDRESS))
232+
dcl && dcl->getRegFile() == G4_ADDRESS)
233233
{
234234

235235
// Get the single definition of the specified operand from the use

visa/GraphColor.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,11 +2268,11 @@ void Interference::markInterferenceToAvoidDstSrcOverlap(G4_BB* bb,
22682268
{
22692269
// make every var in points-to set live
22702270
const REGVAR_VECTOR& pointsToSet = liveAnalysis->getPointsToAnalysis().getAllInPointsToOrIndrUse(srcRgn, bb);
2271-
for (auto pt : pointsToSet)
2271+
for (auto var : pointsToSet)
22722272
{
2273-
if (pt.var->isRegAllocPartaker())
2273+
if (var->isRegAllocPartaker())
22742274
{
2275-
unsigned srcId = pt.var->getId();
2275+
unsigned srcId = var->getId();
22762276
if (isDstRegAllocPartaker)
22772277
{
22782278
if (!varSplitCheckBeforeIntf(dstId, srcId))
@@ -2395,11 +2395,11 @@ void Interference::buildInterferenceForDst(G4_BB* bb, BitSet& live, G4_INST* ins
23952395
// add interferences to the list of potential indirect destination accesses.
23962396
//
23972397
const REGVAR_VECTOR& pointsToSet = liveAnalysis->getPointsToAnalysis().getAllInPointsToOrIndrUse(dst, bb);
2398-
for (auto pt : pointsToSet)
2398+
for (auto var : pointsToSet)
23992399
{
2400-
if (pt.var->isRegAllocPartaker())
2400+
if (var->isRegAllocPartaker())
24012401
{
2402-
buildInterferenceWithLive(live, pt.var->getId());
2402+
buildInterferenceWithLive(live, var->getId());
24032403
}
24042404
}
24052405
}
@@ -2559,11 +2559,11 @@ void Interference::buildInterferenceWithinBB(G4_BB* bb, BitSet& live)
25592559
{
25602560
// make every var in points-to set live
25612561
const REGVAR_VECTOR& pointsToSet = liveAnalysis->getPointsToAnalysis().getAllInPointsToOrIndrUse(srcRegion, bb);
2562-
for (auto pt : pointsToSet)
2562+
for (auto var : pointsToSet)
25632563
{
2564-
if (pt.var->isRegAllocPartaker())
2564+
if (var->isRegAllocPartaker())
25652565
{
2566-
updateLiveness(live, pt.var->getId(), true);
2566+
updateLiveness(live, var->getId(), true);
25672567
}
25682568
}
25692569
}
@@ -4252,9 +4252,9 @@ void Augmentation::buildLiveIntervals()
42524252
const REGVAR_VECTOR& pointsToSet = liveAnalysis.getPointsToAnalysis().getAllInPointsToOrIndrUse(srcRegion, curBB);
42534253
for (auto pointsToVar : pointsToSet)
42544254
{
4255-
if (pointsToVar.var->isRegAllocPartaker())
4255+
if (pointsToVar->isRegAllocPartaker())
42564256
{
4257-
updateEndInterval(pointsToVar.var->getDeclare()->getRootDeclare(), inst);
4257+
updateEndInterval(pointsToVar->getDeclare()->getRootDeclare(), inst);
42584258
}
42594259
}
42604260
}
@@ -6848,7 +6848,7 @@ void GlobalRA::determineSpillRegSize(unsigned& spillRegSize, unsigned& indrSpill
68486848
}
68496849
else
68506850
{
6851-
ORG_REGVAR_VECTOR indrVars;
6851+
REGVAR_VECTOR indrVars;
68526852

68536853
unsigned dstSpillRegSize = 0;
68546854
unsigned indrDstSpillRegSize = 0;
@@ -6889,13 +6889,13 @@ void GlobalRA::determineSpillRegSize(unsigned& spillRegSize, unsigned& indrSpill
68896889
auto pointsToSet = pointsToAnalysis.getAllInPointsTo(dst->getBase()->asRegVar());
68906890
if (pointsToSet != nullptr)
68916891
{
6892-
for (auto pt : *pointsToSet)
6892+
for (auto var : *pointsToSet)
68936893
{
6894-
if (pt.var->isRegAllocPartaker() ||
6895-
((builder.getOption(vISA_HybridRAWithSpill) || builder.getOption(vISA_FastCompileRA)) && livenessCandidate(pt.var->getDeclare())))
6894+
if (var->isRegAllocPartaker() ||
6895+
((builder.getOption(vISA_HybridRAWithSpill) || builder.getOption(vISA_FastCompileRA)) && livenessCandidate(var->getDeclare())))
68966896
{
6897-
indrVars.push_back(pt.var);
6898-
indrDstSpillRegSize += pt.var->getDeclare()->getNumRows();
6897+
indrVars.push_back(var);
6898+
indrDstSpillRegSize += var->getDeclare()->getNumRows();
68996899
}
69006900
}
69016901
}
@@ -6930,15 +6930,15 @@ void GlobalRA::determineSpillRegSize(unsigned& spillRegSize, unsigned& indrSpill
69306930
auto pointsToSet = pointsToAnalysis.getAllInPointsTo(src->asSrcRegRegion()->getBase()->asRegVar());
69316931
if (pointsToSet != nullptr)
69326932
{
6933-
for (auto pt : *pointsToSet)
6933+
for (auto var : *pointsToSet)
69346934
{
6935-
if (pt.var->isRegAllocPartaker() ||
6936-
((builder.getOption(vISA_HybridRAWithSpill) || builder.getOption(vISA_FastCompileRA)) && livenessCandidate(pt.var->getDeclare())))
6935+
if (var->isRegAllocPartaker() ||
6936+
((builder.getOption(vISA_HybridRAWithSpill) || builder.getOption(vISA_FastCompileRA)) && livenessCandidate(var->getDeclare())))
69376937
{
6938-
if (std::find(indrVars.begin(), indrVars.end(), pt.var) == indrVars.end())
6938+
if (std::find(indrVars.begin(), indrVars.end(), var) == indrVars.end())
69396939
{
6940-
indrVars.push_back(pt.var);
6941-
indirSrcFillRegSize += pt.var->getDeclare()->getNumRows();
6940+
indrVars.push_back(var);
6941+
indirSrcFillRegSize += var->getDeclare()->getNumRows();
69426942
}
69436943
}
69446944
}

visa/HWCaps.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ SPDX-License-Identifier: MIT
829829

830830
bool hasFiveALUPipes() const
831831
{
832-
return hasScalarRegister();
832+
return false;
833833
}
834834

835835
bool hasSrc2ReadSupression() const

visa/LinearScanRA.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,9 +1643,9 @@ void LinearScanRA::calculateCurrentBBLiveIntervals(G4_BB* bb, std::vector<LSLive
16431643
if (src->asSrcRegRegion()->isIndirect())
16441644
{
16451645
auto pointsToSet = l.getPointsToAnalysis().getAllInPointsTo(src->getBase()->asRegVar());
1646-
for (auto pt : *pointsToSet)
1646+
for (auto var : *pointsToSet)
16471647
{
1648-
G4_Declare* dcl = pt.var->getDeclare()->getRootDeclare();
1648+
G4_Declare* dcl = var->getDeclare()->getRootDeclare();
16491649

16501650
setSrcReferences(bb, inst_it, i, dcl, liveIntervals, eotLiveIntervals);
16511651
}
@@ -1669,9 +1669,9 @@ void LinearScanRA::calculateCurrentBBLiveIntervals(G4_BB* bb, std::vector<LSLive
16691669
if (dst->isIndirect())
16701670
{
16711671
auto pointsToSet = l.getPointsToAnalysis().getAllInPointsTo(dst->getBase()->asRegVar());
1672-
for (auto pt : *pointsToSet)
1672+
for (auto var : *pointsToSet)
16731673
{
1674-
G4_Declare* dcl = pt.var->getDeclare()->getRootDeclare();
1674+
G4_Declare* dcl = var->getDeclare()->getRootDeclare();
16751675

16761676
setDstReferences(bb, inst_it, dcl, liveIntervals, eotLiveIntervals);
16771677
}

visa/LocalScheduler/G4_Sched.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ struct RegisterPressure
340340
gra = new GlobalRA(kernel, kernel.fg.builder->phyregpool, *p2a);
341341
// To properly track liveness for partially-written local variables.
342342
gra->markGraphBlockLocalVars();
343-
liveness = new LivenessAnalysis(*gra, G4_GRF | G4_ADDRESS | G4_INPUT | G4_FLAG | G4_SCALAR);
343+
liveness = new LivenessAnalysis(*gra, G4_GRF | G4_ADDRESS | G4_INPUT | G4_FLAG);
344344
liveness->computeLiveness();
345345
rpe = new RPE(*gra, liveness);
346346
rpe->run();

visa/LocalScheduler/SWSB_G4IR.cpp

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,14 @@ SBFootprint* G4_BB_SB::getFootprintForFlag(G4_Operand* opnd,
458458
unsigned short LB = 0;
459459
unsigned short RB = 0;
460460
G4_Type type = opnd->getType();
461+
unsigned short bitToBytes = numEltPerGRF<Type_UB>() / 16;
461462
bool valid = true;
462463
unsigned subRegOff = opnd->getBase()->ExSubRegNum(valid);
463-
LB = (unsigned short)(opnd->getLeftBound() + subRegOff * 16) * FLAG_TO_GRF_MAP;
464-
RB = (unsigned short)(opnd->getRightBound() + subRegOff * 16) * FLAG_TO_GRF_MAP;
464+
LB = (unsigned short)(opnd->getLeftBound() + subRegOff * 16) * bitToBytes;
465+
RB = (unsigned short)(opnd->getRightBound() + subRegOff * 16) * bitToBytes;
465466

466-
LB += (builder.kernel.getNumRegTotal() + builder.getNumScalarRegisters() + builder.kernel.getNumAcc()) * numEltPerGRF<Type_UB>();
467-
RB += (builder.kernel.getNumRegTotal() + builder.getNumScalarRegisters() + builder.kernel.getNumAcc()) * numEltPerGRF<Type_UB>();
467+
LB += (builder.kernel.getNumRegTotal() + builder.kernel.getNumAcc()) * numEltPerGRF<Type_UB>();
468+
RB += (builder.kernel.getNumRegTotal() + builder.kernel.getNumAcc()) * numEltPerGRF<Type_UB>();
468469

469470
void* allocedMem = mem.alloc(sizeof(SBFootprint));
470471
SBFootprint* footprint = nullptr;
@@ -474,7 +475,6 @@ SBFootprint* G4_BB_SB::getFootprintForFlag(G4_Operand* opnd,
474475
return footprint;
475476
}
476477

477-
478478
static bool compareInterval(SBNode* n1, SBNode* n2)
479479
{
480480
return n1->getLiveStartID() < n2->getLiveStartID();
@@ -1256,8 +1256,8 @@ void SWSB::SWSBGenerator()
12561256
kernel.fg.findNaturalLoops();
12571257

12581258
//Note that getNumFlagRegisters() treat each 16 bits as a flag register
1259-
LiveGRFBuckets LB(mem, kernel.getNumRegTotal() + fg.builder->getNumScalarRegisters() + kernel.getNumAcc() + fg.builder->getNumFlagRegisters(), kernel);
1260-
LiveGRFBuckets globalSendsLB(mem, kernel.getNumRegTotal() + fg.builder->getNumScalarRegisters() + kernel.getNumAcc() + fg.builder->getNumFlagRegisters(), kernel);
1259+
LiveGRFBuckets LB(mem, kernel.getNumRegTotal() + kernel.getNumAcc() + fg.builder->getNumFlagRegisters(), kernel);
1260+
LiveGRFBuckets globalSendsLB(mem, kernel.getNumRegTotal() + kernel.getNumAcc() + fg.builder->getNumFlagRegisters(), kernel);
12611261

12621262
SWSBDepDistanceGenerator(p, LB, globalSendsLB);
12631263

@@ -3451,7 +3451,6 @@ bool SWSB::insertSyncXe(G4_BB* bb, SBNode* node, G4_INST* inst, INST_LIST_ITER i
34513451
synInst->setDistance(inst->getDistance());
34523452
synInst->setDistanceTypeXe(inst->getDistanceTypeXe());
34533453
inst->setDistance(0);
3454-
inst->setDistanceTypeXe(G4_INST::DistanceType::DIST_NONE);
34553454
insertedSync = true;
34563455
}
34573456
}
@@ -3470,7 +3469,6 @@ bool SWSB::insertSyncXe(G4_BB* bb, SBNode* node, G4_INST* inst, INST_LIST_ITER i
34703469
synInst->setDistance(inst->getDistance());
34713470
synInst->setDistanceTypeXe(inst->getDistanceTypeXe());
34723471
inst->setDistance(0);
3473-
inst->setDistanceTypeXe(G4_INST::DistanceType::DIST_NONE);
34743472
insertedSync = true;
34753473
}
34763474
}
@@ -3490,7 +3488,6 @@ bool SWSB::insertSyncXe(G4_BB* bb, SBNode* node, G4_INST* inst, INST_LIST_ITER i
34903488
synInst->setDistance(inst->getDistance());
34913489
synInst->setDistanceTypeXe(inst->getDistanceTypeXe());
34923490
inst->setDistance(0);
3493-
inst->setDistanceTypeXe(G4_INST::DistanceType::DIST_NONE);
34943491
insertedSync = true;
34953492
}
34963493
}
@@ -4423,7 +4420,6 @@ bool G4_BB_SB::getFootprintForOperand(SBNode* node,
44234420
}
44244421
}
44254422

4426-
44274423
return hasDistOneAReg;
44284424
}
44294425

@@ -4470,8 +4466,7 @@ void G4_BB_SB::getGRFFootprintForIndirect(SBNode* node,
44704466
G4_RegVar* ptvar = NULL;
44714467
int vid = 0;
44724468

4473-
unsigned char offset = 0;
4474-
while ((ptvar = p.getPointsTo(addrdcl->getRegVar(), vid++, offset)) != NULL)
4469+
while ((ptvar = p.getPointsTo(addrdcl->getRegVar(), vid++)) != NULL)
44754470
{
44764471

44774472
uint32_t varID = ptvar->getId();
@@ -4501,13 +4496,10 @@ void G4_BB_SB::getGRFFootprintForIndirect(SBNode* node,
45014496
uint32_t regNum = var->getPhyReg()->asGreg()->getRegNum();
45024497
uint32_t regOff = var->getPhyRegOff();
45034498

4504-
{
4505-
linearizedStart = regNum * numEltPerGRF<Type_UB>() + regOff * TypeSize(dcl->getElemType());
4506-
linearizedEnd = regNum * numEltPerGRF<Type_UB>() + regOff * TypeSize(dcl->getElemType()) + dcl->getByteSize() - 1;
4507-
}
4499+
linearizedStart = regNum * numEltPerGRF<Type_UB>() + regOff * TypeSize(dcl->getElemType());
4500+
linearizedEnd = regNum * numEltPerGRF<Type_UB>() + regOff * TypeSize(dcl->getElemType()) + dcl->getByteSize() - 1;
45084501
}
45094502

4510-
45114503
void* allocedMem = mem.alloc(sizeof(SBFootprint));
45124504
footprint = new (allocedMem)SBFootprint(GRF_T, type, (unsigned short)linearizedStart, (unsigned short)linearizedEnd, node->GetInstruction());
45134505
node->setFootprint(footprint, opnd_num);
@@ -4537,11 +4529,11 @@ void G4_BB_SB::getGRFBuckets(SBNode* node,
45374529
continue;
45384530
}
45394531

4532+
int aregOffset = totalGRFNum;
45404533
int startingBucket = curFootprint->LeftB / numEltPerGRF<Type_UB>();
45414534
int endingBucket = curFootprint->RightB / numEltPerGRF<Type_UB>();
45424535
if (curFootprint->fType == ACC_T)
45434536
{
4544-
int aregOffset = totalGRFNum + builder.getNumScalarRegisters();
45454537
startingBucket = startingBucket + aregOffset;
45464538
endingBucket = endingBucket + aregOffset;
45474539
}
@@ -5031,6 +5023,16 @@ bool G4_BB_SB::isLastDpas(SBNode* curNode, SBNode* nextNode)
50315023
return true;
50325024
}
50335025

5026+
void G4_BB_SB::pushItemToQueue(std::vector<unsigned> *nodeIDQueue, unsigned nodeID)
5027+
{
5028+
nodeIDQueue->push_back(nodeID);
5029+
5030+
if (nodeIDQueue->size() > SWSB_MAX_ALU_DEPENDENCE_DISTANCE_VALUE)
5031+
{
5032+
nodeIDQueue->erase(nodeIDQueue->begin());
5033+
}
5034+
}
5035+
50345036

50355037
void G4_BB_SB::SBDDD(G4_BB* bb,
50365038
LiveGRFBuckets*& LB,
@@ -5229,18 +5231,22 @@ void G4_BB_SB::SBDDD(G4_BB* bb,
52295231
{
52305232
case PIPE_INT:
52315233
node->setIntegerID(integerID);
5234+
pushItemToQueue(latestInstID[PIPE_INT], node->getNodeID());
52325235
integerID++;
52335236
break;
52345237
case PIPE_FLOAT:
52355238
node->setFloatID(floatID);
5239+
pushItemToQueue(latestInstID[PIPE_FLOAT], node->getNodeID());
52365240
floatID++;
52375241
break;
52385242
case PIPE_LONG:
52395243
node->setLongID(longID);
5244+
pushItemToQueue(latestInstID[PIPE_LONG], node->getNodeID());
52405245
longID++;
52415246
break;
52425247
case PIPE_MATH:
52435248
node->setMathID(mathID);
5249+
pushItemToQueue(latestInstID[PIPE_MATH], node->getNodeID());
52445250
mathID++;
52455251
break;
52465252
default:
@@ -5468,7 +5474,7 @@ void G4_BB_SB::SBDDD(G4_BB* bb,
54685474
if (distanceHonourInstruction(liveInst))
54695475
{
54705476
if (dep == RAW &&
5471-
(curBucket < (totalGRFNum + (int)builder.getNumScalarRegisters())))
5477+
curBucket < totalGRFNum)
54725478
{//Only need track GRF RAW dependence
54735479
LB->killOperand(bn_it);
54745480
setDistance(curFootprint, node, liveNode, false);
@@ -6073,17 +6079,21 @@ void SWSB::dumpTokenLiveInfo()
60736079
void G4_BB_SB::getLiveBucketsFromFootprint(const SBFootprint* firstFootprint, SBBucketNode* sBucketNode, LiveGRFBuckets* send_use_kills) const
60746080
{
60756081
const SBFootprint* footprint = firstFootprint;
6082+
int aregOffset = totalGRFNum;
60766083

60776084
while (footprint)
60786085
{
60796086
int startBucket = footprint->LeftB / numEltPerGRF<Type_UB>();
60806087
int endBucket = footprint->RightB / numEltPerGRF<Type_UB>();
6081-
6082-
//We only track the global dependence for GRF
6083-
if (footprint->fType != GRF_T)
6088+
if (footprint->fType == ACC_T)
60846089
{
6085-
footprint = footprint->next;
6086-
continue;
6090+
startBucket = startBucket + aregOffset;
6091+
endBucket = endBucket + aregOffset;
6092+
}
6093+
else if (footprint->fType == FLAG_T)
6094+
{
6095+
startBucket = footprint->LeftB + aregOffset + builder.kernel.getNumAcc();
6096+
endBucket = footprint->RightB + aregOffset + builder.kernel.getNumAcc();
60876097
}
60886098

60896099
for (int j = startBucket; j < endBucket + 1; j++)

0 commit comments

Comments
 (0)