glibc recompile - optimized for G5 cpu target

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

glibc recompile - optimized for G5 cpu target

Peter Saisanas
Hi,

Ok, i have modified the debian rules file for glibc 2.21-6 and recompiled.

I have built this package essentially with the cflags: -O3 together with
the following extra line below:
extra_cflags = -mcpu=G5 -mtune=G5 -maltivec -mabi=altivec

Ill be the first to admit that i haven't played around with glibc before.
Not sure if this will even make any difference, just wanted to try an
experiment for myself.

It compiles, runs through the tests and builds the packages.
The build logs are approximately 13MB each for powerpc and powerpc64!

The following log files in the build-tree
test-results-powerpc64-linux-gnu-ppc64 &
test-results-powerpc-linux-gnu-libc both came up with no logged
testsuite failures. I assume these logs are where to look for obvious
testsuite regressions?

After compilation, I have the following deb packages:
glibc-doc_2.21-6+local-g5.1_all.deb
glibc-source_2.21-6+local-g5.1_all.deb
libc6_2.21-6+local-g5.1_powerpc.deb
libc6-dbg_2.21-6+local-g5.1_powerpc.deb
libc6-dev_2.21-6+local-g5.1_powerpc.deb
libc6-dev-ppc64_2.21-6+local-g5.1_powerpc.deb
libc6-pic_2.21-6+local-g5.1_powerpc.deb
libc6-ppc64_2.21-6+local-g5.1_powerpc.deb
libc6-ppc64-dbgsym_2.21-6+local-g5.1_powerpc.deb
libc6-udeb_2.21-6+local-g5.1_powerpc.udeb
libc-bin_2.21-6+local-g5.1_powerpc.deb
libc-bin-dbgsym_2.21-6+local-g5.1_powerpc.deb
libc-dev-bin_2.21-6+local-g5.1_powerpc.deb
libc-dev-bin-dbgsym_2.21-6+local-g5.1_powerpc.deb
libc-l10n_2.21-6+local-g5.1_all.deb
libnss-dns-udeb_2.21-6+local-g5.1_powerpc.udeb
libnss-files-udeb_2.21-6+local-g5.1_powerpc.udeb
locales_2.21-6+local-g5.1_all.deb
locales-all_2.21-6+local-g5.1_powerpc.deb
multiarch-support_2.21-6+local-g5.1_powerpc.deb
nscd_2.21-6+local-g5.1_powerpc.deb
nscd-dbgsym_2.21-6+local-g5.1_powerpc.deb

I have installed the recompiled glibc on a spare hdd with an older
install of Debian and the installation still seems to have survived
(actually surprised me more than anything else)!

I'm not expecting miracles (or anything positive TBH) but would lmbench
be an appropriate benchmark to run to compare the performance of glibc
(i.e. original Debian 2.21-6 vs 2.21-6 with G5 cflags) or any other
benchmark recommendations?

I know, i know.... This is unsupported!

Regards,
Peter





Reply | Threaded
Open this post in threaded view
|

Re: glibc recompile - optimized for G5 cpu target

Brock Wittrock
Peter,

I wish I had a good answer for you regarding relevant and useful benchmark tools,but I just wanted to add that I would like to try and do the same thing for PPC G4 machines using their architecture specific compilation flags as well to see what difference it makes.  I'll report back on my success/failure as well.  If you do come across a good tool for comparing performance between the two, let me know.  I'll be using the CFLAGS under the G4 section on this Gentoo Wiki page: https://wiki.gentoo.org/wiki/Safe_CFLAGS

As we have discussed before, it would great to squeeze every last bit of efficiency as we can out of these older machines.  I also enjoyed your comment from a post here a week or so ago about using an non Intel/AMD machine to learn Linux.  I couldn't agree more. :)

Thanks,
Brock

On Wed, Jan 6, 2016 at 5:02 PM, Peter Saisanas <[hidden email]> wrote:
Hi,

Ok, i have modified the debian rules file for glibc 2.21-6 and recompiled.

I have built this package essentially with the cflags: -O3 together with the following extra line below:
extra_cflags = -mcpu=G5 -mtune=G5 -maltivec -mabi=altivec

Ill be the first to admit that i haven't played around with glibc before.
Not sure if this will even make any difference, just wanted to try an experiment for myself.

It compiles, runs through the tests and builds the packages.
The build logs are approximately 13MB each for powerpc and powerpc64!

The following log files in the build-tree test-results-powerpc64-linux-gnu-ppc64 & test-results-powerpc-linux-gnu-libc both came up with no logged testsuite failures. I assume these logs are where to look for obvious testsuite regressions?

