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

8279622: C2: miscompilation of map pattern as a vector reduction #8464

Closed
wants to merge 3 commits into from

Conversation

robcasloz
Copy link
Contributor

@robcasloz robcasloz commented Apr 29, 2022

The node reduction flag (Node::Flag_is_reduction) is only valid as long as the node remains within the reduction loop in which it was originally marked. This changeset ensures that reduction nodes are unmarked as such if they are extracted out of their associated reduction loop by the peel/main/post loop transformation (PhaseIdealLoop::insert_pre_post_loops()). This prevents SLP from wrongly vectorizing, as parallel reductions, outer non-reduction loops to which reduction nodes have been extracted. A more detailed analysis of the failure is available in the JBS bug report.

The issue could be alternatively fixed at the IGVN level by unmarking reduction nodes as soon as they are decoupled from their corresponding phi and counted loop nodes, but the fix proposed here is simpler and less intrusive.

The changeset also introduces an assertion at the use point (SuperWord::transform_loop()) to check that loops containing reduction nodes are marked as reductions. This invariant could be alternatively placed together with other assertions under -XX:+VerifyLoopOptimizations, but this option is known to be broken.

IR verification using the IR test framework is not feasible for the proposed test case, since the failure is triggered on a OSR compilation, for which IR verification does not seem to be supported. The assertion described above compensates this limitation.

Testing

Functionality
  • hs-tier1-3 (windows-x64, linux-x64, linux-aarch64, and macosx-x64; release and debug mode).
  • hs-tier4-7 (linux-x64; debug mode).
Performance
  • No significant regression on a set of standard benchmark suites (DaCapo, SPECjbb2015, SPECjvm2008, ...) and on windows-x64, linux-x64, linux-aarch64, and macosx-x64.
  • No significant difference in generated number of vector instructions when comparing the output of compiler/vectorization and compiler/loopopts/superword tests using -XX:+TraceNewVectors on linux-x64.

Progress

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

Issue

  • JDK-8279622: C2: miscompilation of map pattern as a vector reduction

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8464

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 29, 2022

👋 Welcome back rcastanedalo! 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 Apr 29, 2022

@robcasloz 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 Apr 29, 2022
@robcasloz robcasloz marked this pull request as ready for review April 29, 2022 10:56
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 29, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 29, 2022

Webrevs

Copy link
Contributor

@rwestrel rwestrel left a comment

Choose a reason for hiding this comment

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

That looks good to me.

@openjdk
Copy link

openjdk bot commented Apr 29, 2022

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

8279622: C2: miscompilation of map pattern as a vector reduction

Reviewed-by: roland, 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 87 new commits pushed to the master branch:

  • 9795ef5: 8285851: Cleanup C2AtomicParseAccess::needs_pinning()
  • 3eb661b: 8285890: Fix some @param tags
  • d9541c5: 8276202: LogFileOutput.invalid_file_vm asserts when being executed from a read only working directory
  • df7fba1: 8284981: Support the vectorization of some counting-down loops in SLP
  • e54f26a: 8284992: Fix misleading Vector API doc for LSHR operator
  • 2dd882a: 8254759: [TEST_BUG] [macosx] javax/swing/JInternalFrame/4202966/IntFrameCoord.html fails
  • 23f022b: 8285945: [BACKOUT] JDK-8285802 AArch64: Consistently handle offsets in MacroAssembler as 64-bit quantities
  • 116763c: 8284331: Add sanity check for signal handler modification warning.
  • 95d38bb: 8285773: Replace Algorithms.eatMemory(...) with WB.fullGC() in vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java
  • cd8709e: 8284883: JVM crash: guarantee(sect->end() <= sect->limit()) failed: sanity on AVX512
  • ... and 77 more: https://git.openjdk.java.net/jdk/compare/e333cd33d17721bd762bfa10db1899a391556011...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 Pull request is ready to be integrated label Apr 29, 2022
@robcasloz
Copy link
Contributor Author

That looks good to me.

Thanks for the review, Roland!

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.

Good.

@robcasloz
Copy link
Contributor Author

Good.

Thanks for reviewing, Vladimir!

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.

Nice analysis, looks good to me!

@robcasloz
Copy link
Contributor Author

Nice analysis, looks good to me!

Thanks, Tobias!

@robcasloz
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented May 3, 2022

Going to push as commit 6fcd322.
Since your change was applied there have been 103 commits pushed to the master branch:

  • af1ee1c: 8283684: IGV: speed up filter application
  • 7a48351: 8280568: IGV: Phi inputs and pinned nodes are not scheduled correctly
  • 64b5b2b: 8282828: CDS uncompressed oops archive is not deterministic
  • 45ca81f: 8285915: failure_handler: gather the contents of /etc/hosts file
  • 3420a1a: 8286013: Incorrect test configurations for compiler/stable/TestStableShort.java
  • fbcd874: 8285979: G1: G1SegmentedArraySegment::header_size() is incorrect since JDK-8283368
  • 50a4df8: 8286024: PKCS12 keystore shows "DES/CBC" as the algorithm of a DES SecretKeyEntry
  • f973b78: 8286028: Some -Xlint keys are missing in javac man page
  • 9d8c3bf: 8285745: Re-examine PushbackInputStream mark/reset
  • 41de506: 8285507: revert fix for JDK-8282704 now that JDK-8282952 is fixed
  • ... and 93 more: https://git.openjdk.java.net/jdk/compare/e333cd33d17721bd762bfa10db1899a391556011...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 3, 2022

@robcasloz Pushed as commit 6fcd322.

💡 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.

4 participants