View previous topic :: View next topic |
Author |
Message |
neuron Advocate


Joined: 28 May 2002 Posts: 2371
|
Posted: Mon May 02, 2005 11:11 pm Post subject: fast-math question. |
|
|
Was just reading through http://www.coyotegulch.com/reviews/gcc4/index.html
and noticed:
Quote: |
Some folk may object to my use of -ffast-math however, in numerous accuracy tests, -ffast-math produces code that is both faster and more accurate than code generated without it. Yes, -ffast-math has other aspects that make for interesting debate; however, such discussions belong in another article. If you don't use -ffast-math, you're ignoring many of your processor's most powerful features.
|
..... what? That's the first time I've heard that. |
|
Back to top |
|
 |
gentoo_lan l33t


Joined: 08 Sep 2004 Posts: 889 Location: Denver, CO
|
Posted: Mon May 02, 2005 11:24 pm Post subject: |
|
|
Well maybe GCC 4 has improved the use of ffast-math. I don't think that I would use it for GCC 3.3 or 3.4. _________________ Registered Linux user# 375038. |
|
Back to top |
|
 |
lightvhawk0 Guru


Joined: 07 Nov 2003 Posts: 388
|
Posted: Sat Aug 27, 2005 2:58 am Post subject: |
|
|
Lol the funny part is on the new opteron/gcc 4.0 test mfpmath=387 with -funsafe-math-optimizations held a %50 improvement on fpu intensive apps. So yeah they've improved on it. _________________ If God has made us in his image, we have returned him the favor. - Voltaire |
|
Back to top |
|
 |
neuron Advocate


Joined: 28 May 2002 Posts: 2371
|
Posted: Sat Aug 27, 2005 12:35 pm Post subject: |
|
|
lightvhawk0 wrote: | Lol the funny part is on the new opteron/gcc 4.0 test mfpmath=387 with -funsafe-math-optimizations held a %50 improvement on fpu intensive apps. So yeah they've improved on it. |
holy.... that's quite impressive! |
|
Back to top |
|
 |
nbkolchin Apprentice


Joined: 07 Feb 2004 Posts: 290 Location: Russia, Saint-Petersburg
|
Posted: Sat Aug 27, 2005 10:29 pm Post subject: |
|
|
What problems have "fast-math" with 2.9, 3.x GCC versions? It always generate faster code. |
|
Back to top |
|
 |
rhill Retired Dev


Joined: 22 Oct 2004 Posts: 1629 Location: sk.ca
|
Posted: Sun Aug 28, 2005 4:16 pm Post subject: |
|
|
er, yes, using -ffast-math generates faster running FP code. this has always been true. the problem is it breaks a few standards to do so, which some programs depend on, specifically assumptions about precision on certain architectures. the end result is anything that requires floating point operations to do what they're expected to do doesn't work properly (and that's quite a few packages).
btw, i'd take anything found on scott's site with a grain of salt. _________________ by design, by neglect
for a fact or just for effect |
|
Back to top |
|
 |
perga n00b

Joined: 18 Sep 2004 Posts: 68 Location: SWEDEN
|
Posted: Sun Aug 28, 2005 5:52 pm Post subject: |
|
|
I recently put together a small mandelbrot set viewer, mainly for benchmarking purposes. Compiling it with -ffast-math produced some impressive speedups, generally the rendering times were reduced by 50 - 66 %. This was using the Gentoo vanilla gcc-3.5.5. _________________ perga |
|
Back to top |
|
 |
nxsty Veteran


Joined: 23 Jun 2004 Posts: 1556 Location: .se
|
Posted: Sun Aug 28, 2005 5:55 pm Post subject: |
|
|
Most apps in portage compiles and runs with -ffast-math and those who breaks usually filters it since it's a commonly used flag. The only packages I know that doesn't filter it is perl and libperl which fails a few test when compiled with -ffast-math.
This is a quote from one of the gcc devs about it from http://gcc.gnu.org/ml/gcc/2005-05/msg01283.html:
"- simple builtin functions (sqrt, sin and cos, etc) can be used with hardware
implemented fsqrt, fsin and fcos insn instead of calling library functions.
These can handle arguments up to (something)*2^63, so it is quite enough for
normal apps. This way, a call overhead (saving all FP registers, overhead of
call insn itself) is eliminated, and as an added bonus, sin and cos of the same
argument are combined as fsincos insn."
So I guess that quote from coyotegulch.com might be at least partly true. |
|
Back to top |
|
 |
|