This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with extremely large procedures and 64-bit code
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ricardo Telichevesky <ricardo at teli dot org>
- Cc: Renato Golin <renato dot golin at linaro dot org>, Richard Biener <richard dot guenther at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 9 Feb 2015 11:30:12 -0800
- Subject: Re: Problem with extremely large procedures and 64-bit code
- Authentication-results: sourceware.org; auth=none
- References: <54BDD219 dot 3040304 at teli dot org> <CAFiYyc2tcnWpfmFPErpZRi6p4BgiRxvuvkn8zdRAOUE2N+YOzg at mail dot gmail dot com> <54C271AE dot 3000606 at teli dot org> <CAMSE1kfCMfO92D4_riBs+5TE9aeU0Ohs3Zpm+TJjMAkfnFtbAQ at mail dot gmail dot com> <54D90659 dot 1030506 at teli dot org>
On Mon, Feb 9, 2015 at 11:11 AM, Ricardo Telichevesky <ricardo@teli.org> wrote:
> Hello Renato, thanks for your reply, sorry about the confusion with
> compilers - since there is a "clang" in the mac, I thought gcc was gcc..
> After your suggestion, I modified the code, and installed a bona fide gcc
> compiler in the Mac.... I got more data that is kind of interesting, wanted
> to share with the gcc community. Someone might have an idea why this
> happens.
>
> No matter what compiler I use, gcc or llvm on Linux I seem to have this
> problem of 64-bit code being 3x slower than 32-bit when very large
> procedures are called. In my Macbook the 64-bit code is consistently faster
> regardless of the compiler. I got my hands on an i7 Mac and the 64-bit code
> is consistently 10% to 15% faster than the 32-bit code and - I am afraid to
> say something "political" here, have no intention of offending anyone, just
> the facts - with all the optimizations turned on, modified code to force
> inlinining here and there, both gcc and llvm yield pretty much the same
> performance, in fact both are outstanding, reduced the time I reported
> previously from the 16.2s to 1.1s!!! AVX gave me an extra 10% over SSE
> (tricky to get AVX to compile in the mac with gcc, but not impossible).
>
> Of course is hard to compare apples to apples here with Xeon Westmere at
> 2Ghz and i7 IvyBridge at 3.5GHz, but almost 15x is quite a difference, given
> the clock ratios are less than 2.
>
> Now I am trying to investigate if the problem is with Linux itself - which
> is not so good because I need to release code on Linux, or there some
> strange cache issue, or the way libraries are setup, or with the Westmere vs
> IvyBridge. I will keep you posted if I find out more.
>
To compare 64-bit vs 32-bit performance on Linux against MacOS,
you MUST compile your code with -fPIC on Linux since -fPIC is
the default on MacOS.
--
H.J.