After compilation, I have the following deb packages:
glibc-doc_2.21-6+local-g5.1_all.deb
glibc-source_2.21-6+local-g5.1_all.deb
libc6_2.21-6+local-g5.1_powerpc.deb
libc6-dbg_2.21-6+local-g5.1_powerpc.deb
libc6-dev_2.21-6+local-g5.1_powerpc.deb
libc6-dev-ppc64_2.21-6+local-g5.1_powerpc.deb
libc6-pic_2.21-6+local-g5.1_powerpc.deb
libc6-ppc64_2.21-6+local-g5.1_powerpc.deb
libc6-ppc64-dbgsym_2.21-6+local-g5.1_powerpc.deb
libc6-udeb_2.21-6+local-g5.1_powerpc.udeb
libc-bin_2.21-6+local-g5.1_powerpc.deb
libc-bin-dbgsym_2.21-6+local-g5.1_powerpc.deb
libc-dev-bin_2.21-6+local-g5.1_powerpc.deb
libc-dev-bin-dbgsym_2.21-6+local-g5.1_powerpc.deb
libc-l10n_2.21-6+local-g5.1_all.deb
libnss-dns-udeb_2.21-6+local-g5.1_powerpc.udeb
libnss-files-udeb_2.21-6+local-g5.1_powerpc.udeb
locales_2.21-6+local-g5.1_all.deb
locales-all_2.21-6+local-g5.1_powerpc.deb
multiarch-support_2.21-6+local-g5.1_powerpc.deb
nscd_2.21-6+local-g5.1_powerpc.deb
nscd-dbgsym_2.21-6+local-g5.1_powerpc.deb

I have installed the recompiled glibc on a spare hdd with an older install of Debian and the installation still seems to have survived (actually surprised me more than anything else)!

I'm not expecting miracles (or anything positive TBH) but would lmbench be an appropriate benchmark to run to compare the performance of glibc (i.e. original Debian 2.21-6 vs 2.21-6 with G5 cflags) or any other benchmark recommendations?

I know, i know.... This is unsupported!

Regards,
Peter






Reply | Threaded
Open this post in threaded view
|

Re: Re: glibc recompile - optimized for G5 cpu target

Peter Saisanas
Hi Brock,
I have tried lmbench and recompiled glibc 2.21-6 with -O3 and -O2
optimizations with the cflags below:
extra_cflags = -mcpu=G5 -mtune=G5 -maltivec -mabi=altivec

I haven't actually seen any marked difference to the results coming out
of lmbench when using the default Debian glibc and my recompiled glibc
with cflags above and -O2 and O3 optimization levels.

In other words, i can equate my naive attempts at ricing out glibc the
equivalent of just adding a sports muffler and big spoiler. :)

My Debian install does seem to be running quite well, it does seem to
perform a just that little bit better, but perhaps it is just a placebo
effect!

So unless I'm using the wrong benchmark, or the chosen cflags have no
effect on the compilers output of glibc, i have nothing to show for my
efforts! :(

Am i doing something wrong, or is there simply no extra performance to
be had just by playing with the cflags and recompiling glibc?

Cheers,
Peter





Reply | Threaded
Open this post in threaded view
|

Re: Re: glibc recompile - optimized for G5 cpu target

Olaf Hering-2
On Mon, Jan 11, Peter Saisanas wrote:

> Am i doing something wrong, or is there simply no extra performance to be
> had just by playing with the cflags and recompiling glibc?

Just ask yourself: How many months per year does your cpu execute code
from glibc instead of kernel or app code? If you cant come up with an
answer, ask a profiler...

Olaf

Reply | Threaded
Open this post in threaded view
|

Re: Re: glibc recompile - optimized for G5 cpu target

Lennart Sorensen
In reply to this post by Peter Saisanas
On Mon, Jan 11, 2016 at 08:31:39PM +1100, Peter Saisanas wrote:

> Hi Brock,
> I have tried lmbench and recompiled glibc 2.21-6 with -O3 and -O2
> optimizations with the cflags below:
> extra_cflags = -mcpu=G5 -mtune=G5 -maltivec -mabi=altivec
>
> I haven't actually seen any marked difference to the results coming out of
> lmbench when using the default Debian glibc and my recompiled glibc with
> cflags above and -O2 and O3 optimization levels.
>
> In other words, i can equate my naive attempts at ricing out glibc the
> equivalent of just adding a sports muffler and big spoiler. :)
>
> My Debian install does seem to be running quite well, it does seem to
> perform a just that little bit better, but perhaps it is just a placebo
> effect!
>
> So unless I'm using the wrong benchmark, or the chosen cflags have no effect
> on the compilers output of glibc, i have nothing to show for my efforts! :(
>
> Am i doing something wrong, or is there simply no extra performance to be
> had just by playing with the cflags and recompiling glibc?

glibc already has optimized versions of key functions and will pick the
right one based on the CPU it is running on.

So no I would actually not expect to see any noticeable change.

For example strcpy does:

libc_ifunc (__stpcpy,
            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
            ? __stpcpy_power8 :
              (hwcap & PPC_FEATURE_HAS_VSX)
              ? __stpcpy_power7
            : __stpcpy_ppc);

So if on a power8 it calls the power8 optimized function, otherwise on
a power7 it calls the next best one, and otherwise it uses the generic
ppc one.

--
Len Sorensen

Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: glibc recompile - optimized for G5 cpu target

Peter Saisanas
Thanks for your feedback Len.
You explained how the glibc optimisations work in a manner making it
easy for me to understand.
Much appreciated!

Regards,
Peter