isl_scheduler.c: compute_carrying_sol: remove duplicate basic validity edges
commit757d4cec0c09742ec0a9b0f0ab05f4a5da360aaa
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 24 Feb 2017 13:09:32 +0000 (24 14:09 +0100)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Thu, 25 May 2017 14:13:31 +0000 (25 16:13 +0200)
tree10cb0cf7c108905969dc7673ce88fc943c6e01d7
parent954b422b2535cf93d749b4a77a1053d493122c3f
isl_scheduler.c: compute_carrying_sol: remove duplicate basic validity edges

The Feautrier scheduler tries to carry groups of validity schedule
constraints where the groups correspond to the disjuncts
in the schedule constraint description.
The isl_sched_graph data structure was designed for use
by the Pluto algorithm and does not store the individual disjuncts,
but rather entire collections of schedule constraints between
two nodes.  Moreover, if there are any tagged conditional validity
constraints, then they are only grouped into a single edge
if projecting out the tags results in exactly the same relation.
There may therefore be multiple conditional validity edges
between the same pair of nodes and even though the corresponding
relations are not exactly the same, they may share some disjuncts.
The original implementation would attempt to carry each of
these disjuncts separately for each occurrence, introducing
a separate variable in the LP for each such occurrence.
Clearly, a given group of schedule constraints is either carried or not
and so the different variables introduced for different occurrences
of the same group will all have the same value.

Reorganize the way the disjuncts are collected in a way that
removes duplicates.  This means that only one variable needs
to be introduced for each distinct disjunct.
If there are many conditional validity constraints, then this
can lead to a drastic reduction in the number of variables and
therefore also in the computation time.

A possible downside to the new way of collecting disjuncts is
that it no longer exploits the cache that maps dependence relations
to their dual.  However, if there are multiple disjuncts, then
there was no reuse between the Pluto scheduler and the Feautrier
scheduler anyway because the former maps the disjunction as a whole,
while the latter maps the disjuncts individually.
There would still be some reuse within a call to the Feautrier
scheduler, but only for duplicate disjuncts, which are now removed.
Moreover, for intra-node edges there may be an additional removal
of duplicates when distinct disjuncts have the same difference set.
Any possible reuse between successive calls to the Feautrier
scheduler is lost by this commit.  If this turns out to introduce
a significant cost on some inputs, then a separate cache could
be introduced in isl_basic_set_list_coefficients.

This commit may also result in the Feautrier scheduler
returning a different solution on some inputs because
the weight of the duplicate disjuncts is reduced from
the number of occurrences to one.
The order of the variables in the LP problem may also be different.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_scheduler.c