This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Loop fusion.
- From: Toon Moene <toon at moene dot org>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Wed, 22 Apr 2015 22:05:15 +0200
- Subject: Re: Loop fusion.
- Authentication-results: sourceware.org; auth=none
- References: <5537D377 dot 1000603 at moene dot org> <CABu31nOgBd8TPT35UmSsirCTuJoEFDQpwGqojcQuRiTvVnq+Tg at mail dot gmail dot com>
On 04/22/2015 09:10 PM, Steven Bosscher wrote:
On Wed, Apr 22, 2015 at 6:59 PM, Toon Moene wrote:
Why is loop fusion important, especially in Fortran 90 and later programs ?
Because without it, every array assignment is a single loop nest, isolated
from related, same-shape assignments.
Why is this a bad thing? When you're talking about single-node
machines, separate loops is probably faster if your arrays are large
enough: better cache locality and easier to vectorize.
Loop fusion is only a win if you iterate through the same array
variables. Writing such a pass is not so hard for the simple, most
common cases. The front end could do some of the rewriting from
F90-style array assignments to fused loops if it notices consecutive
array assignments/operations on the same variables.
It could well be that my artificial example was not what my colleague
measured ...
Indeed, I thought about the front end doing this, but that would limit
it to those that the front end could recognize; on the other hand, that
might be the right limitation.
Thanks !
--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news