Re: Loop jamming!?

"Steve Simmons" <simmons@nortel.ca>
30 Jun 1997 22:52:07 -0400

          From comp.compilers

Related articles
Loop jamming!? wjhung@csie.nctu.edu.tw (1997-06-24)
Re: Loop jamming!? simmons@nortel.ca (Steve Simmons) (1997-06-30)
Re: Loop jamming!? joelw@rsn.hp.com (Joel Williamson) (1997-06-30)
Re: Loop jamming!? sven@customized.com (Sven) (1997-07-13)
Re: Loop jamming!? n8tm@aol.com (1997-07-16)
Re: Loop jamming!? cdg@nullstone.com (Christopher Glaeser) (1997-07-18)
Re: Loop jamming!? schow@nortel.ca (Stanley Chow) (1997-07-21)
Re: Loop jamming!? cdg@nullstone.com (Christopher Glaeser) (1997-07-22)
[8 later articles]
| List of all articles for this month |

From: "Steve Simmons" <simmons@nortel.ca>
Newsgroups: comp.compilers
Date: 30 Jun 1997 22:52:07 -0400
Organization: Nortel
References: 97-06-089
Keywords: optimize

Loop jamming is very similar to loop unrolling; however, loop
unrolling unrolls the innermost loop in the nest where loop jamming
unrolls an outer loop in the nest and jams the next inner loop
together.




Example:


          FOR I= 1, 2
              FOR J= 1, N
                    A(I, J) = B(I, J)
              ENDDO
          ENDDO


This is a perfect candidate for loop jamming because it can
take advantage of cache locality (assuming the elements in
the first dimension are contiguous).


The result of a loop unroll and jam is...


          FOR J = 1, N
                A(1, J) = B(1, J)
                A(2, J) = B(2, J)
          ENDDO


Note, this same optimization can be achieved by first
performing a loop interchange, and then a complete unroll.
However, this is one complete optimization.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.