Skip to content

Commit d834bd3

Browse files
Martien de Jongmartien-de-jong
authored andcommitted
[AIE] dotgraph improvements
Draw order edges (in green) Use a different shape for LCD destinations Add latency to edge in dot graph
1 parent 47992e6 commit d834bd3

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

llvm/lib/Target/AIE/AIEPostPipeliner.cpp

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,18 @@ int PostPipeliner::computeMinScheduleLength() const {
515515
void dumpGraph(const ScheduleInfo &Info, ScheduleDAGInstrs *DAG) {
516516
dbgs() << "digraph {\n";
517517

518+
// Prescan backedge destinations and declare them to have a different shape.
519+
for (int K = 0; K < Info.NInstr; K++) {
520+
int K2 = K + Info.NInstr;
521+
auto &SU = DAG->SUnits[K2];
522+
if (any_of(SU.Preds, [Limit = Info.NInstr, K](const SDep &Dep) {
523+
int P = Dep.getSUnit()->NodeNum;
524+
return P < Limit && P != K;
525+
})) {
526+
dbgs() << "\tSU" << K2 << "_" << K << "[shape=rectangle]\n";
527+
}
528+
}
529+
518530
for (int K = 0; K < Info.NInstr; K++) {
519531
auto &SU = DAG->SUnits[K];
520532
for (auto &Dep : SU.Succs) {
@@ -530,13 +542,22 @@ void dumpGraph(const ScheduleInfo &Info, ScheduleDAGInstrs *DAG) {
530542
if (S >= Info.NInstr) {
531543
dbgs() << "_" << S % Info.NInstr;
532544
}
533-
if (Dep.getKind() == SDep::Data) {
534-
dbgs() << " [color=red] ";
535-
} else if (Dep.getKind() == SDep::Output) {
536-
dbgs() << " [color=black] ";
537-
} else if (Dep.getKind() == SDep::Anti) {
538-
dbgs() << " [color=blue] ";
545+
dbgs() << " [ label=\"" << Dep.getSignedLatency() << "\"";
546+
switch (Dep.getKind()) {
547+
case SDep::Data:
548+
dbgs() << " color=red ";
549+
break;
550+
case SDep::Output:
551+
dbgs() << " color=black ";
552+
break;
553+
case SDep::Anti:
554+
dbgs() << " color=blue ";
555+
break;
556+
case SDep::Order:
557+
dbgs() << " color=green ";
558+
break;
539559
}
560+
dbgs() << "] ";
540561

541562
dbgs() << " # L=" << Dep.getSignedLatency();
542563
if (Dep.getKind() == SDep::Output) {

0 commit comments

Comments
 (0)