Skip to content

8309204: Obsolete DoReserveCopyInSuperWord#16022

Closed
eme64 wants to merge 5 commits intoopenjdk:masterfrom
eme64:JDK-8309204
Closed

8309204: Obsolete DoReserveCopyInSuperWord#16022
eme64 wants to merge 5 commits intoopenjdk:masterfrom
eme64:JDK-8309204

Conversation

@eme64
Copy link
Contributor

@eme64 eme64 commented Oct 3, 2023

I'm removing CountedLoopReserveKit as discussed in #14168 (JDK-8308917).

I'm also obsolating DoReserveCopyInSuperWord, as it has now no use any more.

Context

During SuperWord, we first analyze the loop, do all profitability and correctness checks for vectorization, and only in SuperWord::output do we finally modify the C2 graph.

However, there could still be some cases where we fail during graph modification. At that point, we have already done some modifications, and now have the followoing options:

  1. Crash (e.g. ShouldNotReachHere, or simply SIGSEGV because of nullptr access etc.)
  2. Undo modifications, revert to before SuperWord.
  3. Bail out of compilation.

With JDK-8136725 (115afda) option 2 was chosen. We make a copy of the whole loop, and if we chose to abort vectorization we would swap in the unmodified copy. It was primarily used for cases where asserts fail (in debug), and in product instead revert to the unmodified copy. The disadvantage to this approach is that we are requiring the cloning/copying of all superword-ed loops - and none of them are really expected to fail and use the copy. There were some additional cases where we had to revert for post-loop-vectorization, but this was recently removed anyway (JDK-8311691).

Additionally, the product flag DoReserveCopyInSuperWord can disable the copy/restore mechanism - and one would hit a ShouldNotReachHere instead. It is unclear why there should be this flag. It was on by default, and until JDK-8311691 it also lead to some bugs (eg. JDK-8308949 where we would crash if the flag was disabled).

Argument

I suggest that the flag DoReserveCopyInSuperWord and CountedLoopReserveKit introduce complexity for what are essentially very rare edge cases (where we hit asserts, but want to continue somehow in product mode).

We should instead chose option 3, and bail out of the compilation (rejecting the inconsistent graph), and retry the compilation without SuperWord. This increases the work for the edge cases that fail for some reason, but avoids the cloning/copying in all normal cases.

CSR

Since DoReserveCopyInSuperWord is a product flag, we require a CSR to obsolate it: JDK-8317419

Testing

Tier1-6 and stress testing (running).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8317419 to be approved

Issues

  • JDK-8309204: Obsolete DoReserveCopyInSuperWord (Enhancement - P4)
  • JDK-8317419: Obsolete DoReserveCopyInSuperWord (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16022/head:pull/16022
$ git checkout pull/16022

Update a local copy of the PR:
$ git checkout pull/16022
$ git pull https://git.openjdk.org/jdk.git pull/16022/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16022

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16022.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 3, 2023

👋 Welcome back epeter! 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
Copy link

openjdk bot commented Oct 3, 2023

@eme64 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 hotspot-compiler-dev@openjdk.org label Oct 3, 2023
@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Oct 3, 2023
@eme64 eme64 changed the title 8309204: C2 SuperWord::output remove use of CountedLoopReserveKit and DoReserveCopyInSuperWord 8309204: Obsolete DoReserveCopyInSuperWord Oct 3, 2023
@eme64 eme64 marked this pull request as ready for review October 3, 2023 14:02
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 3, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 3, 2023

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice cleanup. Looks good.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me otherwise.

Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
@openjdk
Copy link

openjdk bot commented Oct 4, 2023

@eme64 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:

8309204: Obsolete DoReserveCopyInSuperWord

Reviewed-by: kvn, thartmann

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 41 new commits pushed to the master branch:

  • 3630af2: 8316594: C2 SuperWord: wrong result with hand unrolled loops
  • c6c69b5: 8314654: Metaspace: move locking out of MetaspaceArena
  • 3105538: 8316146: Open some swing tests 4
  • 36314a9: 8267509: Improve IllegalAccessException message to include the cause of the exception
  • ddacf92: 8305765: CompressedClassPointers.java is unreliable due to ASLR
  • 4195246: 8317354: Serial: Move DirtyCardToOopClosure to gc/serial folder
  • 0a3a925: 8316414: C2: large byte array clone triggers "failed: malformed control flow" assertion failure on linux-x86
  • b0d6c84: 8316396: Endless loop in C2 compilation triggered by AddNode::IdealIL
  • a8549b6: 8280120: [IR Framework] Add attribute to @ir to enable/disable IR matching based on the architecture
  • 9718f49: 8317452: [JVMCI] Export symbols used by lightweight locking to JVMCI compilers.
  • ... and 31 more: https://git.openjdk.org/jdk/compare/516cfb135f7e5fefaf6e6f2928f6ecb88806f1ef...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 ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Oct 4, 2023
@eme64
Copy link
Contributor Author

eme64 commented Oct 5, 2023

Thanks @vnkozlov for the help, thanks @TobiHartmann for the review, and thanks @jddarcy for the CSR approval!
/integrate

@openjdk
Copy link

openjdk bot commented Oct 5, 2023

Going to push as commit 1ed9c76.
Since your change was applied there have been 41 commits pushed to the master branch:

  • 3630af2: 8316594: C2 SuperWord: wrong result with hand unrolled loops
  • c6c69b5: 8314654: Metaspace: move locking out of MetaspaceArena
  • 3105538: 8316146: Open some swing tests 4
  • 36314a9: 8267509: Improve IllegalAccessException message to include the cause of the exception
  • ddacf92: 8305765: CompressedClassPointers.java is unreliable due to ASLR
  • 4195246: 8317354: Serial: Move DirtyCardToOopClosure to gc/serial folder
  • 0a3a925: 8316414: C2: large byte array clone triggers "failed: malformed control flow" assertion failure on linux-x86
  • b0d6c84: 8316396: Endless loop in C2 compilation triggered by AddNode::IdealIL
  • a8549b6: 8280120: [IR Framework] Add attribute to @ir to enable/disable IR matching based on the architecture
  • 9718f49: 8317452: [JVMCI] Export symbols used by lightweight locking to JVMCI compilers.
  • ... and 31 more: https://git.openjdk.org/jdk/compare/516cfb135f7e5fefaf6e6f2928f6ecb88806f1ef...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 5, 2023
@openjdk openjdk bot closed this Oct 5, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 5, 2023
@openjdk
Copy link

openjdk bot commented Oct 5, 2023

@eme64 Pushed as commit 1ed9c76.

💡 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 hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants