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

8332533: RISC-V: Enable vector variable shift instructions for machines with RVV #19313

Closed
wants to merge 3 commits into from

Conversation

zifeihan
Copy link
Member

@zifeihan zifeihan commented May 20, 2024

Hi, I noticed the following warning in the Opto JIT Code for the Vector API in the test/jdk/jdk/incubator/vector/Byte256VectorTests.java: ASHRByte256VectorTests test:

--------------------------------------------------------------------------------
  ** Rejected vector op (RShiftVB,byte,32) because architecture does not support variable vector shifts
  ** not supported: arity=2 opc=405 vlen=32 etype=byte ismask=0 is_masked_op=0

the reason is because Matcher::supports_vector_ variable_shifts returns false. the port of RISC-V Vector API now supports the vector shifts, so this should return with UseRVV. By the Way, the Matcher::supports_vector_variable_shifts function was introduced by Vector API, and I think forgot to modify the Matcher::supports_vector_variable_shifts function when implementing vector shift.
After the fix, the test passes normally and generates the Opto JIT Code such as:

1c2     loadV V1, [R7]  # vector (rvv)
1ca     lwu  R28, [R28, #12]    # loadN, compressed ptr, #@loadN ! Field: jdk/internal/vm/vector/VectorSupport$VectorPayload.payload (constant)
1ce     decode_heap_oop  R7, R28    #@decodeHeapOop
1d2     addi  R7, R7, #16   # ptr, #@addP_reg_imm
1d4     loadV V2, [R7]  # vector (rvv)
1dc     vand_immI V1, V1, #7
1e4     spill [sp, #48] -> R7    # spill size = 32
1e6     # castII of R7, #@castII
1e6     vasrB V3, V2, V1
1fa     spill [sp, #96] -> R29   # spill size = 32
1fc     bgeu  R7, R29, B101 #@cmpU_branch  P=0.000001 C=-1.000000

Testing:

qemu 8.1.50 with UseRVV:

  • Run tier1-3 tests (release)
  • Run test/jdk/jdk/incubator/vector (fastdebug)

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-8332533: RISC-V: Enable vector variable shift instructions for machines with RVV (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19313

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 20, 2024

👋 Welcome back gcao! 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 20, 2024

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

8332533: RISC-V: Enable vector variable shift instructions for machines with RVV

Reviewed-by: fyang, mli

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 (@RealFYang, @Hamlin-Li) 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 May 20, 2024

@zifeihan 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 20, 2024
@zifeihan zifeihan changed the title 8332533: RISC-V: Enable Matcher::supports_vector_variable_shifts with UseRVV 8332533: RISC-V: Enable vector variable shift instructions for machines with RVV May 21, 2024
@zifeihan zifeihan marked this pull request as ready for review May 21, 2024 02:00
@openjdk openjdk bot added the rfr Pull request is ready for review label May 21, 2024
@mlbridge
Copy link

mlbridge bot commented May 21, 2024

Webrevs

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.

Looks good. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 21, 2024
Copy link

@Hamlin-Li Hamlin-Li 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, thanks.

@Hamlin-Li
Copy link

Is UseRVV a const? Seems you need to remove constexpr.
Or you can just return true (so, keep constexpr), as supports_vector_variable_shifts is not a independent check, and it's protected by Matcher::match_rule_supported_vector in both vector api and auto-vectorization.

@zifeihan
Copy link
Member Author

Is UseRVV a const? Seems you need to remove constexpr. Or you can just return true (so, keep constexpr), as supports_vector_variable_shifts is not a independent check, and it's protected by Matcher::match_rule_supported_vector in both vector api and auto-vectorization.

Thanks for your review. I've removed constexpr.

Copy link

@Hamlin-Li Hamlin-Li left a comment

Choose a reason for hiding this comment

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

Thanks, still good.

@zifeihan
Copy link
Member Author

@RealFYang @Hamlin-Li : Thanks for the review.
/integrate

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

openjdk bot commented May 22, 2024

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

@RealFYang
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented May 22, 2024

Going to push as commit 67f03f2.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 22, 2024
@openjdk openjdk bot closed this May 22, 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 May 22, 2024
@openjdk
Copy link

openjdk bot commented May 22, 2024

@RealFYang @zifeihan Pushed as commit 67f03f2.

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

@zifeihan zifeihan deleted the JDK-8332533 branch June 19, 2024 07:04
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