Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Gentoo Chat
  • Search

Funroll-loops

Opinions, ideas and thoughts about Gentoo. Anything and everything about Gentoo except support questions.
Post Reply
  • Print view
Advanced search
11 posts • Page 1 of 1
Author
Message
solafidefarms
n00b
n00b
Posts: 69
Joined: Thu Feb 02, 2006 4:43 pm

Funroll-loops

  • Quote

Post by solafidefarms » Mon Nov 05, 2007 11:06 pm

I know that funroll-loops is ricing, but I don't recall why -funroll-loops is bad. From what I read on the gcc documentation page:
-funroll-loops
Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. -funroll-loops implies -frerun-cse-after-loop, -fweb and -frename-registers. It also turns on complete loop peeling (i.e. complete removal of loops with small constant number of iterations). This option makes code larger, and may or may not make it run faster.

Enabled with -fprofile-use
I don't see anything about it being unsafe. Has anyone successfully compiled their world with -funroll-loops, and given this info from the documentation, is it not unsafe to put it in my cflags?
Ephesians 2:8-9: For by grace are ye saved through faith; and that not of yourselves, it is the gift of God, not of works, lest any man should boast.

Death to Brobdingnagian expressions! On with pulchritude!
Top
dnadesign
Apprentice
Apprentice
User avatar
Posts: 172
Joined: Sat Dec 23, 2006 6:53 pm
Location: Poland
Contact:
Contact dnadesign
Website

  • Quote

Post by dnadesign » Mon Nov 05, 2007 11:27 pm

Yes, I don't see a reason either. It makes the code larger, thus making it more memory consuming, but still it can make it faster (but it's not a must). As for me: I currently don't use -funroll-loops and I can't say, that I'm suffering performence loss. Actually the system performance and latency have never been better. :D
MacBook Pro 5.1
Intel C2D 2.53 GHz, 4GB RAM DDR3, GF 9400M and 9600M GT 512MB
Top
Akkara
Bodhisattva
Bodhisattva
User avatar
Posts: 6702
Joined: Tue Mar 28, 2006 12:27 pm
Location: &akkara

  • Quote

Post by Akkara » Mon Nov 05, 2007 11:31 pm

Re: unsafe: This option is rarely used so it is more likely that there's a compiler bug lurking that slipped past testing.

Re: benefits: Seems questionable at best. A loop that is really run often might benefit. But few loops are that performance-critical. Many loops are initialization-code sections. Things like "zero out array". "Create table of sine values...". "Malloc a bunch of pointers-to-whatevers" Stuff like that. And all this option does is to bloat all those non-critical loops, making programs load slower, taking up more space in the cpu's cache which causes more memory fetches and generally only ends up slowing everything down.

The option is meant for that one really critical "the work is done here" file, that is specially compiled in the makefile with this option, while leaving it off the 90% of code that does setup and other ancillary stuff.
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

  • Quote

Post by i92guboj » Mon Nov 05, 2007 11:51 pm

As someone said above, it "usefulness" is -at least- questionable. It can be ok for a well known section of code, but I wouldn't set it globally to compile everything.
Top
neuron
Advocate
Advocate
User avatar
Posts: 2371
Joined: Tue May 28, 2002 7:43 pm

  • Quote

Post by neuron » Tue Nov 06, 2007 10:11 am

personally I would never build world with it, but I did modify the wine ebuild a while ago to use it, to see if it helped performance at all (and if I remember correctly, it didn't :p). If you need more performance out of one particular application, try it, but recompiling world with it will speed some things up, slow other things down, and might give you some cryptic problems later on.
Top
transient
l33t
l33t
Posts: 759
Joined: Thu Jan 13, 2005 5:30 am

  • Quote

Post by transient » Tue Nov 06, 2007 12:23 pm

Loop unrolling is one of those things that should be decided by the programmer (and sometimes the compiler), not by the end-user.
Top
beatryder
Veteran
Veteran
User avatar
Posts: 1138
Joined: Fri Apr 08, 2005 12:27 am
Contact:
Contact beatryder
Website

  • Quote

Post by beatryder » Tue Nov 06, 2007 11:52 pm

When I first started using Gentoo >2 years ago, I used it, once I recompiled without it, I didn't notice the difference in terms of the operating speed of the program, but task switching and loading was faster *without* funroll-loops.
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Top
unK
l33t
l33t
User avatar
Posts: 769
Joined: Tue Feb 06, 2007 5:08 pm

Re: Funroll-loops

  • Quote

Post by unK » Wed Nov 07, 2007 1:59 pm

solafidefarms wrote:Has anyone successfully compiled their world with -funroll-loops, and given this info from the documentation, is it not unsafe to put it in my cflags?
Yes, I compiled whole world with these flags:

Code: Select all

-O2 -march=native -pipe -fomit-frame-pointer -fno-ident -funroll-loops -ftracer
And everything compiled fine with them. I did this because I was just curious about -funroll-loops and its influence on performance and actually I don't see any major difference (well, start of xorg-server takes about 1 extra second, to be honest). I didn't make any tests, so I won't say some programs are faster (although I feel so), because I don't know whether they are really faster. Only lame is faster for sure.
Top
steveL
Watchman
Watchman
Posts: 5153
Joined: Wed Sep 13, 2006 1:18 pm
Location: The Peanut Gallery

Re: Funroll-loops

  • Quote

Post by steveL » Wed Nov 07, 2007 2:15 pm

unK wrote:I didn't make any tests, so I won't say some programs are faster (although I feel so), because I don't know whether they are really faster. Only lame is faster for sure.
Interesting. It'd be good to [topic=499881]do this for individual apps[/topic], profile and tabulate the results.
Top
mikegpitt
Advocate
Advocate
User avatar
Posts: 3224
Joined: Sat May 22, 2004 6:49 pm

  • Quote

Post by mikegpitt » Thu Nov 08, 2007 2:31 am

I don't think funroll-loops is 'ricing'. In fact, it is a very old static optimization technique. The real advantage comes in where by unrolling a loop the compiler may be able to better take advantage of additional optimizations. I used to run it for a long while, and fundementally I wouldn't consider it unsafe.

I personally think people make too big a deal about it bloating your executables, but I've never really looked to see the different base system size of a loop unrolled install vs not.
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

  • Quote

Post by i92guboj » Thu Nov 08, 2007 3:16 am

mikegpitt wrote:I don't think funroll-loops is 'ricing'. In fact, it is a very old static optimization technique. The real advantage comes in where by unrolling a loop the compiler may be able to better take advantage of additional optimizations. I used to run it for a long while, and fundementally I wouldn't consider it unsafe.
Most flags, per sé, are not "ricing". "Ricing" is more like an "state of mind". A flag becomes dangerous or counterproductive when uninformed people use it to "optimize" their systems. Then is when "ricing" is born. Most flags have a sense, and can be used productively on certain circumstances, it is the ricer who gives the ricing value to a CFLAG, and not the CFLAG itself.
Top
Post Reply
  • Print view

11 posts • Page 1 of 1

Return to “Gentoo Chat”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy