Skip to content

8339063: [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only #20724

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

Closed
wants to merge 3 commits into from

Conversation

JoshuaZhuwj
Copy link
Member

@JoshuaZhuwj JoshuaZhuwj commented Aug 27, 2024

Please review this minor enhancement that skips verify_sve_vector_length after native calls.
It works on SVE micro-architecture that only supports 128-bit vector length.


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-8339063: [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20724

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 27, 2024

👋 Welcome back jzhu! 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 Aug 27, 2024

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

8339063: [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only

Reviewed-by: adinn, fgao

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

  • b1163bc: 8256211: assert fired in java/net/httpclient/DependentPromiseActionsTest (infrequent)
  • 03ba37e: 8339169: Remove NaiveHuffman coder
  • a136a85: 8338768: Introduce runtime lookup to check for static builds
  • 9d7d85a: 8339298: Remove unused function declaration poll_for_safepoint
  • 92aafb4: 8338934: vmTestbase/nsk/jvmti/FieldWatch/TestDescription.java tests timeout intermittently
  • 392bdd5: 8339248: RISC-V: Remove li64 macro assembler routine and related code
  • 4f071ce: 8311163: Parallel: Improve large object handling during evacuation
  • b840b13: 8338882: Clarify matching order of MessageFormat subformat factory styles
  • 25e03b5: 8339115: Rename TypeKind enum constants to follow code style
  • fef1ef7: 6426678: (spec) File.createTempFile(prefix, suffix, dir) needs clarification for illegal symbols in suffix
  • ... and 56 more: https://git.openjdk.org/jdk/compare/b704bfa205bbd8c56f128ce5d727d40c8a3ec613...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@adinn, @fg1417) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk
Copy link

openjdk bot commented Aug 27, 2024

@JoshuaZhuwj The following label will be automatically applied to this pull request:

  • hotspot

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 hotspot-dev@openjdk.org label Aug 27, 2024
@JoshuaZhuwj JoshuaZhuwj changed the title [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only 8339063: [aarch64] Skip verify_sve_vector_length after native calls if SVE supports 128 bits VL only Aug 27, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 27, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 27, 2024

Webrevs

@JoshuaZhuwj
Copy link
Member Author

Add some more background.

The maximum SVE vector length "VLmax" is determined by the hardware: 16 <= VLmax <= 256.
The value of VL can be configured at runtime: 16 <= VL <= VLmax, where VL must be a multiple of 16.

Once we find cpu's VLMax is 16 bytes only, the verification "verify_sve_vector_length()" after native calls is not required - in other words, VL cannot be configured to a value other than 16.

@JoshuaZhuwj
Copy link
Member Author

/label add hotspot-compiler

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Aug 28, 2024
@openjdk
Copy link

openjdk bot commented Aug 28, 2024

@JoshuaZhuwj
The hotspot-compiler label was successfully added.

Copy link
Contributor

@adinn adinn left a comment

Choose a reason for hiding this comment

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

The code changes look ok. What have you done to test it?

@JoshuaZhuwj
Copy link
Member Author

The code changes look ok. What have you done to test it?

@adinn Thanks for your review!

The maximum SVE vector length "VLmax" is determined by the hardware: 16 <= VLmax <= 256. The value of VL can be configured at runtime: 16 <= VL <= VLmax, where VL must be a multiple of 16.

Once we find cpu's VLMax is 16 bytes only, the verification "verify_sve_vector_length()" after native calls is not required - in other words, VL cannot be configured to a value other than 16.

I checked the behavior of prctl(PR_SVE_SET_VL, value) by a separated C case.
https://github.com/JoshuaZhuwj/openjdk_cases/blob/master/8339063/setSVEVL.c
The output is aligned with the above expectation.
https://github.com/JoshuaZhuwj/openjdk_cases/blob/master/8339063/output

I have an aarch64 hardware at hand with only 128-bit SVE vector length.
With this change applied, the generated native wrapper and native entry no longer check SVE VL change after native calls in the machine.

I also ensure no regression failures by jtreg case:
test/hotspot/jtreg/compiler/c2/aarch64/TestSVEWithJNI.java
Also no regression failures when JVM starts up by specifying different MaxVectorSize.

@adinn
Copy link
Contributor

adinn commented Aug 28, 2024

Ok, that sounds like it is sufficient.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 28, 2024
@@ -155,7 +155,7 @@ source %{
}

int length_in_bytes = vlen * type2aelembytes(bt);
if (UseSVE == 0 && length_in_bytes > 16) {
if (UseSVE == 0 && length_in_bytes > FloatRegister::neon_vl) {
Copy link

@fg1417 fg1417 Aug 29, 2024

Choose a reason for hiding this comment

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

Should we also update aarch64_vector_ad.m4 to avoid any mismatch :) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! I overlooked this place. Thanks for your reminder!

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Aug 30, 2024
Copy link

@fg1417 fg1417 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the update.

Copy link
Contributor

@adinn adinn left a comment

Choose a reason for hiding this comment

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

still good

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 2, 2024
@JoshuaZhuwj
Copy link
Member Author

Thank you for the reviews! @adinn @fg1417

@JoshuaZhuwj
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 2, 2024
@openjdk
Copy link

openjdk bot commented Sep 2, 2024

@JoshuaZhuwj
Your change (at version d191085) is now ready to be sponsored by a Committer.

@adinn
Copy link
Contributor

adinn commented Sep 2, 2024

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 2, 2024

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

  • b1163bc: 8256211: assert fired in java/net/httpclient/DependentPromiseActionsTest (infrequent)
  • 03ba37e: 8339169: Remove NaiveHuffman coder
  • a136a85: 8338768: Introduce runtime lookup to check for static builds
  • 9d7d85a: 8339298: Remove unused function declaration poll_for_safepoint
  • 92aafb4: 8338934: vmTestbase/nsk/jvmti/FieldWatch/TestDescription.java tests timeout intermittently
  • 392bdd5: 8339248: RISC-V: Remove li64 macro assembler routine and related code
  • 4f071ce: 8311163: Parallel: Improve large object handling during evacuation
  • b840b13: 8338882: Clarify matching order of MessageFormat subformat factory styles
  • 25e03b5: 8339115: Rename TypeKind enum constants to follow code style
  • fef1ef7: 6426678: (spec) File.createTempFile(prefix, suffix, dir) needs clarification for illegal symbols in suffix
  • ... and 56 more: https://git.openjdk.org/jdk/compare/b704bfa205bbd8c56f128ce5d727d40c8a3ec613...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 2, 2024

@adinn @JoshuaZhuwj Pushed as commit 0e6bb51.

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

@JoshuaZhuwj JoshuaZhuwj deleted the 8339063 branch September 3, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org 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