periscop / clay

Clay, the Chunky Loop Alteration wizardrY
2 stars 5 forks source link

Stripmine does not apply properly to the dimension created by another stripmine. #14

Closed ftynse closed 9 years ago

ftynse commented 9 years ago
for(i = 0; i < N; i++) {
  S(i);
}

Applying stripmine to this code as stripmine([0],1,4,0) works as expected and generates the code iterating over N points. Trying to apply the subsequent stripmine([0,0],2,3,0) on the dimension created by the former stripmine results in the code iterating over more than N points.

The resulting scattering

9 11 7 1 0 1
# e/i| c1   c2   c3   c4   c5   c6   c7 |  i |  N |  1  
   0   -1    0    0    0    0    0    0    0    0    0    ## c1 == 0
   1    0   -4    0    0    0    1    0    0    0    0    ## -4*c2+c6 >= 0
   0    0    0    0    0    0    0    0    0    0    0    ## 0 == 0
   0    0    0   -1    0    0    0    0    0    0    0    ## c3 == 0
   1    0    0    0   -3    0    1    0    0    0    0    ## -3*c4+c6 >= 0
   1    0    4    0    3    0   -1    0    0    0    2    ## 4*c2+3*c4-c6+2 >= 0
   0    0    0    0    0   -1    0    0    0    0    0    ## c5 == 0
   0    0    0    0    0    0   -1    0    1    0    0    ## c6 == i
   0    0    0    0    0    0    0   -1    0    0    0    ## c7 == 0

is missing one of the lines created by the former stripmine, but even introducing this line results in the wrong (even larger) number of points.

ftynse commented 9 years ago

This is what I expect to be the scattering after two stripmines, an it makes the code iterating over N points.

9 11 7 1 0 1
# e/i| c1   c2   c3   c4   c5   c6   c7 |  i |  N |  1  
   0   -1    0    0    0    0    0    0    0    0    0    ## c1 == 0
   1    0   -4    0    0    0    1    0    0    0    0    ## -4*c2+c6 >= 0
   1    0    4    0    0    0   -1    0    0    0    3    ## 4*c2-c6+3 >= 0
   0    0    0   -1    0    0    0    0    0    0    0    ## c3 == 0
   1    0    0    0   -3    0    1    0    0    0    0    ## -3*c4+c6 >= 0
   1    0    0    0    3    0   -1    0    0    0    2    ## 3*c4-c6+2 >= 0
   0    0    0    0    0   -1    0    0    0    0    0    ## c5 == 0
   0    0    0    0    0    0   -1    0    1    0    0    ## c6 == i
   0    0    0    0    0    0    0   -1    0    0    0    ## c7 == 0