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

8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector #15654

Closed
wants to merge 3 commits into from

Conversation

eme64
Copy link
Contributor

@eme64 eme64 commented Sep 11, 2023

Problem

There is a case where PhaseIdealLoop::move_unordered_reduction_out_of_loop gets a chain of UnorderedReduction which have differing vector lengths. But this can lead to wrong results, as some elements now get dropped or "hallucinated".

Details:
-XX:+AlingVector creates alignment boundaries over which no pack can go. Effectively, it cuts the packs at the alignment boundaries. This can create unexpected series of packs with lengths [4, 8, 4], rather than [8, 8].

Solution

We need to check that all UnorderedReduction have the same vect_type(). That ensures all have the same length and element type.

Testing

I converted the old test into scenario v016-U, and added scenario v032-A (fails without the patch). Also, I added some vanilla scenarios, just to ensure the test cases can be run with other flag combinations. The IR tests are targeted at scenario v016-U.

Tests: tier1-6, stress-testing.


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

Issue

  • JDK-8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15654

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 11, 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 Sep 11, 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 Sep 11, 2023
@eme64 eme64 marked this pull request as ready for review September 11, 2023 11:29
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 11, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 11, 2023

Webrevs

Comment on lines 74 to 77
case "vanilla-U" -> { framework.addFlags("-XX:-AlignVector"); }
case "vanilla-A" -> { framework.addFlags("-XX:+AlignVector"); }
case "v016-U" -> { framework.addFlags("-XX:MaxVectorSize=16"); }
case "v032-A" -> { framework.addFlags("-XX:MaxVectorSize=32", "-XX:+AlignVector"); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to use full words here and in tests ids? v016-U -> VectorSize16-Unaligned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed them. Thanks for the suggestion @vnkozlov !

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Otherwise, looks good!

Comment on lines +74 to +77
case "Vanilla-Unaligned" -> { framework.addFlags("-XX:-AlignVector"); }
case "Vanilla-Aligned" -> { framework.addFlags("-XX:+AlignVector"); }
case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:-AlignVector", "-XX:MaxVectorSize=16"); }
case "MaxVectorSize32-Aligned" -> { framework.addFlags("-XX:+AlignVector", "-XX:MaxVectorSize=32"); }
Copy link
Member

Choose a reason for hiding this comment

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

Since AlignVector and MaxVectorSize are C2 flags, you should add a @requires vm.compiler2.enabled to all @test definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea, done.

@openjdk
Copy link

openjdk bot commented Sep 12, 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:

8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector

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

  • 347beb2: 8315998: Remove dead ClassLoaderDataGraphKlassIteratorStatic
  • 50158f3: 8316002: Remove unnecessary seen_dead_loader in ClassLoaderDataGraph::do_unloading
  • 6f2684b: 8315948: JDK-8315818 broke Xcomp on libgraal
  • 8b4f9a8: 8315990: Amend problemlisted tests to proper position
  • 455c471: 8313277: Resolve multiple definition of 'normalize' when statically linking JDK native libraries with user code
  • 3b422d0: 8316094: Problemlist compiler/rangechecks/TestRangeCheckHoistingScaledIV.java
  • f55e799: 8316038: Fix doc typos in java.io.Console and java.util.Scanner
  • 9480078: 8315550: G1: Fix -Wconversion warnings in g1NUMA
  • d08258f: 8315938: Deprecate for removal Unsafe methods that have standard APIs for many releases
  • fda142f: 8312174: missing JVMTI events from vthreads parked during JVMTI attach
  • ... and 12 more: https://git.openjdk.org/jdk/compare/dab1c213fd2760686a7bf3fc8838f4a21056a954...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 Sep 12, 2023
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.

Looks good.

@eme64
Copy link
Contributor Author

eme64 commented Sep 13, 2023

Thanks @vnkozlov @chhagedorn for the reviews!
/integrate

@openjdk
Copy link

openjdk bot commented Sep 13, 2023

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 13, 2023

@eme64 Pushed as commit f804f86.

💡 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
3 participants