Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CFLAGs for an AMD64 Venice in x86 Gentoo (SOLVED)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
A Dragoon
n00b
n00b


Joined: 18 Aug 2006
Posts: 4

PostPosted: Fri Aug 18, 2006 5:30 am    Post subject: CFLAGs for an AMD64 Venice in x86 Gentoo (SOLVED) Reply with quote

-waves- Long-time LFS and Slackware user, deciding to give Gentoo a try. I'm familiar with GCC flags for compiling optimizations but I'm curious as to the input of the community due to their much larger focus. So far I plan on:

Code:
Initial settings (not final, see end of post for finalized cflags):

Optimziations: -O2
CFLAGS: -pipe -fomit-frame-pointer -march=athlon-xp -msse3
MAKEOPTS: -j3


1. Now here are my thoughts, and in return I'd appreciate insight and suggestions from the community. I want the amd64 core to run gentoo x86 versus the amd64 version of gentoo because of general stability across programs, modules, and closed-3dparty drivers. So, running as proc athlon-xp seems the best choice. Or would i686 be? Because I want to run the amd64 in x86 mode I heard placing the march as athlon-xp will give it the needed optimzations for an AMD64 without the 64bit concern. Correct?
Solved : Solution: https://forums.gentoo.org/viewtopic-p-1235052.html#1235052 - To run x86 gentoo in 32bit mode when using an AMD64 processor, use march=athlon-xp to get all the goodies of an amd without the 64


2. Using -O2 instead of -O3 because I've heard horror stories about packages burning and screaming out for mercy due to possible overoptimzations. Thus -O2 seems a good balance of optimization and stability. Thoughts?
Solved : Solution: http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html - -O2 and -O3 are very similar in that -O3 does all the optimizations that -O2 does, but also includes -finline-functions, -fweb and -frename-registers. Now I've heard -fweb can interfer with debugging and that isn't something I want to deal with, especially since I'll be programming or might want to assist in bugfixing of other applications. -O2 seems to be the most optimzing avaliable while keeping things stable.

3. -pipe is obvious but I question the need for -fomit-frame-pointer, especially on an AMD64 chip. I know it would remove frame pointers but doesn't it increase binary size?
Solved : Solution: http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html - -fomit-frame-pointer is automatically enabled at -O, -O2, and -O3 with the saftey check of disabling it if there is a chance it would break debugging of the program being compiled. since I want to be able to debug and fix code, I don't want to include -fomit-frame-pointer manually.. which would FORCE all code to go through the optimization even if it breaks debugging.

4. -msse3 was inlcuded because of the capability the chip has to run sse3. Is it moot due to the -O2 flag or will it increase preformance (generally speaking)?
Solved : Solution : http://www.gentoo-wiki.com/Safe_Cflags#Athlon_64_X2_.28AMD.29 - Looks like -msse3 is able to be used on AMD64 ("Venice" or "San Diego" cores) amd AMD62 X2 chips (Manchester" or "Toledo" cores). Since I have a AMD64 Venice core CPU, -msse3 is avaliable to me instead of -msse2

As a side note, the cat /proc/cpuinfo doesn't show sse3, it shows pni. After research the pni stands for "Prescott New Instructions", the official term for SSE3. So, those of you that run cat /proc/cpuinfo to see if sse3 is supported, and thus -msse3, check for pni... not sse3.
(Thanks to thesnowman)


5. And finally the -j3 opts because of dual-core capability within the amd64 venice core. But... since the amd64 is running as x86 gentoo, will the dual core still be applicable?
Solution : http://www.newegg.com/Product/Product.asp?Item=N82E16819103603 The AMD64 3500 Venice core CPU is a single-core CPU with hyperthreading. I was under the impression that it was a dual-core CPU. It is not, This means -j3 is inaccurate and needs to be -j2, since the word-on-the-street says a single-core needs -j1+1(for one core).


Any flags I've placed that seem useless or any flags you are aware of that would help my specific CPU would be greatly appreciated it. I tried searching for further ideas from others on the forum but the CFLAGs threads are longer than the installation itself.

