Handle 0D problems by adding a 0th level to the main recursion
commitf8b6a419a532d644b2379bff78b62a75bfe74502
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 3 Oct 2008 21:19:23 +0000 (3 23:19 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 3 Oct 2008 22:18:43 +0000 (4 00:18 +0200)
treec92e1237dd3eed842c735c29b8f1279e38079094
parent4faedb72745e5538e614656db7d41258050d2faa
Handle 0D problems by adding a 0th level to the main recursion

The main algorithm recurses over all dimensions of the loops,
the initial call working on the first, outermost dimension.
However, for 0-dimensional problems, there is no outermost
dimension and this initial call would therefore perform
all sorts of inappropriate actions resulting in general mayhem.

We solve this problem, by adding an extra 0th level in the recursion
that handles the parameter domains of the loops (which may themselves
be 0-dimensional).  Only some of the steps behave slightly differently
for the 0th level than they to for the other levels.

1. intersection with the context: proceeds as usual
2. projection: proceeds as usual; the loops are projected on the first
0 dimension, i.e., onto the parameter space
3. separation: proceeds as usual, but we have to be careful about
the "scalar" dimension optimization, which obviously does
not apply to the parameter domain
4. lexographic sorting: not needed; the program is only run for
a specific set of values for the parameters, so it does
not matter in which order the disjoint parameter domains
appear
5a. stride computation: not applicable
5b. recursion: proceeds as usual onto the first dimension
(assuming there is a first dimension; otherwise the
recursion correctly stops at the "0th" dimension)
6. backtrack: not needed

The clast generation has also been changed to expect this
extra level.  In particular, the 0th level does not generate
any loop, but it may generate a set of independent conditions.
68 files changed:
source/clast.c
source/loop.c
source/program.c
test/0D-1.cloog [new file with mode: 0644]
test/0D-1.good.c [new file with mode: 0644]
test/0D-2.cloog [new file with mode: 0644]
test/0D-2.good.c [new file with mode: 0644]
test/0D-3.cloog [new file with mode: 0644]
test/0D-3.good.c [new file with mode: 0644]
test/Makefile.am
test/generate_test.c
test/polylib/0D-1.c [new file with mode: 0644]
test/polylib/0D-2.c [new file with mode: 0644]
test/polylib/0D-3.c [new file with mode: 0644]
test/polylib/4-param.c
test/polylib/cholesky.c
test/polylib/cholesky2.c
test/polylib/classen.c
test/polylib/darte.c
test/polylib/dartef.f
test/polylib/double.c
test/polylib/emploi.c
test/polylib/esced.c
test/polylib/gauss.c
test/polylib/guide.c
test/polylib/iftest.c
test/polylib/iftest2.c
test/polylib/iftestf.f
test/polylib/largeur.c
test/polylib/lu.c
test/polylib/lu2.c
test/polylib/lub.c
test/polylib/lux.c
test/polylib/min-1-1.c
test/polylib/min-2-1.c
test/polylib/min-4-1.c
test/polylib/mode.c
test/polylib/non_optimal/nul_complex1.c
test/polylib/nul_basic1.c
test/polylib/reservoir/QR.c
test/polylib/reservoir/cholesky2.c
test/polylib/reservoir/fusion2.c
test/polylib/reservoir/jacobi3.c
test/polylib/reservoir/lim-lam4.c
test/polylib/reservoir/lim-lam5.c
test/polylib/reservoir/lim-lam6.c
test/polylib/reservoir/liu-zhuge1.c
test/polylib/reservoir/loechner3.c
test/polylib/reservoir/loechner4.c
test/polylib/reservoir/loechner5.c
test/polylib/reservoir/mg-interp2.c
test/polylib/reservoir/mg-psinv.c
test/polylib/reservoir/mg-resid.c
test/polylib/reservoir/mg-rprj3.c
test/polylib/reservoir/pingali1.c
test/polylib/reservoir/pingali2.c
test/polylib/reservoir/pingali3.c
test/polylib/reservoir/pingali5.c
test/polylib/reservoir/pingali6.c
test/polylib/reservoir/stride.c
test/polylib/reservoir/stride2.c
test/polylib/swim.c
test/polylib/thomasset.c
test/polylib/uday_scalars.c
test/polylib/vasilache.c
test/polylib/vivien.c
test/polylib/yosr.c
test/polylib/yosrf.f