From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marko Karppinen <marko@karppinen.fi>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Sun performance - Major discovery!
Date: Tue, 14 Oct 2003 12:52:57 -0400
Message-ID: <10568.1066150377@sss.pgh.pa.us> (raw)
In-Reply-To: <DEDF8FE1-FC12-11D7-81B6-000A958D89B8@karppinen.fi>
References: <200310081831.h98IVT919657@candle.pha.pa.us>
<DEDF8FE1-FC12-11D7-81B6-000A958D89B8@karppinen.fi>
Marko Karppinen <marko@karppinen.fi> writes:
> At least the --fast-math part causes problems, seeing that PostgreSQL
> actually checks for the __FAST_MATH__ macro to make sure that it isn't
> turned on. There might be other problems with Apple's flags, but I
> think that the __FAST_MATH__ check should be altered.
Removing the check is not acceptable --- we spent far too much time
fighting bug reports that turned out to trace to -ffast-math.
See for example
http://archives.postgresql.org/pgsql-bugs/2002-09/msg00169.php> As you know, setting --fast-math in GCC is the equivalent of setting
> -fno-math-errno, -funsafe-math-optimizations, -fno-trapping-math,
> -ffinite-math-only and -fno-signaling-nans.
I suspect that -funsafe-math-optimizations is the only one of those that
really affects the datetime code, but I would be quite worried about the
side-effects of any of them on the float8 arithmetic routines. Also I
think the behavior of -ffast-math has changed over time; in the gcc
2.95.3 manual I see none of the above and only the description
`-ffast-math'
This option allows GCC to violate some ANSI or IEEE rules and/or
specifications in the interest of optimizing code for speed. For
example, it allows the compiler to assume arguments to the `sqrt'
function are non-negative numbers and that no floating-point values
are NaNs.
Since we certainly do use NaNs, it would be very bad to allow -ffast-math
in gcc 2.95.
gcc 3.2 has some but not all of the sub-flags you list above, so
apparently the behavior changed again as of gcc 3.3.
This means that relaxing the check would require (a) finding out which
of the sub-flags break our code and which don't; (b) finding out how the
answer to (a) has varied with gcc release; and (c) finding out how we
can test whether a given sub-flag is set --- are there #defines for each
of them in gcc 3?
This does not sound real practical to me...
> This would allow people to use CFLAGS="-fast" on their G5s, beat some
> Xeon speed records, and not worry about esoteric IEEE math standards.
In the words of the sage, "I can make this code *arbitrarily* fast ...
if it doesn't have to give the right answer." Those "esoteric"
standards make the difference between printing 5:00:00 and printing
4:59:60.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, marko@karppinen.fi, pgman@candle.pha.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Sun performance - Major discovery!
In-Reply-To: <10568.1066150377@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox