Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fast-math question.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
neuron
Advocate
Advocate


Joined: 28 May 2002
Posts: 2371

PostPosted: Mon May 02, 2005 11:11 pm    Post subject: fast-math question. Reply with quote

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
View user's profile Send private message
gentoo_lan
l33t
l33t


Joined: 08 Sep 2004
Posts: 889
Location: Denver, CO

PostPosted: Mon May 02, 2005 11:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
lightvhawk0
Guru
Guru


Joined: 07 Nov 2003
Posts: 388

PostPosted: Sat Aug 27, 2005 2:58 am    Post subject: Reply with quote

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
View user's profile Send private message
neuron
Advocate
Advocate


Joined: 28 May 2002
Posts: 2371

PostPosted: Sat Aug 27, 2005 12:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
nbkolchin
Apprentice
Apprentice


Joined: 07 Feb 2004
Posts: 290
Location: Russia, Saint-Petersburg

PostPosted: Sat Aug 27, 2005 10:29 pm    Post subject: Reply with quote

What problems have "fast-math" with 2.9, 3.x GCC versions? It always generate faster code.
Back to top
View user's profile Send private message
rhill
Developer
Developer


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Sun Aug 28, 2005 4:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
perga
n00b
n00b


Joined: 18 Sep 2004
Posts: 68
Location: SWEDEN

PostPosted: Sun Aug 28, 2005 5:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
nxsty
Veteran
Veteran


Joined: 23 Jun 2004
Posts: 1556
Location: .se

PostPosted: Sun Aug 28, 2005 5:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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