ISL allows illegal split? (aka what am I doing wrong?)

0 views
Skip to first unread message

Emil Vatai

unread,
Nov 4, 2025, 10:53:04 PM (23 hours ago) Nov 4
to isl Development
Hi!

I take this code:

  for (int j = 0; j < _PB_H; j++) {
    tm1 = 0.0; // S_0
    for (int i = 0; i < _PB_W; i++) {
      y1[i][j] = imgOut[i][j] + tm1; // S_1
      tm1 = imgOut[i][j]; // S_2
    }
  }

I split the first loop (by manipulating the schedule tree in ISL), and get something like this:

  for (int j = 0; j < _PB_H; j++) {
    tm1 = 0.0; // S_0
  for (int j = 0; j < _PB_H; j++) {
    for (int i = 0; i < _PB_W; i++) {
      y1[i][j] = imgOut[i][j] + tm1; // S_1
      tm1 = imgOut[i][j]; // S_2
    }
  }

When I check the legality, ISL says it is legal, but looking at it, I'd say it is not legal (tm1 is reset to 0.0 for each column j, and updated from imgOut[i][j] after each row).

--

After providing everything to the "access info" object, I calculate the "flow". After that, I apply the schedule to the dependencies (which are the may-dependencies from the flow) and look at the delta as the legality check.

These are the dependencies I'm getting, and they don't quite seem right to me (namely, I don't see the S_2[j,i] -> S_0[j'] for j'>j dependency).

deps: [_PB_H, _PB_W] -> {
  S_0[j] -> S_1[j', i] : 0 <= j < _PB_H and j < j' < _PB_H and 0 < i < _PB_W;
  S_0[j] -> S_1[j' = j, i] : 0 <= j < _PB_H and 0 < i < _PB_W;
  S_0[j] -> S_1[j', i = 0] : _PB_W > 0 and 0 <= j < _PB_H and j < j' < _PB_H;
  S_0[j] -> S_1[j' = j, i = 0] : _PB_W > 0 and 0 <= j < _PB_H;
  S_2[j, i] -> S_1[j', i'] : 0 <= j < _PB_H and 0 <= i < _PB_W and j < j' < _PB_H and 0 < i' < _PB_W;
  S_2[j, i] -> S_1[j' = j, i'] : 0 <= j < _PB_H and 0 <= i < _PB_W and i < i' < _PB_W;
  S_2[j, i] -> S_1[j', i' = 0] : 0 <= j < _PB_H and 0 <= i < _PB_W and j <j' < _PB_H
  }

I'm probably doing something wrong -- any help/feedback is welcome.

A "minimal breaking example" (bad_deps.c) which does the whole transformation and legality check (with an input bdi.c file) is provided.

Best,
E

bad_deps.c
bdi.c
Reply all
Reply to author
Forward
0 new messages