This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Expression templates (ET) and optimizer for C++
- To: Kurt Garloff <kurt at garloff dot de>, GCC Mailing List <gcc at gcc dot gnu dot org>
- Subject: Re: Expression templates (ET) and optimizer for C++
- From: Olaf Petzold <opetzold at wit dot regiocom dot net>
- Date: Wed, 29 Aug 2001 08:44:43 +0200
- References: <20010829023831.A15912@gum01m.etpnet.phys.tue.nl>
Hi Kurt,
> thanks for reporting your experience with compiling C++ code with expression
> templates using my patch
> http://gcc.gnu.org/ml/gcc/2001-08/msg01206.html
>
> I wonder what happens there, because you report that in the end a lot of
> small static inline functions do not get inlined.
>
> First question: Is this with version 1 or 2 of my patch?
(I guess) the 2nd, see <http://gcc.gnu.org/ml/gcc/2001-08/msg01087.html>. As I
can see there is no 3rd, see Gerald's notes concerning the texinfo file in
<http://gcc.gnu.org/ml/gcc/2001-08/msg01135.html>.
> So, I assume, it's with v2.
OK.
> In that case, I got some ideas:
> * We might increase the min size that I determind to be 130 (13 tree tokens)
> to a slightly larger value (say 150) and seee whether this makes those
> small functions always inlineable
> * We may cut off this too early as well with max_inline_recursive * 64
> and should double or quadruple it
> * We may decrease the slope of our function that is throttling inlining more
> and more from 1/16 to 1/64 and see what happens. This way, we probably
> still keep compilation resources within limits while not giving up so
> early with our inling efforts.
>
> Can you try those two changes? Just change the min_inline resp. the
> max_curr in gcc/cp/optimize.c: inlinable_function_p () accordingly.
I will do it hopefully the next days - compiling all languages takes a lot of
time (about 5 h?) on my AMD K6-2/400, so I will enable only c++ at home in
the evening.
> Did you compile with -finline-functions aka -O3?
Some days there where options like -O6 in some newsgroups ... - I did try this
as well (to get the hidden secrets 8)
> Please also check without then.
That I can't do on ET. I need at least -O to evaluate the ET!
> -O2 always yields better results, if the author of the code did use
> the inline keyword at all the appropriate places and I suspect Todd did.
I would say yes. He spend a lot of time for those imho. If I see other ET
implementations .... At moment I write my own implementation of vector matrix
et lib. There are some other cute effects. Todd it's using a bool member
function like has_fastAccess which is for Tiny math always true. I don't need
this flag but, even with this flag the produced code is better (on
gcc-2.96-mandrake)!
> Another question: Did you compare against 2.95.3, 3.0 and 3.0.1?
> I'd like to be sure to not introduce regressions ...
Only the produced x86-asm code, compared 2.95.3 and 3.01-with-patch. I will
make more deep/comparable results even with details.
> Note that 2.96/97 do just do recursive inlining without limitations. Want
> some little test code to have your compiler trigger OOM of your machine?
Yes but, what's OOM?
> I'd be happy to get some results from you so we can tune the inlining
> heuristics somewhat more.
CU
Olaf