@@ -275,6 +275,15 @@ static bool isDclExclusiveLoad(const G4_Declare *declare1,
275
275
return declare1->isExclusiveLoad ();
276
276
}
277
277
278
+ static void checkAndRemoveDpasNode (SBNode *curLiveNode,
279
+ std::vector<SBNode *> &liveDPASNodes) {
280
+ auto dpasIt =
281
+ std::find (liveDPASNodes.begin (), liveDPASNodes.end (), curLiveNode);
282
+ if (dpasIt != liveDPASNodes.end ()) {
283
+ liveDPASNodes.erase (dpasIt);
284
+ }
285
+ }
286
+
278
287
bool SBFootprint::hasOverlap (const SBFootprint *liveFootprint,
279
288
unsigned short &internalOffset) const {
280
289
for (const SBFootprint *curFootprintPtr = this ; curFootprintPtr;
@@ -6796,6 +6805,7 @@ void G4_BB_SB::SBDDD(G4_BB *bb, LiveGRFBuckets *&LB,
6796
6805
mathID = indexes->mathIndex ;
6797
6806
first_DPASID = indexes->DPASIndex ;
6798
6807
SBNode *lastDpasNode = nullptr ;
6808
+ std::vector<SBNode *> liveDPASNodes; // Recording local live dpas nodes
6799
6809
6800
6810
for (int i = 0 ; i < PIPE_DPAS; i++) {
6801
6811
latestDepALUID[i] = indexes->latestDepALUID [i];
@@ -7089,6 +7099,7 @@ void G4_BB_SB::SBDDD(G4_BB *bb, LiveGRFBuckets *&LB,
7089
7099
node->setDPASID (DPASID);
7090
7100
DPASID += node->getDPASSize ();
7091
7101
lastDpasNode = node;
7102
+ liveDPASNodes.push_back (node);
7092
7103
}
7093
7104
7094
7105
// Get buckets for all GRF registers which are used in curInst
@@ -7143,6 +7154,13 @@ void G4_BB_SB::SBDDD(G4_BB *bb, LiveGRFBuckets *&LB,
7143
7154
}
7144
7155
}
7145
7156
7157
+ if (node->hasDistOneAreg ()) {
7158
+ for (auto dpasNode : liveDPASNodes) {
7159
+ createAddGRFEdge (dpasNode, node, RAW, DEP_EXPLICT);
7160
+ }
7161
+ liveDPASNodes.clear ();
7162
+ }
7163
+
7146
7164
if (BDvec.empty () && node->distDep .empty ()) {
7147
7165
if (ALUID >= SWSB_MAX_ALU_DEPENDENCE_DISTANCE &&
7148
7166
ALUID != node->getALUID ()) {
@@ -7275,6 +7293,9 @@ void G4_BB_SB::SBDDD(G4_BB *bb, LiveGRFBuckets *&LB,
7275
7293
tokenAfterDPASCycle)) {
7276
7294
LB->killOperand (bn_it);
7277
7295
createAddGRFEdge (liveNode, node, dep, DEP_EXPLICT);
7296
+ if (liveNode->getLastInstruction ()->isDpas ()) {
7297
+ checkAndRemoveDpasNode (liveNode, liveDPASNodes);
7298
+ }
7278
7299
liveNode->setInstKilled (true ); // Instruction level kill
7279
7300
instKill = true ;
7280
7301
continue ;
@@ -7286,6 +7307,9 @@ void G4_BB_SB::SBDDD(G4_BB *bb, LiveGRFBuckets *&LB,
7286
7307
} else {
7287
7308
LB->killOperand (bn_it);
7288
7309
createAddGRFEdge (liveNode, node, dep, DEP_EXPLICT);
7310
+ if (liveNode->getLastInstruction ()->isDpas ()) {
7311
+ checkAndRemoveDpasNode (liveNode, liveDPASNodes);
7312
+ }
7289
7313
liveNode->setInstKilled (true ); // Instruction level kill
7290
7314
instKill = true ;
7291
7315
continue ;
@@ -8100,10 +8124,14 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8100
8124
// the order of the operands are scanned is not an issue anymore.
8101
8125
// i.e explicit RAW and WAW can cover all other dependences.
8102
8126
// Only S0 and GRF regsiters can introduce global SBID dependence
8127
+ std::vector<SBNode *> liveDPASNodes; // Record live in dpas nodes
8103
8128
LiveGRFBuckets send_use_kills (globalRegisterNum);
8104
8129
for (unsigned i : send_kill.dst ) {
8105
8130
for (SBBucketNode *sBucketNode : globalDstSBSendNodes[i]) {
8106
8131
SBNode *sNode = sBucketNode ->node ;
8132
+ if (sNode ->getLastInstruction ()->isDpas ()) {
8133
+ liveDPASNodes.push_back (sNode );
8134
+ }
8107
8135
sb_bb->getLiveBucketsFromFootprint (sNode ->getFirstFootprint (Opnd_dst),
8108
8136
sBucketNode , &send_use_kills);
8109
8137
sNode ->setInstKilled (false );
@@ -8114,6 +8142,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8114
8142
for (unsigned i : send_kill.src ) {
8115
8143
for (SBBucketNode *sBucketNode : globalSrcSBSendNodes[i]) {
8116
8144
SBNode *sNode = sBucketNode ->node ;
8145
+ if (sNode ->getLastInstruction ()->isDpas ()) {
8146
+ liveDPASNodes.push_back (sNode );
8147
+ }
8117
8148
sb_bb->getLiveBucketsFromFootprint (
8118
8149
sNode ->getFirstFootprint (sBucketNode ->opndNum ), sBucketNode ,
8119
8150
&send_use_kills);
@@ -8128,6 +8159,13 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8128
8159
SBNode *node = SBNodes[j];
8129
8160
G4_INST *curInst = node->getLastInstruction ();
8130
8161
8162
+ if (node->hasDistOneAreg ()) {
8163
+ for (auto dpasNode : liveDPASNodes) {
8164
+ sb_bb->createAddGRFEdge (dpasNode, node, RAW, DEP_EXPLICT);
8165
+ }
8166
+ liveDPASNodes.clear ();
8167
+ }
8168
+
8131
8169
BDvec.clear ();
8132
8170
sb_bb->getGRFBucketDescs (node, BDvec, true );
8133
8171
if (BDvec.empty ()) {
@@ -8228,6 +8266,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8228
8266
send_use_kills.killOperand (bn_it);
8229
8267
sb_bb->createAddGRFEdge (curLiveNode, node, dep,
8230
8268
DEP_EXPLICT);
8269
+ if (curLiveNode->getLastInstruction ()->isDpas ()) {
8270
+ checkAndRemoveDpasNode (curLiveNode, liveDPASNodes);
8271
+ }
8231
8272
curLiveNode->setInstKilled (true ); // Instruction level
8232
8273
// kill
8233
8274
instKill = true ;
@@ -8239,6 +8280,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8239
8280
send_use_kills.killOperand (bn_it);
8240
8281
sb_bb->createAddGRFEdge (curLiveNode, node, dep,
8241
8282
DEP_EXPLICT);
8283
+ if (curLiveNode->getLastInstruction ()->isDpas ()) {
8284
+ checkAndRemoveDpasNode (curLiveNode, liveDPASNodes);
8285
+ }
8242
8286
curLiveNode->setInstKilled (true ); // Instruction level
8243
8287
// kill
8244
8288
instKill = true ;
@@ -8267,6 +8311,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8267
8311
send_use_kills.killOperand (bn_it);
8268
8312
sb_bb->createAddGRFEdge (curLiveNode, node, dep,
8269
8313
DEP_EXPLICT);
8314
+ if (curLiveNode->getLastInstruction ()->isDpas ()) {
8315
+ checkAndRemoveDpasNode (curLiveNode, liveDPASNodes);
8316
+ }
8270
8317
curLiveNode->setInstKilled (
8271
8318
true ); // Instruction level kill
8272
8319
instKill = true ;
@@ -8279,6 +8326,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8279
8326
send_use_kills.killOperand (bn_it);
8280
8327
sb_bb->createAddGRFEdge (curLiveNode, node, dep,
8281
8328
DEP_EXPLICT);
8329
+ if (curLiveNode->getLastInstruction ()->isDpas ()) {
8330
+ checkAndRemoveDpasNode (curLiveNode, liveDPASNodes);
8331
+ }
8282
8332
curLiveNode->setInstKilled (true );
8283
8333
instKill = true ;
8284
8334
continue ;
@@ -8287,6 +8337,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
8287
8337
} else {
8288
8338
send_use_kills.killOperand (bn_it);
8289
8339
sb_bb->createAddGRFEdge (curLiveNode, node, dep, DEP_EXPLICT);
8340
+ if (curLiveNode->getLastInstruction ()->isDpas ()) {
8341
+ checkAndRemoveDpasNode (curLiveNode, liveDPASNodes);
8342
+ }
8290
8343
curLiveNode->setInstKilled (true ); // Instruction level kill
8291
8344
instKill = true ;
8292
8345
continue ;
0 commit comments