View previous topic :: View next topic |
Do you think global CFLAGS are harmful? |
Yes |
|
63% |
[ 39 ] |
No |
|
36% |
[ 22 ] |
|
Total Votes : 61 |
|
Author |
Message |
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Mon Apr 03, 2006 4:32 pm Post subject: Are extreme global CFLAGS harmful? |
|
|
I love options and all, but I am starting to believe that higher level optimization with global CFLAGS is bad.
I can understand CFLAGS="-march=x -Ox -pipe -fomit-frame-pointer", but anything beyond that globally is beginning to no longer make sense.
While some CFLAGS help some, they hurt others, so adding any CFLAGS beyond those I've already mentioned, creates the issue, "Would I prefer more performance here, and less performance here?"
What if someone could create a syncable database for per-package CFLAGS, and create test-bed for that?
What do you think would be a good idea for fixing this? Performance and stability being the goal. _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog
Last edited by vipernicus on Tue Apr 04, 2006 11:11 am; edited 2 times in total |
|
Back to top |
|
|
XenoTerraCide Veteran
Joined: 18 Jan 2004 Posts: 1418 Location: MI, USA
|
Posted: Mon Apr 03, 2006 5:42 pm Post subject: |
|
|
yeah I thought it would it would be good to be able to do cflags like we can now do use flags on a per package basis. because even -fomit-frame-pointer has been known to break certain packages noatun comes to mind. and breaks debugging on many, in which case it would be nice to disable it for that package like I can use flags. _________________ I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help. |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Mon Apr 03, 2006 6:17 pm Post subject: |
|
|
I wouldn't know if it were possible, but I think there should be a movement in testing most used apps with various levels of optimization and automatically setting those optimizations for the user if they set a USE flag of "auto-optimize". Make them "Gentoo-Dev approved" maybe. I think that would be ideal for performance, if I could set my make.conf with an march=x option, an option for default_opt=-Ox. Then each ebuild could pull that package's tested set of performance flags to tag on to a user's set of defaults. This could help bugs.gentoo.org, and the user I believe. _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog
Last edited by vipernicus on Mon Apr 03, 2006 6:32 pm; edited 1 time in total |
|
Back to top |
|
|
XenoTerraCide Veteran
Joined: 18 Jan 2004 Posts: 1418 Location: MI, USA
|
Posted: Mon Apr 03, 2006 6:20 pm Post subject: |
|
|
I think most of the time people try to use stupid code breaking "ricer" optimization and that's bad for most software, however -fomit-frame-pointer is usually stable but in certain cases it would be nice to disable for only individual packages. _________________ I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help. |
|
Back to top |
|
|
drwook Veteran
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Mon Apr 03, 2006 6:31 pm Post subject: |
|
|
I think the 'problem' is that the only mechanism generally is stripping users flags in ebuilds, rather than adding known-safe flags. E.g. setiathome could do better than '-O2 -march=x', so why not set every CFLAG you can find on the web and then bug the devs for 'broken ebuilds' when the uber-crazy ones aren't filtered? |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Mon Apr 03, 2006 7:05 pm Post subject: |
|
|
drwook wrote: | I think the 'problem' is that the only mechanism generally is stripping users flags in ebuilds, rather than adding known-safe flags. E.g. setiathome could do better than '-O2 -march=x', so why not set every CFLAG you can find on the web and then bug the devs for 'broken ebuilds' when the uber-crazy ones aren't filtered? |
That's what I'm saying, adding a new project for safe and tested cflags for optimum performance for those who want to use the 'auto-optimize' function, that could strip all flags, and use those that are in a cflag database. _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
|
Back to top |
|
|
Glorandar n00b
Joined: 15 Jun 2003 Posts: 64 Location: Vancouver, BC, Canada
|
Posted: Mon Apr 03, 2006 8:35 pm Post subject: |
|
|
Taking away folks' options, due to the inexperience of some, is, IMO, a bad idea.
Sure CFLAGS can be abused. But so can plenty of other things.
I agree entirely, that it seems to be a best practice to keep the CFLAGS simple.
Yet I suspect that some would disagree with that statement.
IMO fundamentally, Gentoo is all about choice, a theme that I fully support. Hence I support the continued existence of CFLAGS within /etc/make.conf _________________ ----- Glorandar |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Mon Apr 03, 2006 8:43 pm Post subject: |
|
|
Glorandar wrote: | Taking away folks' options, due to the inexperience of some, is, IMO, a bad idea.
Sure CFLAGS can be abused. But so can plenty of other things.
I agree entirely, that it seems to be a best practice to keep the CFLAGS simple.
Yet I suspect that some would disagree with that statement.
IMO fundamentally, Gentoo is all about choice, a theme that I fully support. Hence I support the continued existence of CFLAGS within /etc/make.conf |
You've misunderstood me. I use global performance flags, but I believe you can get more performance out of per package cflags, and to save the extensive testing per user, having a crew of individuals who test a set of performance flags on an individual application and provide performance options. I just do not think that one set of performance flags can benefit all packages without detrimenting others. _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog |
|
Back to top |
|
|
slycordinator Advocate
Joined: 31 Jan 2004 Posts: 3065 Location: Korea
|
Posted: Mon Apr 03, 2006 9:59 pm Post subject: |
|
|
vipernicus wrote: |
You've misunderstood me. I use global performance flags, but I believe you can get more performance out of per package cflags, and to save the extensive testing per user, having a crew of individuals who test a set of performance flags on an individual application and provide performance options. I just do not think that one set of performance flags can benefit all packages without detrimenting others. |
The point is that you're removing a choice. A person may not want the cflags that those guys choose. Yet then that person gets forced into using it or having a "package-by-package" override for CFLAGS which becomes crazy to manage.
Then since you'd want to support having one, overriding CFLAGS to begin with you'd let the person set CFLAGS in make.conf like we do now which lots of people would use just for simplicity which leads us back into your issue. |
|
Back to top |
|
|
codergeek42 Bodhisattva
Joined: 05 Apr 2004 Posts: 5142 Location: Anaheim, CA (USA)
|
Posted: Tue Apr 04, 2006 5:08 am Post subject: |
|
|
The wording of the question in your poll is ambiguous. Global CFLAGS are not inherently dangerous (such as the unoffically-recommended "-O2 -march=whatever -pipe"). It's when people go overboard that it becomes very harmful: things like "-O3 -march=whatever -fforce-instructions-to-align-blah -fdo-other-things" etc.
My $0.02... _________________ ~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF |
|
Back to top |
|
|
ciaranm Retired Dev
Joined: 19 Jul 2003 Posts: 1719 Location: In Hiding
|
Posted: Tue Apr 04, 2006 5:52 am Post subject: |
|
|
If we had a slightly better profiles structure, we could remove the need for users to tinker with CFLAGS (and those pesky CPU feature USE flags that everyone gets wrong). Instead, one could just select, say, a pentium4 profile and have perfect CFLAGS from the profile. |
|
Back to top |
|
|
bjweeks n00b
Joined: 06 Jan 2006 Posts: 10
|
Posted: Tue Apr 04, 2006 7:04 am Post subject: |
|
|
ciaranm wrote: | If we had a slightly better profiles structure, we could remove the need for users to tinker with CFLAGS (and those pesky CPU feature USE flags that everyone gets wrong). Instead, one could just select, say, a pentium4 profile and have perfect CFLAGS from the profile. |
Any chance of this happening anytime soon? |
|
Back to top |
|
|
ciaranm Retired Dev
Joined: 19 Jul 2003 Posts: 1719 Location: In Hiding
|
Posted: Tue Apr 04, 2006 7:10 am Post subject: |
|
|
bjweeks wrote: | ciaranm wrote: | If we had a slightly better profiles structure, we could remove the need for users to tinker with CFLAGS (and those pesky CPU feature USE flags that everyone gets wrong). Instead, one could just select, say, a pentium4 profile and have perfect CFLAGS from the profile. |
Any chance of this happening anytime soon? |
Realistically, probably not for x86. There're too many CPU variants out there, and profiles in their current form don't make this very feasible. It's more one of those things that could be done differently if we had a magic new package mangler or somesuch... It's been discussed, but never very seriously. |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Wed Apr 05, 2006 1:10 am Post subject: |
|
|
Wow I cast my vote and it was tied 50:50 (15 votes vs. 15 votes).
I said that it is not harmful to use extreme CFLAGS, but you need to know what you are doing. For a while I was using a string of handpicked CFLAGS and things ran great. I kind of got bored tinkering with them though, so I am not just running the regular gentoo opts.
There are CFLAGS out there that will mess you up, or more likely make your machine slower, but a lot of what people say in the forums is often untrue. One thing that I hate seeing is people saying -funroll-loops will make your binarys slower, when in fact loop unrolling allows for more optimizations to be applied to the code. (Yes yes, In some cases however you will not get a benefit.)
So I think bottom line, is it is ok to use "extreme" CFLAGS, but unless you know something about compiler optimizations, or read the gcc man page in depth, you could screw yourself up. |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Wed Apr 05, 2006 4:03 am Post subject: |
|
|
mikegpitt wrote: | Wow I cast my vote and it was tied 50:50 (15 votes vs. 15 votes).
I said that it is not harmful to use extreme CFLAGS, but you need to know what you are doing. For a while I was using a string of handpicked CFLAGS and things ran great. I kind of got bored tinkering with them though, so I am not just running the regular gentoo opts.
There are CFLAGS out there that will mess you up, or more likely make your machine slower, but a lot of what people say in the forums is often untrue. One thing that I hate seeing is people saying -funroll-loops will make your binarys slower, when in fact loop unrolling allows for more optimizations to be applied to the code. (Yes yes, In some cases however you will not get a benefit.)
So I think bottom line, is it is ok to use "extreme" CFLAGS, but unless you know something about compiler optimizations, or read the gcc man page in depth, you could screw yourself up. |
I think "extreme" cflags are only good on a per-applicatoin basis. _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog |
|
Back to top |
|
|
Tekara n00b
Joined: 01 Feb 2006 Posts: 56 Location: UofI, Moscow
|
Posted: Wed Apr 05, 2006 4:34 am Post subject: |
|
|
Seems that most packages filter out the extreme flags anyway, kde, openoffice and a good number of the small applications that I've emerged have stripped most of the cflags that I have set (I'm trying out the jackass! installation). _________________ The danger from computers is not that they will eventually get as smart as men, but that we will agree to meet them halfway. - Bernard Avishai
Computers are a lot like air conditioners - they both work great until you open windows. |
|
Back to top |
|
|
ciaranm Retired Dev
Joined: 19 Jul 2003 Posts: 1719 Location: In Hiding
|
Posted: Wed Apr 05, 2006 6:03 am Post subject: |
|
|
Tekara wrote: | Seems that most packages filter out the extreme flags anyway, kde, openoffice and a good number of the small applications that I've emerged have stripped most of the cflags that I have set (I'm trying out the jackass! installation). |
Uh, don't rely upon that protecting you. Filtering of silly flags is something developers only do if they're feeling particularly nice. |
|
Back to top |
|
|
drwook Veteran
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Wed Apr 05, 2006 7:20 am Post subject: |
|
|
I'm just confused as to the value of "-O3 -ftracer -ffastmath -fmudflap -fearly-inlining -fforce-addr...." when you're compiling bash or udev.
Specific programs might benefit from some of these 'crazy' flags, setiathome or games maybe, but do I want a 30MB shell binary because I've got all these set globally? (exaggeration I know )
plus weigh it up with the cost of breakage. a broken udev or shell, or even editor, could cause you a hell of a lot of hassle if you aren't careful and especially for some of the n00bs who get sucked in by cflags and screw up. |
|
Back to top |
|
|
Tekara n00b
Joined: 01 Feb 2006 Posts: 56 Location: UofI, Moscow
|
Posted: Wed Apr 05, 2006 8:18 am Post subject: |
|
|
However though, when you have a fixed set of known hardware, it's wouldn't be horribly dangerous to intelligently add to the cflags on top of the generic ones that the gentoo manual suggests. A common one would be -fweb (included in -O3 wich many users use in lieu) and of course the cxxflag -fvisibility-inlines-hidden which are both reccomended frequently and I have yet to see anyone comment about them causing issues. Well that's at least with gcc3.4, I've seen a few mentions about fweb causing slowdowns in 4.0, but that's something that I haven't been following.
I do agree with you though, drwook, that if a person doesn't do their homework with the flags their liable to break something and of I wouldn't use anything but the most conservative flags on a system that I expected some high level of reliability from. _________________ The danger from computers is not that they will eventually get as smart as men, but that we will agree to meet them halfway. - Bernard Avishai
Computers are a lot like air conditioners - they both work great until you open windows. |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
|
Back to top |
|
|
Tagx n00b
Joined: 18 Apr 2006 Posts: 61
|
Posted: Tue Apr 18, 2006 8:05 pm Post subject: Portage Per Package CFlags |
|
|
I think portage should have an /etc/portage/package.cflags file to specify per package cflags just as package.use allows us to specify per package use flags.
layout...
apps-foo/foo -O1
apps-foo/foo3 -O2 -fomit-frame-pointer -ftree-vectorize
Feel free to modify this if u want. |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Tue Apr 18, 2006 8:24 pm Post subject: Re: Portage Per Package CFlags |
|
|
Tagx wrote: | I think portage should have an /etc/portage/package.cflags file to specify per package cflags just as package.use allows us to specify per package use flags.
layout...
apps-foo/foo -O1
apps-foo/foo3 -O2 -fomit-frame-pointer -ftree-vectorize
Feel free to modify this if u want. |
There is a bash script already that can do this. You can have a package.cflags, a package.cxxflags, and a package.ldflags. _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog |
|
Back to top |
|
|
Fitzzy n00b
Joined: 07 Nov 2005 Posts: 17 Location: Fitzville
|
Posted: Tue Apr 18, 2006 11:28 pm Post subject: |
|
|
The problem is that some specific packages may benefit from certain CFLAGS while other will pay dearly for the use.
For global use, use a minimal set of flags, they will not give you much anyway. Then if there are certain packages that you know can benefit from a certain flag, then add it for that package only.
If you don't know the implications of setting a flag, don't! |
|
Back to top |
|
|
|