@@ -2770,56 +2770,6 @@ void GlobalRA::getBankAlignment(LiveRange *lr, BankAlign &align) {
2770
2770
}
2771
2771
}
2772
2772
2773
- // Compute homeFunc for dcl. Following rules are used:
2774
- // 1. A variable that's defined or used in a single function has
2775
- // that function as its home function.
2776
- // 2. A variable that's defined or used across functions (eg,
2777
- // args, retval) have their home function set to nullptr.
2778
- // 3. homeFunc is set only on root G4_Declare.
2779
- FuncInfo *Augmentation::computeHomeFunc (G4_Declare *dcl) {
2780
- vISA_ASSERT (!dcl->getAliasDeclare (), " root dcl expected" );
2781
- // If there are no subroutines then all dcls have kernel as home function
2782
- if (!hasSubroutines)
2783
- return kernel.fg .kernelInfo ;
2784
-
2785
- if (hasUniqueFuncHome (dcl))
2786
- return getUniqueFuncHome (dcl);
2787
-
2788
- FuncInfo *homeFunction = nullptr ;
2789
- // Live-ins to kernel are modeled as being implicitly defined in kernel.
2790
- if (dcl->isInput ())
2791
- homeFunction = kernel.fg .kernelInfo ;
2792
- auto *defs = refs.getDefs (dcl);
2793
- if (defs) {
2794
- for (auto &def : *defs) {
2795
- auto *bb = std::get<1 >(def);
2796
- auto *curDefFunc = bbToFunc.at (bb);
2797
- if (!homeFunction) {
2798
- homeFunction = curDefFunc;
2799
- continue ;
2800
- } else if (homeFunction != curDefFunc) {
2801
- return nullptr ;
2802
- }
2803
- }
2804
- }
2805
-
2806
- auto *uses = refs.getUses (dcl);
2807
- if (uses) {
2808
- for (auto &use : *uses) {
2809
- auto *bb = std::get<1 >(use);
2810
- auto *curUseFunc = bbToFunc.at (bb);
2811
- if (!homeFunction) {
2812
- homeFunction = curUseFunc;
2813
- continue ;
2814
- } else if (homeFunction != curUseFunc) {
2815
- return nullptr ;
2816
- }
2817
- }
2818
- }
2819
-
2820
- return homeFunction;
2821
- }
2822
-
2823
2773
void Augmentation::populateFuncMaps () {
2824
2774
vISA_ASSERT (kernel.fg .getBBList ().back ()->size () > 0 , " last BB empty" );
2825
2775
instToFunc.resize (kernel.fg .getBBList ().back ()->back ()->getLexicalId () + 1 );
@@ -2833,24 +2783,10 @@ void Augmentation::populateFuncMaps() {
2833
2783
}
2834
2784
}
2835
2785
2836
- void Augmentation::populateHomeFunc () {
2837
- // Assume last G4_Declare has max declId
2838
- homeFunc.resize (kernel.Declares .back ()->getDeclId () + 1 );
2839
- for (auto dcl : kernel.Declares ) {
2840
- if (dcl->getAliasDeclare ())
2841
- dcl = dcl->getRootDeclare ();
2842
- auto *func = computeHomeFunc (dcl);
2843
- vISA_ASSERT (!hasUniqueFuncHome (dcl) || getUniqueFuncHome (dcl) == func,
2844
- " different home func set" );
2845
- homeFunc[dcl->getDeclId ()] = func;
2846
- }
2847
- }
2848
-
2849
2786
Augmentation::Augmentation (Interference &i, const LivenessAnalysis &l,
2850
2787
GlobalRA &g)
2851
2788
: kernel(g.kernel), intf(i), gra(g), liveAnalysis(l), lrs(g.incRA.getLRs()),
2852
- fcallRetMap(g.fcallRetMap),
2853
- refs(g.kernel, false , false , true , &g.pointsToAnalysis),
2789
+ fcallRetMap(g.fcallRetMap), refs(g.kernel, false , false , true ),
2854
2790
hasSubroutines(kernel.fg.sortedFuncTable.size() > 0 &&
2855
2791
g.kernel.getOption(vISA_NewAugmentation)) {
2856
2792
useGenericAugAlign =
@@ -3877,16 +3813,6 @@ void Augmentation::buildUnknownArgRetval() {
3877
3813
}
3878
3814
}
3879
3815
3880
- bool Augmentation::hasUniqueFuncHome (G4_Declare *dcl) const {
3881
- auto *homeFunction = homeFunc[dcl->getDeclId ()];
3882
- return homeFunction != nullptr ;
3883
- }
3884
-
3885
- FuncInfo* Augmentation::getUniqueFuncHome (G4_Declare* dcl) const {
3886
- vISA_ASSERT (hasUniqueFuncHome (dcl), " expecting unique home func" );
3887
- return homeFunc[dcl->getDeclId ()];
3888
- }
3889
-
3890
3816
void Augmentation::startIntervalForLiveIn (FuncInfo *funcInfo, G4_BB *bb) {
3891
3817
// Start live-in intervals
3892
3818
auto liveInBB = liveAnalysis.getLiveAtEntry (bb) & liveAnalysis.globalVars ;
@@ -3895,9 +3821,6 @@ void Augmentation::startIntervalForLiveIn(FuncInfo *funcInfo, G4_BB *bb) {
3895
3821
if (isUnknownArgOrRetval (dcl))
3896
3822
continue ;
3897
3823
3898
- if (hasUniqueFuncHome (dcl) && getUniqueFuncHome (dcl) != funcInfo)
3899
- continue ;
3900
-
3901
3824
vISA_ASSERT (bb->size () > 0 , " empty instlist" );
3902
3825
vISA_ASSERT (funcInfo == kernel.fg .kernelInfo ||
3903
3826
argsPerSub.count (funcInfo) > 0 ||
@@ -4099,7 +4022,7 @@ void Augmentation::handlePred(FuncInfo* funcInfo, G4_INST *inst) {
4099
4022
}
4100
4023
}
4101
4024
4102
- void Augmentation::endIntervalForLiveOut (FuncInfo* funcInfo, G4_BB *bb) {
4025
+ void Augmentation::endIntervalForLiveOut (G4_BB *bb) {
4103
4026
auto liveOutBB = liveAnalysis.getLiveAtExit (bb) & liveAnalysis.globalVars ;
4104
4027
if (bb->isEndWithCall () && liveAnalysis.livenessClass (G4_GRF)) {
4105
4028
// reset bit for RET__loc as we handle it specially later to
@@ -4127,10 +4050,6 @@ void Augmentation::endIntervalForLiveOut(FuncInfo* funcInfo, G4_BB *bb) {
4127
4050
G4_Declare *dcl = lrs[i]->getDcl ()->getRootDeclare ();
4128
4051
if (isUnknownArgOrRetval (dcl))
4129
4052
continue ;
4130
-
4131
- if (hasUniqueFuncHome (dcl) && getUniqueFuncHome (dcl) != funcInfo)
4132
- continue ;
4133
-
4134
4053
vISA_ASSERT (bb->size () > 0 , " empty instlist" );
4135
4054
updateEndInterval (dcl, bb->back ());
4136
4055
}
@@ -4160,7 +4079,7 @@ void Augmentation::handleNonReducibleExtension(FuncInfo *funcInfo) {
4160
4079
}
4161
4080
}
4162
4081
for (auto exitBB : SCCSucc) {
4163
- extendVarLiveness (funcInfo, exitBB, headBB->front ());
4082
+ extendVarLiveness (exitBB, headBB->front ());
4164
4083
}
4165
4084
}
4166
4085
}
@@ -4199,7 +4118,7 @@ void Augmentation::handleLoopExtension(FuncInfo *funcInfo) {
4199
4118
std::cout << " ==> Extend live-in for BB" << exitBB->getId () << " \n " ;
4200
4119
exitBB->emit (std::cout);
4201
4120
});
4202
- extendVarLiveness (funcInfo, exitBB, startInst);
4121
+ extendVarLiveness (exitBB, startInst);
4203
4122
}
4204
4123
}
4205
4124
}
@@ -4214,10 +4133,6 @@ void Augmentation::handleLoopExtension(FuncInfo *funcInfo) {
4214
4133
4215
4134
for (auto i : globalsLiveInAndLiveOut) {
4216
4135
auto *dcl = lrs[i]->getDcl ()->getRootDeclare ();
4217
- // If dcl has non-nullptr home function then extend liveness only
4218
- // in same function.
4219
- if (hasUniqueFuncHome (dcl) && getUniqueFuncHome (dcl) != funcInfo)
4220
- continue ;
4221
4136
4222
4137
updateEndInterval (dcl, endBB->back ());
4223
4138
VISA_DEBUG_VERBOSE ({
@@ -4235,16 +4150,11 @@ void Augmentation::handleLoopExtension(FuncInfo *funcInfo) {
4235
4150
}
4236
4151
4237
4152
// Extend all variables that are live at bb entry to the given inst
4238
- void Augmentation::extendVarLiveness (FuncInfo *funcInfo, G4_BB *bb,
4239
- G4_INST *inst) {
4153
+ void Augmentation::extendVarLiveness (G4_BB *bb, G4_INST *inst) {
4240
4154
auto liveAtEntryBB =
4241
4155
liveAnalysis.getLiveAtEntry (bb) & liveAnalysis.globalVars ;
4242
4156
for (auto i : liveAtEntryBB) {
4243
4157
G4_Declare *dcl = lrs[i]->getDcl ()->getRootDeclare ();
4244
- // If dcl has non-nullptr home function then extend liveness only
4245
- // in same function.
4246
- if (hasUniqueFuncHome (dcl) && getUniqueFuncHome (dcl) != funcInfo)
4247
- continue ;
4248
4158
4249
4159
if (!kernel.fg .isPseudoDcl (dcl)) {
4250
4160
// Extend ith live-interval
@@ -4271,7 +4181,7 @@ void Augmentation::buildLiveIntervals(FuncInfo* funcInfo) {
4271
4181
for (G4_BB *curBB : funcInfo->getBBList ()) {
4272
4182
if (!curBB->empty ()) {
4273
4183
startIntervalForLiveIn (funcInfo, curBB);
4274
- endIntervalForLiveOut (funcInfo, curBB);
4184
+ endIntervalForLiveOut (curBB);
4275
4185
}
4276
4186
4277
4187
for (G4_INST *inst : *curBB) {
@@ -5131,8 +5041,6 @@ void Augmentation::discoverRetVal(FuncInfo *func) {
5131
5041
retValPerSub[func].insert (dcl);
5132
5042
if (retValInfo.subroutines .size () > 1 )
5133
5043
retValInfo.retValType = RetValType::Unknown;
5134
- vISA_ASSERT (!hasUniqueFuncHome (dcl),
5135
- " retval cannot have non-nullptr home function" );
5136
5044
}
5137
5045
5138
5046
if (kernel.getOption (vISA_VerifyAugmentation)) {
@@ -5149,8 +5057,7 @@ void Augmentation::discoverArgs(FuncInfo *func) {
5149
5057
5150
5058
SparseBitVector subArgs;
5151
5059
if (func == kernel.fg .kernelInfo )
5152
- subArgs = liveAnalysis.use_in [kernel.fg .getEntryBB ()->getId ()] &
5153
- liveAnalysis.def_in [kernel.fg .getEntryBB ()->getId ()];
5060
+ subArgs = liveAnalysis.use_in [kernel.fg .getEntryBB ()->getId ()];
5154
5061
else
5155
5062
subArgs = liveAnalysis.args .at (func);
5156
5063
@@ -5167,10 +5074,6 @@ void Augmentation::discoverArgs(FuncInfo *func) {
5167
5074
if (argInfo.subroutines .size () > 1 &&
5168
5075
argInfo.argType == ArgType::DefBeforeEachCall)
5169
5076
argInfo.argType = ArgType::Unknown;
5170
- vISA_ASSERT (
5171
- argInfo.argType != ArgType::DefBeforeEachCall ||
5172
- !hasUniqueFuncHome (dcl),
5173
- " def before each call arg cannot have non-nullptr home function" );
5174
5077
}
5175
5078
5176
5079
@@ -5210,16 +5113,6 @@ void Augmentation::dumpSortedIntervals() {
5210
5113
std::cout << " (LiveThroughArg)" ;
5211
5114
else if (isRegularRetVal (dcl))
5212
5115
std::cout << " (RegularRetVal)" ;
5213
- if (dcl->getDeclId () >= homeFunc.size ()) {
5214
- std::cout << " @ (new var)" ;
5215
- }
5216
- else {
5217
- auto *homeFunction = homeFunc[dcl->getDeclId ()];
5218
- if (!homeFunction)
5219
- std::cout << " @ (global)" ;
5220
- else
5221
- std::cout << " @ (func " << (int )homeFunction->getId () << " )" ;
5222
- }
5223
5116
std::cout << " - (" << gra.getIntervalStart (interval)->getLexicalId ()
5224
5117
<< " , " << gra.getIntervalEnd (interval)->getLexicalId () << " ]" ;
5225
5118
if (intervalsPerVar[dcl].size () > 1 ) {
@@ -5679,17 +5572,16 @@ void Augmentation::augmentIntfGraph() {
5679
5572
bool nonDefaultMaskDef = markNonDefaultMaskDef ();
5680
5573
5681
5574
if (nonDefaultMaskDef == true ) {
5682
- if (augWithHoles) {
5683
- if (kernel.fg .getNumFuncs () > 0 )
5684
- populateFuncMaps ();
5685
-
5686
- populateHomeFunc ();
5575
+ if (augWithHoles && kernel.fg .getNumFuncs () > 0 )
5576
+ populateFuncMaps ();
5687
5577
5578
+ if (augWithHoles) {
5688
5579
// Atleast one definition with non-default mask was found so
5689
5580
// perform steps to augment intf graph with such defs
5690
5581
5691
5582
// Discover and store subroutine arguments
5692
5583
if (hasSubroutines) {
5584
+
5693
5585
for (auto &subroutine : kernel.fg .sortedFuncTable ) {
5694
5586
discoverArgs (subroutine);
5695
5587
discoverRetVal (subroutine);
0 commit comments