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

8333964: RISC-V: C2: Check "requires_strict_order" flag for floating-point add reduction #19649

Closed
wants to merge 6 commits into from

Conversation

zifeihan
Copy link
Member

@zifeihan zifeihan commented Jun 11, 2024

Hi, We want to support non strictly-ordered floating-point add reduction, It was implemented by referring to RVV v1.0 [1]. please take a look and have some reviews. Thanks a lot.

We can use the Float256VectorTests.java[2] to print the Opto JIT Code, verify and observe the generation of nodes.

For example, we can use the following command to print the Opto JIT Code of a jtreg test case:

/home/zifeihan/jtreg/bin/jtreg \
-v:default \
-concurrency:16 -timeout:50 \
-javaoption:-XX:+UnlockExperimentalVMOptions \
-javaoption:-XX:+UseRVV \
-javaoption:-XX:+PrintOptoAssembly \
-javaoption:-XX:LogFile=/home/zifeihan/jdk/Float256VectorTests_PrintOptoAssembly.log \
-jdk:/home/zifeihan/jdk/build/linux-riscv64-server-fastdebug/jdk \
/home/zifeihan/jdk/test/jdk/jdk/incubator/vector/Float256VectorTests.java

We can observe the specified JIT Code log Float256VectorTests_PrintOptoAssembly.log, which contains the reduce_addF_ordered instruction for the PR implementation.

1e4     B28: #	out( B28 B29 ) <- in( B41 B28 ) Loop( B28-B28 inner post of N2310) Freq: 98.8164
1e4     shadd  R17, R15, R10, #2	# ptr, #@shaddP_reg_reg_ext_b
1e8     addi  R17, R17, #16	# ptr, #@addP_reg_imm
1ea     loadV V1, [R17]	# vector (rvv)
1f2     reduce_addF_unordered F2, F0, V1	# KILL V2
202     fadd.s  F1, F1, F2	#@addF_reg_reg
206     addiw  R15, R15, #8	#@addI_reg_imm
208     blt  R15, R31, B28	#@cmpI_loop  P=0.500000 C=19400.000000

Similarly, for reduce_addD_unordered instruction, we can use the test/jdk/jdk/incubator/vector/Double256VectorTests.java test case.

Performance testing:

FloatMaxVector.ADDLanes [2] measures the performance of add reduction for floating-point type.
Without Patch:

Benchmark                (size)   Mode  Cnt    Score   Error   Units
FloatMaxVector.ADDLanes    1024  thrpt    5  394.558 ± 0.044  ops/ms

With Patch:

Benchmark                (size)   Mode  Cnt    Score   Error   Units
FloatMaxVector.ADDLanes    1024  thrpt    5  627.510 ± 1.095  ops/ms

Correctness testing:

  • test/jdk/jdk/incubator/vector (fastdebug) qemu 8.1.50 with UseRVV
  • Run tier1-3 tests on SOPHON SG2042 (release)
  • Run tier1-3 tests (release) on qemu 8.1.50 with UseRVV

[1] https://github.com/riscv/riscv-v-spec/blob/v1.0/v-spec.adoc
[2] https://github.com/openjdk/panama-vector/blob/vectorIntrinsics/test/micro/org/openjdk/bench/jdk/incubator/vector/operation/FloatMaxVector.java#L316


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-8333964: RISC-V: C2: Check "requires_strict_order" flag for floating-point add reduction (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19649

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 11, 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 Jun 11, 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:

8333964: RISC-V: C2: Check "requires_strict_order" flag for floating-point add reduction

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

  • ba5a467: 8332854: Unable to build openjdk with --with-harfbuzz=system
  • 801bf15: 8332105: Exploded JDK does not include CDS
  • c94af6f: 8333962: Obsolete OldSize
  • cdf22b1: 8326715: ZGC: RunThese24H fails with ExitCode 139 during shutdown

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 (@RealFYang) 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 Jun 11, 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 Jun 11, 2024
@zifeihan zifeihan marked this pull request as ready for review June 12, 2024 04:52
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 12, 2024
@mlbridge
Copy link

mlbridge bot commented Jun 12, 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 reasonable to me.

src/hotspot/cpu/riscv/riscv_v.ad Show resolved Hide resolved
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 12, 2024
@zifeihan
Copy link
Member Author

@RealFYang : Hi, Based on #19686, I've updated some of the tests, and test case passed normally. Can you take a look? Thanks

@zifeihan
Copy link
Member Author

@RealFYang : Thanks for the review.
/integrate

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

openjdk bot commented Jun 18, 2024

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

@RealFYang
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jun 18, 2024

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

  • ba5a467: 8332854: Unable to build openjdk with --with-harfbuzz=system
  • 801bf15: 8332105: Exploded JDK does not include CDS
  • c94af6f: 8333962: Obsolete OldSize
  • cdf22b1: 8326715: ZGC: RunThese24H fails with ExitCode 139 during shutdown

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 18, 2024

@RealFYang @zifeihan Pushed as commit e95f092.

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

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

2 participants