[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] MinGW-w64 gcc-6.3.0 std::rint() anomaly
From: |
Greg Chicares |
Subject: |
Re: [lmi] MinGW-w64 gcc-6.3.0 std::rint() anomaly |
Date: |
Wed, 23 Aug 2017 18:59:40 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 2017-08-20 21:51, Vadim Zeitlin wrote:
>
[... https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81906 ...]
>
> It turns out that it does help us because this bug got closed[*] with "You
> must use -frounding-math" and, indeed, building the test with
> CXXFLAGS=-frounding-math makes it pass. This option seems to be available
> since quite some time, so it shouldn't hurt using it unconditionally, i.e.
> without checking gcc version, for the compilation of this test and other
> tests using fenv_rounding(), i.e. round_test and round_to_test.
Yes, it's certainly needed for the 'round*test' tests as well: while
they report success, they actually do only a small fraction of the
testing they're supposed to perform, because, with this new gcc default,
attempting to change the rounding direction fails silently. It's really
too bad that there's no reasonable way AFAIK for a program to detect
the '-frounding-math' mode in which it is being compiled; if there
were, that could certainly be used to throw an exception like
"Changing the rounding mode is inhibited [-frounding-math]."
when std::fesetround() is called.
> I do wonder
> whether it should be used for the main program itself however, it never
> changes the rounding mode and it seems gcc developers believe that
> -fno-rounding-math has non-negligible performance benefits.
Let's use this command:
/opt/lmi/src/lmi[0]$time make $coefficiency system_test >../log 2>&1
to measure lmi's speed: three runs one way versus three the other way.
WITH the new gcc '-fno-rounding-math' default:
make $coefficiency system_test > ../log 2>&1 124.43s user 49.21s system 586%
cpu 29.618 total
make $coefficiency system_test > ../log 2>&1 123.50s user 50.56s system 584%
cpu 29.780 total
make $coefficiency system_test > ../log 2>&1 124.07s user 49.38s system 588%
cpu 29.479 total
OVERRIDING that new default with '-frounding-math':
make $coefficiency system_test > ../log 2>&1 125.26s user 49.99s system 595%
cpu 29.430 total
make $coefficiency system_test > ../log 2>&1 125.90s user 50.12s system 598%
cpu 29.425 total
make $coefficiency system_test > ../log 2>&1 126.02s user 50.36s system 593%
cpu 29.706 total
I don't believe that the cost of conforming to the C, C++, and IEEE754
standards is actually negative, but this evidence suggests that it is
at worst too small to measure with this test, and therefore too small
to matter.
> [*] Before being reopened for gcc 7 where it is broken even with this flag,
> but this doesn't affect us for now.
Professor Kahan got all this stuff right in the 1970s. We must organize
marches in major cities the world over to raise IEEE754 consciousness.