JDK-8194740 : UseSubwordForMaxVector causes performance regression
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9,10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-01-08
  • Updated: 2019-09-13
  • Resolved: 2018-07-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11 b22Fixed 12Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
While investigating JDK-8194659, I've noticed that disabling UseSubwordForMaxVector (which is enabled by default) improves performance. 

The optimization reduces performance of the SPECjvm2008-MPEG benchmark by up to 3.5% and also affects performance of other benchmarks (see JDK-8194659 for details).
Comments
Testing passed with one timeout.
09-07-2018

I have to update change based on latest jdk/jdk11: ``` diff -r c9bf46f4d555 src/hotspot/share/opto/loopTransform.cpp --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -861,7 +861,9 @@ // Check for being too big if (body_size > (uint)_local_loop_unroll_limit) { - if ((UseSubwordForMaxVector || xors_in_loop >= 4) && body_size < (uint)LoopUnrollLimit * 4) return true; + if ((cl->is_subword_loop() || xors_in_loop >= 4) && body_size < (uint)LoopUnrollLimit * 4) { + return true; + } // Normal case: loop too big return false; } diff -r c9bf46f4d555 src/hotspot/share/opto/loopnode.hpp --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -75,7 +75,8 @@ HasRangeChecks=8192, IsMultiversioned=16384, StripMined=32768, - ProfileTripFailed=65536}; + SubwordLoop=65536, + ProfileTripFailed=131072}; char _unswitch_count; enum { _unswitch_max=3 }; char _postloop_flags; @@ -99,6 +100,7 @@ bool partial_peel_has_failed() const { return _loop_flags & PartialPeelFailed; } bool is_strip_mined() const { return _loop_flags & StripMined; } bool is_profile_trip_failed() const { return _loop_flags & ProfileTripFailed; } + bool is_subword_loop() const { return _loop_flags & SubwordLoop; } void mark_partial_peel_failed() { _loop_flags |= PartialPeelFailed; } void mark_has_reductions() { _loop_flags |= HasReductions; } @@ -112,6 +114,7 @@ void mark_strip_mined() { _loop_flags |= StripMined; } void clear_strip_mined() { _loop_flags &= ~StripMined; } void mark_profile_trip_failed() { _loop_flags |= ProfileTripFailed; } + void mark_subword_loop() { _loop_flags |= SubwordLoop; } int unswitch_max() { return _unswitch_max; } int unswitch_count() { return _unswitch_count; } diff -r c9bf46f4d555 src/hotspot/share/opto/superword.cpp --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -376,6 +376,7 @@ if (same_type) { max_vector = cur_max_vector; flag_small_bt = true; + cl->mark_subword_loop(); } } } ```
09-07-2018

After discussion with Performance group we decided to accept this fix.
09-07-2018

I've submitted performance testing.
12-06-2018

Updated webrev: http://cr.openjdk.java.net/~vdeshpande/SubwordFix/webrev.01/
11-06-2018

[~kvn] SPECjvm2008 is currently broken in dev-submit due to a change in Java fonts. I'm afraid we have to wait for it to to be fixed. I will then submit testing.
11-06-2018

[~thartmann] Tobias, can you rerun performance testing with suggested fix? Thanks! Changes seems fine to me.
08-06-2018

Webrev: http://cr.openjdk.java.net/~vdeshpande/SubwordFix/webrev.00/
07-06-2018

[~vdeshpande], you've implemented JDK-8175096. Could you please have a look?
08-01-2018

ILW = Small performance regression, 3 benchmarks, -XX:-UseSubwordForMaxVector = MMM = P3
08-01-2018