Skip to content

Commit ce0a708

Browse files
bcheng0127igcbot
authored andcommitted
pre RA scheduling failure
Failed to schedule the send pairs. For SIMD32 send which is splitted into two SIMD16 or 4 SIMD8, Pressure scheduling will try to schedule these instruction in bundle. However, the clustering scheduling breaks the rule right now and will schedule other send instruction between them. This fix is to prevent this situation happen.
1 parent 61c4a09 commit ce0a708

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

visa/LocalScheduler/G4_Sched.cpp

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,8 @@ class SethiUllmanQueue : public QueueBase {
825825
private:
826826
// Initialize Sethi-Ullman numbers.
827827
void init();
828-
828+
// Check if the Tuple restriction is obeyed.
829+
bool willNotBreakTupleRestriction(preNode *N) const;
829830
// Select next ready node to schedule.
830831
preNode *select();
831832
// In clustering mode
@@ -957,17 +958,19 @@ bool SethiUllmanQueue::compare(preNode *N1, preNode *N2) {
957958
return N1->getID() > N2->getID();
958959
}
959960

960-
961+
bool SethiUllmanQueue::willNotBreakTupleRestriction(preNode *N) const {
962+
return (!N->getInst() || !N->getInst()->isSend() || !TheCurrTupleLead ||
963+
(N->getTupleLead() == TheCurrTupleLead));
964+
};
961965

962966
preNode *SethiUllmanQueue::select() {
963967
vASSERT(!Q.empty());
964968
auto TopIter = Q.end();
965969
for (auto I = Q.begin(), E = Q.end(); I != E; ++I) {
966970
preNode *N = *I;
967971
// If there's a node to be paired, skip send not in pair.
968-
if (N->getInst() && N->getInst()->isSend())
969-
if (TheCurrTupleLead && N->getTupleLead() != TheCurrTupleLead)
970-
continue;
972+
if (!willNotBreakTupleRestriction(N))
973+
continue;
971974
if (TopIter == Q.end() || compare(*TopIter, *I))
972975
TopIter = I;
973976
}
@@ -997,6 +1000,7 @@ void SethiUllmanQueue::formWorkingSet(preNode *seed,
9971000
W.push_back(seed);
9981001
return;
9991002
}
1003+
10001004
std::vector<preNode *> Cluster;
10011005
Cluster.push_back(seed);
10021006
preNode *ClusterWait = nullptr;
@@ -1047,9 +1051,29 @@ void SethiUllmanQueue::formWorkingSet(preNode *seed,
10471051
while (idx < Q.size()) {
10481052
preNode *Tmp = Q[idx];
10491053
if (std::find(Cluster.begin(), Cluster.end(), Tmp) != Cluster.end()) {
1050-
W.push_back(Tmp);
1051-
Q[idx] = Q.back();
1052-
Q.pop_back();
1054+
// For send instruction which is not part of TheCurrTupleLead, the send
1055+
// instruction cannot be inserted into W. Which will be scheduled before
1056+
// the other parts of TheCurrTupleLead.
1057+
// Such as in following 4 send instructions, first two and last two send
1058+
// instructions must be schedule together, cannot interleave between
1059+
// them.
1060+
//
1061+
// sample_l.RGB (M1, 16) 0x0:uw S31 %bss V0626.0 %null.0 V0628.0
1062+
// CCTuple_1.0 CCTuple_1.64
1063+
// sample_l.RGB(M5, 16) 0x0 : uw S31 %bss V0627.0 %null.0 V0629.0
1064+
// CCTuple_2.0 CCTuple_2.64
1065+
//
1066+
// sample_l.RGB(M1, 16) 0x0 : uw S31 %bss V0640.0 %null.0 V0642.0
1067+
// CCTuple_3.0 CCTuple_3.64
1068+
// sample_l.RGB(M5, 16) 0x0 : uw S31 %bss V0641.0 %null.0 V0643.0
1069+
// CCTuple_4.0 CCTuple_4.64
1070+
if (willNotBreakTupleRestriction(Tmp)) {
1071+
W.push_back(Tmp);
1072+
Q[idx] = Q.back();
1073+
Q.pop_back();
1074+
} else {
1075+
idx++;
1076+
}
10531077
} else
10541078
idx++;
10551079
}
@@ -1067,7 +1091,7 @@ void SethiUllmanQueue::formWorkingSet(preNode *seed,
10671091
Top = Node; // continue search
10681092
Searching = true;
10691093
break;
1070-
} else {
1094+
} else if (willNotBreakTupleRestriction(Node)) {
10711095
if (Node != seed) {
10721096
Q.erase(std::remove(Q.begin(), Q.end(), Node), Q.end());
10731097
Q.push_back(seed);

0 commit comments

Comments
 (0)