[8u] RFR: 8210416: [linux] Poor StrictMath performance due to non-optimized compilation

Severin Gehwolf sgehwolf at redhat.com
Tue Apr 30 13:14:53 UTC 2019


Hi Matthias,

Thanks for the review!

On Tue, 2019-04-30 at 12:52 +0000, Baesken, Matthias wrote:
> Hi  Severin,   looks okay to me (not a reviewer however).
> In our  proprietary  JVM8  we had    set  (on
> Linux)    BUILD_LIBFDLIBM_OPTIMIZATION :=
> HIGH   and     FDLIBM_CFLAGS += -ffp-contract=off    for a long time
> and did not observe any issues .

Good to know. We do the same in Fedora, fwiw.

> (but we always build with gcc 4.8.x  so cannot tell much about lower
> gcc versions ).
> 
> But I really wonder - wouldn’t it  be better in the long run to go
> for a min.  gcc versions  >= 4.6   (or even 4.8)   in OpenJDK8  ?
> 
> Maybe some people  from the distros  could  comment on  this .

Perhaps, but it's hard to effectively figure out what that minimal
version should be.

Note that this change for the alternative of -ffp-contract=off was
introduced to JDK 8 by SAP. See:
https://bugs.openjdk.java.net/browse/JDK-8172053

Reading that bug it appears that minimum gcc is version 4.3? Either
way, this patch will do the right thing(tm) for both as far as I could
tell. It would use -mno-fused-madd -fno-strict-aliasing over --ffp-
contract=off.

My focus for this backport was to not break existing behaviour.
Supporting -ffp-contract=off only would also break our upstream build
machinery, as for them we build on RHEL 6 with gcc 4.4.7.

>From our point of view JDK 8 minimal GCC would be 4.4.7 :)

Thanks,
Severin

> 
> Best regards, Matthias
> 
> 
> > -----Original Message-----
> > From: ppc-aix-port-dev <ppc-aix-port-dev-bounces at openjdk.java.net>
> > On
> > Behalf Of Severin Gehwolf
> > Sent: Dienstag, 30. April 2019 13:38
> > To: jdk8u-dev <jdk8u-dev at openjdk.java.net>; build-dev <build-
> > dev at openjdk.java.net>
> > Cc: ppc-aix-port-dev <ppc-aix-port-dev at openjdk.java.net>
> > Subject: [8u] RFR: 8210416: [linux] Poor StrictMath performance due
> > to non-
> > optimized compilation
> > 
> > Hi,
> > 
> > Could I please get a review for this 8u backport related to fdlibm
> > optimization on Linux? The JDK 12 patch doesn't apply as-is as the
> > JDK
> > 8 build system is drastically different from JDK 11+.
> > 
> > Bug: https://bugs.openjdk.java.net/browse/JDK-8210416
> > webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-
> > 8210416/jdk8/02/
> > 
> > The main differences to the original fix are: a) optimization level
> > and
> > b) additional hook for older GCC. This backport keeps the
> > optimization
> > level at -O3 (HIGH) over -O2 (LOW) for JDK 8u as this would
> > otherwise
> > regress Linux ppc64{,le} which currently use -O3. As the current
> > code
> > has the implicit assumption of ppc64 being compiled on older GCCs
> > too
> > (JDK-8172053), this backport maintains compatibility in this
> > regard. If
> > -ffp-contract=off is not available, a machine specific set of flags
> > is
> > being used if the compiler supports them (-mno-fused-madd -fno-
> > strict-
> > aliasing).
> > 
> > For older GCCs (< 4.6) specific machine flags are being used. That
> > is,
> > for ppc64{,le} and x86{,_64}. ppc64{,le} machine specific flags
> > have
> > already been determined (See JDK-8172053). x86_64 and x86 have the
> > same
> > machine specific flags available, so I've used them there too[1].
> > 
> > Testing: build/test on gcc 8.x Linux x86_64. build/test on gcc
> > 4.4.7
> > x86_64/ppc64. Manual inspection of build logs for fdlibm files
> > (e.g.
> > w_asin.c).
> > 
> > Thoughts?
> > 
> > Thanks,
> > Severin
> > 
> > [1] 
> > https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/i386-and-x86_002d64-
> > Options.html#i386-and-x86_002d64-Options
> > 
> > 
> > 
> > 



More information about the build-dev mailing list