Re: Optimizations in C/C++ code doing matrix multiplications

Terry Greyzck <terryg@qwest.net>
7 Apr 2002 12:38:16 -0400

          From comp.compilers

Related articles
Optimizations in C/C++ code doing matrix multiplications ele1@gmx.ch (H. Ellenberger) (2002-03-22)
Re: Optimizations in C/C++ code doing matrix multiplications ele1@gmx.ch (H. Ellenberger) (2002-03-31)
Re: Optimizations in C/C++ code doing matrix multiplications marjan.sterk@ijs.si (2002-03-31)
Re: Optimizations in C/C++ code doing matrix multiplications mark@marklacey.com (2002-04-06)
Re: Optimizations in C/C++ code doing matrix multiplications lars.gregersen@it.dk (2002-04-06)
Re: Optimizations in C/C++ code doing matrix multiplications terryg@qwest.net (Terry Greyzck) (2002-04-07)
| List of all articles for this month |
From: Terry Greyzck <terryg@qwest.net>
Newsgroups: comp.compilers
Date: 7 Apr 2002 12:38:16 -0400
Organization: Compilers Central
References: 02-03-151
Keywords: optimize, arithmetic
Posted-Date: 07 Apr 2002 12:38:16 EDT

"H. Ellenberger" <ele1@gmx.ch> wrote:


>Which compilers are smart enough to automagically optimize this kind
>of data acess by introducing hidden pointer variables (in registers)
>incremented and thus avoiding most multiplications?
>[It's my impression that people who care about fast and, accurate matrix
>multiplication use linpack rather than reinventing it. -John]


The Cray compilers have performed the necessary interchanges,
blocking, etc. since about 1993. In this case, the blocking is done
using vector registers, essentially a blindingly fast cache. The
speed rivals and can exceed the hand optimized version.


The compiler can also examine the loop nest and use pattern matching
techniques to recognize it as a matrix multiply, and replace the loop
nest with a call to the hand-optimized libsci routine. The 'restrict'
qualifier may be necessary on pointers to allow the optimizations.


Both techniques are applied by default, pattern matching first
(although that can be disabled). On the upcoming SV2 multistreaming
is also used to good effect, again automatically.


Terry Greyzck
terryg@qwest.net
http://www.greyzck.com


Post a followup to this message

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