next up previous contents index
Next: Array padding Up: Simple functions Previous: loop interchanging

The loop blocking transformation

The loop blocking transformation decomposes a do-loop statement into blocks of a constant blocking factor (the step is multiplied by this factor). The knowledge of the sign of the outer loop step is necessary to obtain an efficient blocking. This information can be computed automatically or can be specified by the user. The blocking factor must be greater than 1. When it is applied to a perfect nest of loops, the outer loop can be blocked in the body of the inner loop of the specified level.  

$\vartriangleright$ Example 65:  A loop blocking transformation applied to the loop of index i with a level of 2 and a blocking factor of 4.



  DO i = 1,m 
    DO j = 1,n 
      F(i,j,k)
    ENDDO
  ENDDO



$\longrightarrow$

  DO Ti=1,m,4
    DO j = 1,n 
      DO i = Ti,MIN(Ti+4-1,m)
        F(i,j,k)
      ENDDO
    ENDDO
  ENDDO



The loop blocking transformation is generally followed by a loop interchanging or a loop transformation.

  $\blacktriangleright$ Fits:Blocking:Check(LOOP,DIAGMESG,FACTOR,LEVEL)
 
This function checks if the loop blocking transformation can be applied.

  $\blacktriangleright$ Fits:Blocking:Advice(LOOP,DIAGMESG,FACTOR,LEVEL)
 
This function emits a diagnostic about the interest of the loop blocking transformation

  $\blacktriangleright$ Fits:Blocking:Safe(LOOP,DIAGMESG,FACTOR,LEVEL)
 
This function emits a diagnostic about the code produced by the loop blocking transformation

  $\blacktriangleright$ Fits:Blocking:Apply(DESC,FACTOR,LEVEL)
 
This function applies the loop blocking transformation.


next up previous contents index
Next: Array padding Up: Simple functions Previous: loop interchanging
Yann Mevel
1999-04-30