This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Setting -frounding-math by default


Joseph S. Myers wrote:
On Sun, 8 Mar 2009, Sylvain Pion wrote:

this pragma.  I nevertheless try to find grants for funding
people to implement some related things in GCC.  And I also
contribute time to help in the guidance of GCC with my
expertise in this particular area, even if it requires a lot
of time to convince people.  So, please...

Finding funding for implementing standard pragmas and completing the -frounding-math implementation is likely to be more productive than arguing about a default for an option that is known to have problems.

I disagree. My opinion is that : - the C99 pragma is not the best thing that can be done, and if after 10 years nobody has done it in GCC, it can also mean that it does not feel the needs as correctly as it was supposed to. - C++ does not have it, so what's the plan for C++ ?

Related to this, I argue that -frounding-math is not appropriately
defined (see my other mail on splitting it in 2 parts, with different
defaults for these 2 parts).

So we must discuss it *before* we start hacking on code or funding proposals.

All the people discussing the issue are familiar with the floating point optimization issues in GCC. (I have added many such bugs to the dependencies of bug 16989 in the past to help track them, and just added some more.) Since as far as I know all work done on the floating-point issues has been done as volunteers, time spent discussing the defaults is only going to mean time not available for implementing this or other features.

Please step back and listen, it is sometimes worth it.


The default is in accordance with standard requirements, and more more
conservative than other compilers which tend to enable their -ffast-math
equivalents by default rather than just -fno-rounding-math.
At least these others have chosen to do it more consistently.
They don't claim their default is anything sane at all for
serious FP computations, which at least is clear.

GCC does not try to make such a claim; it depends entirely on your definition of "serious FP computations", which is clearly a bikeshed

Sure.


discussion even if the discussion of defaults isn't. GCC provides various options and documents the defaults. The defaults are deliberate decisions (and as such the adoption of those decisions cannot meaningfully be considered a regression: it's not a bug but a feature), but are more likely to change in the other direction from what you want.

Which makes it yet another case that translation-unit level defaults won't solve this issue, and that these things should be made controllable at a finer granularity, in the source code. This is what the C99 pragma is supposed to do, but as I said, it would not be ideal anyway even if implemented.

It is incomplete as it would prevent constant propagation through
directed rounding operations.

C++0x aims at improving the situation concerning constant propagation,
with "constexpr".

I have therefore worked on N2811
http://www.open-std.org/JTC1/sc22/wg21/docs/papers/2008/n2811.pdf
in order to provide a way to do things better than the pragma
and with a better interaction with constant propagation.
This proposal is aimed at being ideal for interval arithmetic
and related ocmputations dealing with the rounding mode
(I'll issue a revision of the document soon, based on the feedback
I got at Summit).
This is C++ syntax, but the core proposal is basically to add
compiler built-ins to do FP operations with a specified rounding
mode, so you may imagine a C or Fortran interface as well.

(I don't claim N2811 is as complete as we could imagine it,
it is driven my the interval arithmetic needs, and I would love
to see other experts comment on it)


A more general side remark is that it is really a pitty that the expertise in these domains is split among the C, C++ and Fortran committees. This is a reason why I proposed to create a dedicated working group for scientific computing in C++ (which might actually get real) and which would allow to gather scientific experts and focus on scientific aspects (numerics being one of them), while still having a relation with the dominant language, C++, but without bothering non-C++ experts too much with purely C++ aspects.


Moreover, standards are far from saying anything about the best default
for -frounding-math, it's a GCC matter.  And GCC maintainers should
be able to listen to expert users to help them making good choices.

GCC maintainers must also bear in mind the bulk of users for whom the default options, complete with other issues such as x87 excess precision, are just fine, and the value of good benchmark scores in marketing GCC. (You will of course nevertheless note that I have fixed PR 323 for C for 4.5.)

Yep, I did note, and this is impressive work. Though, as a C++ user, I won't see the benefit of it for now unfortunately :(

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]