Cheers.

Currently used Cflags for my AMD64 3500 Venice on Gentoo x86:
Code:
CFLAGS: -pipe -march=athlon-xp -msse3 -O2
MAKEOPTS: -j2


Last edited by A Dragoon on Fri Aug 18, 2006 9:24 am; edited 1 time in total
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Fri Aug 18, 2006 8:40 am    Post subject: Re: CFLAGs for an AMD64 Venice in x86 Gentoo (SOLVED) Reply with quote

A Dragoon wrote:
Problem : Plot thickens, I ran a cat /proc/cpuinfo and it's only displaying avaliable flags up to sse2. What's up? Keep in mind this is on the gentoo liveCD

Look for the pni cpuflag for sse3 support. Check this wikipedia article:
http://en.wikipedia.org/wiki/SSE3
Back to top
View user's profile Send private message
A Dragoon
n00b
n00b


Joined: 18 Aug 2006
Posts: 4

PostPosted: Fri Aug 18, 2006 9:25 am    Post subject: Reply with quote

NIcely done snowman. Should have thought about cross-checking wikipedia. Updated the origonal post and plugged in a thanks for you.
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Fri Aug 18, 2006 9:49 am    Post subject: Reply with quote

No problem. Oh, and by the way, I forgot to welcome you to the Gentoo community - so welcome and I hope you enjoy your stay. I've been here for a few years now and still run Gentoo on my web/mail server and mythtv box, but have migrated to Ubuntu Dapper on my laptop. I just got an AMD64 X2 (which is how I know about sse3) which I'm planning to use with Xen to run a host of OS's including (shock horror!) SBS 2003.

Here's some useful Gentoo URLs:
Bugzilla. If you can't find a package in portage look here for an ebuild that will eventually make it into the portage tree.
https://bugs.gentoo.org/

Gentoo Documentation index. Look here for all the official guides.
http://www.gentoo.org/doc/en/index.xml

Gentoo wiki. Tonnes of user submitted documentation, much of it migrated from these forums.
http://gentoo-wiki.com/Main_Page
Back to top
View user's profile Send private message
markkuk
Guru
Guru


Joined: 29 Nov 2002
Posts: 446

PostPosted: Fri Aug 18, 2006 11:12 am    Post subject: Re: CFLAGs for an AMD64 Venice in x86 Gentoo (SOLVED) Reply with quote

A Dragoon wrote:
5. And finally the -j3 opts because of dual-core capability within the amd64 venice core. But... since the amd64 is running as x86 gentoo, will the dual core still be applicable?
Solution : http://www.newegg.com/Product/Product.asp?Item=N82E16819103603 The AMD64 3500 Venice core CPU is a single-core CPU with hyperthreading.

Only Intel® makes Hyper-Threading™ CPUs. AMD64 3500 is a single-core single-threaded chip.
Back to top
View user's profile Send private message
A Dragoon
n00b
n00b


Joined: 18 Aug 2006
Posts: 4

PostPosted: Fri Aug 18, 2006 11:15 am    Post subject: Reply with quote

Quote:
Only Intel® makes Hyper-Threading™ CPUs. AMD64 3500 is a single-core single-threaded chip.
My mistake, the AMD term is Hyper-Transport. Which is completely different than hyper-threading. My apologies. And thanks for the warm welcome :)
Back to top
View user's profile Send private message
FatMom
n00b
n00b


Joined: 23 Feb 2006
Posts: 62

PostPosted: Fri Aug 18, 2006 7:51 pm    Post subject: Reply with quote

Why dont you use march=k8 or athlon64 with a i686 chost... thats what I'm currently using, and its working just fine, just dont forget to pick a 686 livecd... not amd64 or you'll run into problems when trying to compile the kernel.
Back to top
View user's profile Send private message
A Dragoon
n00b
n00b


Joined: 18 Aug 2006
Posts: 4

PostPosted: Fri Aug 18, 2006 9:54 pm    Post subject: Reply with quote

Why use athlon64 or k8 when I'm not using nor compiling anything that would take advantage of athlon64 or k8?
Back to top
View user's profile Send private message
Enverex
Guru
Guru


Joined: 02 Jul 2003
Posts: 501
Location: Worcester, UK

PostPosted: Sat Aug 19, 2006 10:23 am    Post subject: Reply with quote

All the dual core AMD chips (on the Athlon line) are "X2" if they are dual core.
Back to top
View user's profile Send private message
olger901
l33t
l33t


Joined: 17 Mar 2005
Posts: 625

PostPosted: Sat Aug 19, 2006 10:42 am    Post subject: Reply with quote

I do not agree, you should use -march=k8 or -march=athlon64 no matter if you are using a 32-bit or 64-bit version of gentoo.
-march=k8 does not mean it compiles for 64-bit only, but is a processor optimization (architecture) set. The CHOST value is used to set wheter you are compiling 32-bit or 64-bit.
Back to top
View user's profile Send private message
hoyanf
Tux's lil' helper
Tux's lil' helper


Joined: 27 Aug 2005
Posts: 80
Location: Malaysia

PostPosted: Sat Aug 19, 2006 6:03 pm    Post subject: Reply with quote

I agree with olger901.. I've been using the -march=k8 or -march=athlon64 on x86 platform... I've even tried -march -mtune without any problems...

the only problem you'll face is if you've enabled USE=amd64 use flag.. with the use flag it'll do both 32bit n 64bit lib's.. as far as i've realized after base system compile on perl libs was on both 32 n 64..

then i removed the amd64 use flag n recompiled the whole system n as expected got the 64bit libs removed...

for those on a x86 (32bit) system should never use the amd64 USE flags...
_________________
WorkPC -> Xeon x3440 | Gigabyte P55-UD6 | 16GB DDR3 | HDD1 - 600GB | HDD2 - 500 GB | HDD3 - 1TB
HomePC -> Xeon x3320 | Gigabyte GA-EP45-UD3P | 8GB DDR2 | HDD1 - 500GB | HDD2 - 1TB
Back to top
View user's profile Send private message
zietbukuel
l33t
l33t


Joined: 30 Dec 2005
Posts: 607

PostPosted: Fri Sep 01, 2006 4:36 am    Post subject: Reply with quote

Is it safe to use -O3??

I want to use this:

Code:
CFLAGS="-march=athlon64 -pipe -O3 -msse3 -fomit-frame-pointer"


Thanks
Back to top
View user's profile Send private message
juantxorena
Apprentice
Apprentice


Joined: 19 Mar 2006
Posts: 201
Location: The Shire

PostPosted: Fri Sep 01, 2006 8:28 pm    Post subject: Reply with quote

zietbukuel wrote:
Is it safe to use -O3??

I want to use this:

Code:
CFLAGS="-march=athlon64 -pipe -O3 -msse3 -fomit-frame-pointer"


Thanks

No, -O3 is not safe.

I think that some people misunderstand what "optimization" means. Optimization is not a thing that add more speed. Is a way to improve a specific aspect of a process minimizing unwanted side effects (ok, it isn't a very precise definition, but it may work). As far as I know, some flags improve things related to speed, or size, but some other improve other aspects of the compilation process (I don't know which ones, I don't know about compilers very much) that have a increase in size or a speed decrement as a side effect (or worse, a loss of stability). Therefore, turning on a lot of flags is not good, because you will have a loss of some things you are interested, like speed, small size or stability, to have some positive effects in some things you aren't interested, like debugging info.

Unless you know which flags -O3 activates, you know what they do and you are interested in these optimizations, -O2 or -Os are the only sane way to compile everything in a "standar architecture" (x86, amd64, ppc, ia64, etc. I don't know what CFLGAS must be used to strange archs like Z80).
_________________
I cannot write English very well. Please, correct any mistake so that I can improve.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum