scheduler: fix checking conditional validity constraints on compressed domains
commit83fbaf0c10ee72fa18b600abdaa385420dca2466
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 26 Apr 2017 09:39:46 +0000 (26 11:39 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 26 Apr 2017 12:41:14 +0000 (26 14:41 +0200)
tree545a4bd00870177c37a6a2058b325d7b53b345ec
parenta2288f66e67f44efee4ce44c4c8d81dab75299a3
scheduler: fix checking conditional validity constraints on compressed domains

The original implementation would take a schedule on the compressed
domain and use it as if it were a schedule on the original domain,
possibly resulting in a missed detection of violated
conditional validity constraints.

This fix is based on code inspection.
It is not clear if the bug would ever trigger in practice.
The new test cases was specifically constructed by hand
to tickle the bug and only fails for the whole-component scheduler.

In particular, with conditions { B[1, i] -> A[0, i + 1] } and
conditioned validity constraints { A[0, i] -> B[1, i - 1] }
on domain { A[0, i] : 0 <= i <= 10; B[1, i] : 0 <= i <= 10 },
the whole-component scheduler would produce

domain: "{ B[1, i] : 0 <= i <= 10; A[0, i] : 0 <= i <= 10 }"
child:
  schedule: "[{ B[i0, i] -> [(i)]; A[i0, i] -> [(i)] }]"
  permutable: 1
  coincident: [ 1 ]
  child:
    sequence:
    - filter: "{ A[i0, i] }"
    - filter: "{ B[i0, i] }"

The single band violates the conditional validity constraints
since the conditions have distance 1 and
the conditioned validity constraints have distance -1.
With the fix, it produces

domain: "{ B[1, i] : 0 <= i <= 10; A[0, i] : 0 <= i <= 10 }"
child:
  schedule: "[{ B[i0, i] -> [(1 + i)]; A[i0, i] -> [(i)] }]"
  permutable: 1
  coincident: [ 1 ]
  child:
    sequence:
    - filter: "{ A[i0, i] }"
    - filter: "{ B[i0, i] }"

Here, both distances are zero.

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