scheduler: solve for original schedule coefficients
commit0d3d3ddd0ab714823e6e98ffecb875ca700a470b
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Wed, 3 May 2017 12:29:47 +0000 (3 14:29 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Thu, 25 May 2017 14:13:31 +0000 (25 16:13 +0200)
tree7868f8f3053912c261af3977ef21cd81e7f038a8
parent5f66ccaeacace36f3ee9d66175a6319125b7aba5
scheduler: solve for original schedule coefficients

The Pluto-like scheduler needs to ensure that each row is linearly
independent of any previously computed rows.  It would therefore
compute a transformed space of schedule coefficients and enforce
at least one of the transformed schedule coefficients that correspond
to linearly independent combinations to be non-zero.

If the transformed schedule coefficients are anything other
than a permutation of the original schedule coefficients,
then the scheduler no longer has any direct control over
these original schedule coefficients.
For example, it would not necessarily pick the first original coefficient
that can be made non-zero to form the next row.
This is illustrated by the test case that is changed by this commit.
The test case mainly checks that the outer schedule row is computed as
"i + j" (by the Feautrier style scheduler), but the Pluto-like scheduler
ends up getting used to complete the schedule and it would pick "j"
for the second row, while the row "i" would also do and is selected now.

As also reported by Oleksandr Zinenko, a related issue was
that the sum of the schedule coefficients, which is used
as one of the optimization criteria, was expressed in terms
of the transformed schedule coefficients rather than
the original schedule coefficients.
For example, the newly added test case would produce the schedule
S[t,i,j,k] -> [t, 2t + i, 2t + i + j, 2t + i + j + k]
with sums of coefficients [1, 3, 4, 5] because it happens to have
small sums of transformed coefficients, while a schedule
S[t,i,j,k] -> [t, 2t + i, t + i + j, 2t + k] }
with sums of coefficients [1, 3, 3, 3] is also available.
This schedule is now produced for this test case.

Express the ILP problem in terms of the original schedule coefficients.
This simplifies the code and allows the optimizer to optimize for
those original schedule coefficients.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
isl_scheduler.c
isl_test.c