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

8320999: RISC-V: C2 RotateLeftV #19325

Closed
wants to merge 15 commits into from

Conversation

Hamlin-Li
Copy link

@Hamlin-Li Hamlin-Li commented May 21, 2024

Hi,
Can you help to review this patch?
More detailed description is inline in the code.
Thanks


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

Issues

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19325

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

Using diff file

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

Webrev

Link to Webrev Comment

@Hamlin-Li
Copy link
Author

/solves JDK-8321000

@bridgekeeper
Copy link

bridgekeeper bot commented May 21, 2024

👋 Welcome back mli! 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 May 21, 2024

@Hamlin-Li 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:

8320999: RISC-V: C2 RotateLeftV
8321000: RISC-V: C2 RotateRightV

Reviewed-by: luhenry, fyang

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

  • 6d718ae: 8324341: Remove redundant preprocessor #if's checks
  • 9b64ece: 8332904: ubsan ppc64le: c1_LIRGenerator_ppc.cpp:581:21: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'
  • 3d4eb15: 8302744: Refactor Hotspot container detection code
  • 2cca83b: 8332880: JFR GCHelper class recognizes "Archive" regions as valid
  • b8ae11e: 8332960: ubsan: classListParser.hpp:159:12: runtime error: load of value 2101478704, which is not a valid value for type 'ParseMode'
  • 9a83dfe: 8332431: NullPointerException in JTable of SwingSet2
  • 01060ad: 8325083: jdk/incubator/vector/Double512VectorTests.java crashes in Assembler::vex_prefix_and_encode
  • 673f767: 8285506: Unify os::vsnprintf implementations
  • 91ab088: 8333116: test/jdk/tools/jpackage/share/ServiceTest.java test fails
  • 9ac8d05: 8332228: TypePollution.java: Unrecognized VM option 'UseSecondarySuperCache'
  • ... and 87 more: https://git.openjdk.org/jdk/compare/a0c5714dbc8a60d905f9deea153e7f31fbd64d06...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 rfr Pull request is ready for review label May 21, 2024
@openjdk
Copy link

openjdk bot commented May 21, 2024

@Hamlin-Li
Adding additional issue to solves list: 8321000: RISC-V: C2 RotateRightV.

@openjdk
Copy link

openjdk bot commented May 21, 2024

@Hamlin-Li 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 May 21, 2024
@mlbridge
Copy link

mlbridge bot commented May 21, 2024

Webrevs

@Hamlin-Li
Copy link
Author

I'll need to refine the patch a bit, seems imm in vror.vi is 6 bits rather than 5 bits which is the case in basic vector instructions.

@@ -129,7 +129,7 @@

// Does the CPU supports vector variable shift instructions?
static constexpr bool supports_vector_variable_shifts(void) {
return false;
return true;
Copy link
Member

Choose a reason for hiding this comment

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

What's the path to checking for UseZvbb and UseZvbc respectively to the specific instruction?

Copy link
Author

Choose a reason for hiding this comment

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

Here, the 3 checks are not independent, they depend on other checks in both vectorization and vector API, so returning true is fine.

But in order to eliminate everyone’s doubts in the future, I change them return UseZvbb.

src/hotspot/cpu/riscv/assembler_riscv.hpp Outdated Show resolved Hide resolved
src/hotspot/cpu/riscv/assembler_riscv.hpp Show resolved Hide resolved
@Hamlin-Li
Copy link
Author

I'll need to refine the patch a bit, seems imm in vror.vi is 6 bits rather than 5 bits which is the case in basic vector instructions.

I have modified it to use vror.vi with 6 bits imm.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Hi, I have two comments after a cursory look. Thanks.

src/hotspot/cpu/riscv/riscv_v.ad Show resolved Hide resolved
src/hotspot/cpu/riscv/riscv_v.ad Outdated Show resolved Hide resolved
Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Two minor comments remain. Otherwise looks good to me.
BTW: You didn't mention the testing performed. Are these newly-added instructs properly test covered? Thanks.

// also supports Byte and Short rotation. But we can still share the intrinsics between vectorization and Vector API.
//
// NOTE: for Long, its valid rotation value is 6 bits, although basic vector instruction only support 5 bit vector-immediate,
// in Zvbb, vror.vi support 6 bits vector-immediate, so the imm implementation of Long and other types can be unified.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe simply: As vror.vi encodes 6-bits immediate rotate amount, which is different from other vector-immediate instructions, implementation of vector rotation for long and other types can be unified.

Copy link
Author

Choose a reason for hiding this comment

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

modified


instruct vrotate_right_masked(vReg dst_src, vReg shift, vRegMask_V0 v0) %{
match(Set dst_src (RotateRightV (Binary dst_src shift) v0));
effect(TEMP_DEF dst_src);
Copy link
Member

Choose a reason for hiding this comment

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

Is the TEMP_DEF dst_src needed for these newly-added masked versions?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for catching, removed.

@Hamlin-Li
Copy link
Author

Two minor comments remain. Otherwise looks good to me. BTW: You didn't mention the testing performed. Are these newly-added instructs properly test covered? Thanks.

Yes, I've checked the instructs are matched and invoked during tests running.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 29, 2024
@Hamlin-Li
Copy link
Author

Thanks @luhenry @RealFYang for your reviewing.

/integrate

@openjdk
Copy link

openjdk bot commented May 29, 2024

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

  • 6cda4c5: 8321543: Update NSS to version 3.96
  • c003c12: 8331865: Consolidate size and alignment checks in LayoutPath
  • 6d718ae: 8324341: Remove redundant preprocessor #if's checks
  • 9b64ece: 8332904: ubsan ppc64le: c1_LIRGenerator_ppc.cpp:581:21: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'
  • 3d4eb15: 8302744: Refactor Hotspot container detection code
  • 2cca83b: 8332880: JFR GCHelper class recognizes "Archive" regions as valid
  • b8ae11e: 8332960: ubsan: classListParser.hpp:159:12: runtime error: load of value 2101478704, which is not a valid value for type 'ParseMode'
  • 9a83dfe: 8332431: NullPointerException in JTable of SwingSet2
  • 01060ad: 8325083: jdk/incubator/vector/Double512VectorTests.java crashes in Assembler::vex_prefix_and_encode
  • 673f767: 8285506: Unify os::vsnprintf implementations
  • ... and 89 more: https://git.openjdk.org/jdk/compare/a0c5714dbc8a60d905f9deea153e7f31fbd64d06...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 29, 2024

@Hamlin-Li Pushed as commit fed2b56.

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

@Hamlin-Li Hamlin-Li deleted the rotate-left-right-v branch May 29, 2024 12:33
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