@@ -370,55 +370,6 @@ void LivenessAnalysis::detectNeverDefinedVarRows() {
370370 }
371371}
372372
373- // #1 - (P166) sel (M1, 8) V2(0,0)<1> 0x1:d 0x0:d
374- // #2 - (W) mov(M1, 8) V1(0,0)<1> 0x0:ud
375- // #3 - (W) mov (M1, 1) V3 0x1:ud
376- // #4 - add (M1, 8) V1(0,0)<1> V2(0,0)<1;1,0> V3(0,0)<0;1,0>
377- //
378- // In above 3d program, V1 is written once using WriteEnable and and once without
379- // WriteEnable. A var must be treated as KILLED only for widest def. In this case,
380- // widest def of V1 is one with WriteEnable set. Although def of V1 in inst# 4
381- // writes all enabled channels, it may not be as wide as WriteEnable in inst#1.
382- // Marking #4 as KILL allows RA to use same register for V1 and V3 which can be
383- // incorrect if all but lowest channel are enabled. Because in this case lowest
384- // channel data would be overwritten by V3 def.
385- //
386- // In this method, we gather all variables written with WriteEnable and refer to
387- // this list when computing pseudo_kill. Note that WriteEnable takes effect only
388- // in divergent context. In other words, for ESIMD target, all channels are enabled
389- // at thread dispatch. Whereas for 3d, even entry BB is considered to be divergent.
390- void LivenessAnalysis::collectNoMaskVars () {
391- for (auto bb : gra.kernel .fg ) {
392- for (auto inst : *bb) {
393- if (!inst->isWriteEnableInst ())
394- continue ;
395-
396- auto inDivergentContext = [&]() {
397- // 3d is always in divergent context
398- // ESIMD is divergent only in BBs that are explicitly divergent
399- return fg.getKernel ()->getInt32KernelAttr (Attributes::ATTR_Target) ==
400- VISA_3D ||
401- !bb->isAllLaneActive ();
402- };
403-
404- G4_Operand *opnd = nullptr ;
405- if (livenessClass (G4_GRF))
406- opnd = inst->getDst ();
407- else if (livenessClass (G4_FLAG))
408- opnd = inst->getCondMod ();
409-
410- if (opnd && opnd->getBase () && opnd->getBase ()->isRegAllocPartaker () &&
411- inDivergentContext ()) {
412- defWriteEnable.insert (opnd->getTopDcl ());
413- }
414- }
415- }
416- }
417-
418- bool LivenessAnalysis::doesVarNeedNoMaskForKill (const G4_Declare* dcl) const {
419- return defWriteEnable.count (dcl) == 0 ? false : true ;
420- }
421-
422373//
423374// compute liveness of reg vars
424375// Each reg var indicates a region within the register file. As such, the case
@@ -498,7 +449,6 @@ void LivenessAnalysis::computeLiveness() {
498449 def_out[i].clear ();
499450 }
500451
501- collectNoMaskVars ();
502452 if (livenessClass (G4_GRF))
503453 detectNeverDefinedVarRows ();
504454
@@ -1161,9 +1111,6 @@ bool LivenessAnalysis::writeWholeRegion(const G4_BB *bb, const G4_INST *inst,
11611111 return false ;
11621112 }
11631113
1164- if (doesVarNeedNoMaskForKill (primaryDcl) && !inst->isWriteEnableInst ())
1165- return false ;
1166-
11671114 return true ;
11681115}
11691116
@@ -1193,8 +1140,7 @@ void LivenessAnalysis::footprintDst(const G4_BB *bb, const G4_INST *i,
11931140 BitSet *dstfootprint) const {
11941141 if (dstfootprint && !(i->isPartialWrite ()) &&
11951142 ((bb->isAllLaneActive () || i->isWriteEnableInst () == true ) ||
1196- (gra.kernel .getInt32KernelAttr (Attributes::ATTR_Target) == VISA_3D &&
1197- !doesVarNeedNoMaskForKill (opnd->getTopDcl ())))) {
1143+ gra.kernel .getInt32KernelAttr (Attributes::ATTR_Target) == VISA_3D)) {
11981144 // Bitwise OR left-bound/right-bound with dst footprint to indicate
11991145 // bytes that are written in to
12001146 opnd->updateFootPrint (*dstfootprint, true , *fg.builder );
0 commit comments