Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8275847: Scheduling fails with "too many D-U pinch points" on small method #6131

Closed
wants to merge 2 commits into from

Conversation

nick-arm
Copy link
Member

@nick-arm nick-arm commented Oct 27, 2021

Since around JDK 16 the following method cannot be compiled by C2 on AArch64:

  public double mergeSync() { return Math.log(Math.sin(value)); }

(Reduced from a slightly larger benchmark.)

  811 416 ! 3 Test::mergeSync (61 bytes)
  813 417 ! 4 Test::mergeSync (61 bytes)
  816 417 ! 4 Test::mergeSync (61 bytes) COMPILE SKIPPED: too many D-U pinch points (retry at different tier)
  816 418 ! 1 Test::mergeSync (61 bytes)

Scheduling::anti_do_def() will create temporary Nodes for each OptoReg killed by the MachProjs from the two runtime leaf calls. After SVE support was added these runtime calls kill more registers, and the number of new Nodes added by anti_do_def exceeds an internal limit (which is based on the LRG map size and roughly proportional to the method size).

X86 has the same problem if OptoScheduling is enabled because of the wide AVX registers.

The fix here is to ignore OptoRegs which correspond to the high slots of wide vectors (i.e. slots above 64 bits). The scheduler doesn't run on methods where C->max_vector_size() > 8, so we know these kills can't affect the scheduling result.

The added test fails on the current JDK with:

  compiler.lib.ir_framework.shared.TestRunException: Could not compile public double
  compiler.c2.irTests.TestScheduleSmallMethod.testSmallMethodTwoRuntimeCalls(double) at level C2
  after 10s. Last compilation level: 3

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8275847: Scheduling fails with "too many D-U pinch points" on small method

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6131/head:pull/6131
$ git checkout pull/6131

Update a local copy of the PR:
$ git checkout pull/6131
$ git pull https://git.openjdk.java.net/jdk pull/6131/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6131

View PR using the GUI difftool:
$ git pr show -t 6131

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6131.diff

…ethod

Since around JDK 16 the following method cannot be compiled by C2 on
AArch64:

  public double mergeSync() { return Math.log(Math.sin(value)); }

(Reduced from a slightly larger benchmark.)

  811 416 ! 3 Test::mergeSync (61 bytes)
  813 417 ! 4 Test::mergeSync (61 bytes)
  816 417 ! 4 Test::mergeSync (61 bytes) COMPILE SKIPPED: too many D-U pinch points (retry at different tier)
  816 418 ! 1 Test::mergeSync (61 bytes)

Scheduling::anti_do_def() will create temporary Nodes for each OptoReg
killed by the MachProjs from the two runtime leaf calls.  After SVE
support was added these runtime calls kill more registers, and the
number of new Nodes added by anti_do_def exceeds an internal
limit (which is based on the LRG map size and roughly proportional to
the method size).

X86 has the same problem if OptoScheduling is enabled because of the
wide AVX registers.

The fix here is to ignore OptoRegs which correspond to the high slots of
wide vectors (i.e. slots above 64 bits).  The scheduler doesn't run on
methods where C->max_vector_size() > 8, so we know these kills can't
affect the scheduling result.

The added test fails on the current JDK with:

  compiler.lib.ir_framework.shared.TestRunException: Could not compile public double
  compiler.c2.irTests.TestScheduleSmallMethod.testSmallMethodTwoRuntimeCalls(double) at level C2
  after 10s. Last compilation level: 3
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 27, 2021

👋 Welcome back ngasson! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Oct 27, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 27, 2021

@nick-arm The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-compiler label Oct 27, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 27, 2021

Webrevs

Copy link
Member

@TobiHartmann TobiHartmann left a comment

While looking at the usages of is_concrete, I found that all current usages outside of asserts are dead:

if (false && r->is_reg() && !r->is_concrete()) {

if (b->is_stack() || b->is_concrete() || true ) {

if (b->is_stack() || b->is_concrete() || true ) {

if ( callee->is_concrete() || true ) {

I think we should clean that up.

src/hotspot/cpu/x86/vmreg_x86.hpp Outdated Show resolved Hide resolved
@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Oct 29, 2021

While looking at the usages of is_concrete, I found that all current usages outside of asserts are dead:

Looks like it's been like that since the initial public commit in 2007. I folded the && false, || true uses.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Looks good to me but a second review would be good.

/reviewers 2

@openjdk
Copy link

@openjdk openjdk bot commented Nov 1, 2021

@nick-arm This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8275847: Scheduling fails with "too many D-U pinch points" on small method

Reviewed-by: thartmann, kvn

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 139 new commits pushed to the master branch:

  • b01f107: 8276252: java/nio/channels/Channels/TransferTo.java failed with OOM java heap space error
  • 92d2176: 8273967: gtest os.dll_address_to_function_and_library_name_vm fails on macOS12
  • a74a839: 8276571: C2: pass compilation options as structure
  • c393ee8: 8276632: Use blessed modifier order in security-libs code
  • 7023b3f: 8276628: Use blessed modifier order in serviceability code
  • b933136: 8276641: Use blessed modifier order in jshell
  • 0616d86: 8276635: Use blessed modifier order in compiler code
  • d95299a: 8276634: Remove usePlainDatagramSocketImpl option from the test DatagramChannel/SendReceiveMaxSize.java
  • 3c0faa7: 8276173: Clean up and remove unneeded casts in HeapDumper
  • 323d201: 8275506: Rename allocated_on_stack to allocated_on_stack_or_embedded
  • ... and 129 more: https://git.openjdk.java.net/jdk/compare/9f75d5ce500886b32175cc541939b7f0eee190ca...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Nov 1, 2021
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Seems fine to me but I need to run testing before approval.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Testing results look good.

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Nov 8, 2021

Thanks for the reviews. The Windows x64 build failure looks to be spurious, I re-ran the GitHub actions here: https://github.com/nick-arm/jdk/runs/4133872978

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Nov 8, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

Going to push as commit 3934fe5.
Since your change was applied there have been 147 commits pushed to the master branch:

  • 44047f8: 8274328: C2: Redundant CFG edges fixup in block ordering
  • 8849154: 8275846: read_base_archive_name() could read past the end of buffer
  • 2653cfb: 8276688: Remove JLinkReproducibleXXXTest from ProblemList.txt
  • c7095b2: 8276207: Properties.loadFromXML/storeToXML works incorrectly for supplementary characters
  • ed7ecca: 8254739: G1: Optimize evacuation failure for regions with few failed objects
  • 59c3dcc: 8276746: Add section on reproducible builds in building.md
  • 0e0dd33: 8276129: PretouchTask should page-align the chunk size
  • a472433: 8276572: Fake libsyslookup.so library causes tooling issues
  • b01f107: 8276252: java/nio/channels/Channels/TransferTo.java failed with OOM java heap space error
  • 92d2176: 8273967: gtest os.dll_address_to_function_and_library_name_vm fails on macOS12
  • ... and 137 more: https://git.openjdk.java.net/jdk/compare/9f75d5ce500886b32175cc541939b7f0eee190ca...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 8, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 8, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

@nick-arm Pushed as commit 3934fe5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler integrated
3 participants