incremental scheduler: decompose topological sort of clusters
commit1c569770ea7e2e5ead8d944d1ac3fe518c0e0c03
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 15 Nov 2021 16:18:21 +0000 (15 17:18 +0100)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Sat, 9 Jul 2022 08:59:08 +0000 (9 10:59 +0200)
treeb2fffb9b60b8ab1baf7750088bfa539359f24e3f
parent1b1296ce0211561b1e797ad5ce218a652d880159
incremental scheduler: decompose topological sort of clusters

After incrementally combining SCCs into clusters,
the remaining clusters are topologically sorted and
combined in a sequence node.
This is always correct, but it may be too strict in some cases.
In particular, while the clustering is being performed
inside a connected component of the dependence graph,
some of the clusters may still be pairwise independent and
the sequence imposes an arbitrary order on them.
Try and decompose the topological sort of the clusters
to expose some of this freedom by also introducing set nodes.

The algorithm recursively isolates a single cluster and
then detects independent components among the clusters
before the selected cluster (in the topological order) and
also among the clusters after the selected cluster.
When components are detected in the first and/or last piece,
a set node is introduced to split them up.
The three pieces are then combined into a sequence node.
For simplicity, no cluster is allowed to move across
the selected cluster, even if this may be allowed
by the schedule constraints.

The cluster selected to isolate is the one with
the highest number of incoming and outgoing edges.
Isolating the cluster cuts these edges, increasing
the chance of detecting components in the resulting two pieces.
If the clusters form a chain then there can be no further
independent components and the recursion is terminated.

Requested-by: Nana CK <1429802329@qq.com>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
12 files changed:
Makefile.am
isl_scheduler_clustering.c
isl_scheduler_scc.c [new file with mode: 0644]
isl_scheduler_scc.h [new file with mode: 0644]
test_inputs/schedule/fork1.sc [new file with mode: 0644]
test_inputs/schedule/fork1.st [new file with mode: 0644]
test_inputs/schedule/fork2.sc [new file with mode: 0644]
test_inputs/schedule/fork2.st [new file with mode: 0644]
test_inputs/schedule/fork3.sc [new file with mode: 0644]
test_inputs/schedule/fork3.st [new file with mode: 0644]
test_inputs/schedule/nana.sc [new file with mode: 0644]
test_inputs/schedule/nana.st [new file with mode: 0644]