Skip to content

8300109: RISC-V: Improve code generation for MinI/MaxI nodes #11988

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 4 commits into from

Conversation

RealFYang
Copy link
Member

@RealFYang RealFYang commented Jan 13, 2023

As described by the issue, code generation for MinI/MaxI nodes on RISC-V could be improved when one of the source register is the same as the destination register. Also the code could be further simplified when that source register is constant 0 making use of the dedicated zero register of the architecture. This adds new match rules for those cases.

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-8300109: RISC-V: Improve code generation for MinI/MaxI nodes

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11988

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 13, 2023

👋 Welcome back fyang! 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 openjdk bot added the rfr Pull request is ready for review label Jan 13, 2023
@openjdk
Copy link

openjdk bot commented Jan 13, 2023

@RealFYang 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 Jan 13, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 13, 2023

Webrevs

Copy link
Member

@luhenry luhenry left a comment

Choose a reason for hiding this comment

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

I'm curious to see some JMH results on this change.

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Looks okay. I was wondering if it was possible to have multiple match(...)-es per instruct, so we could coalesce the symmetric "compare with zero" cases. But it is fine as it is.

@openjdk
Copy link

openjdk bot commented Jan 16, 2023

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

8300109: RISC-V: Improve code generation for MinI/MaxI nodes

Reviewed-by: fjiang, luhenry, shade

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 1 new commit pushed to the master branch:

  • 319de6a: 8300124: Remove unnecessary assert in GenCollectedHeap::initialize

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.

➡️ 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 Jan 16, 2023
@RealFYang
Copy link
Member Author

RealFYang commented Jan 16, 2023

Looks okay. I was wondering if it was possible to have multiple match(...)-es per instruct, so we could coalesce the symmetric "compare with zero" cases. But it is fine as it is.

Good suggestion. Fixed in the last commit. Also corrected the pipeline for those nodes as discussed on #11919.

@RealFYang
Copy link
Member Author

RealFYang commented Jan 17, 2023

I'm curious to see some JMH results on this change.

Well, not that much (%3 at most) when I run the max & min tests in JMH test [1] on my unmatched board:

Before:
Benchmark          (seed)   Mode  Cnt       Score      Error   Units
MathBench.maxInt        0  thrpt    8   97675.352 ± 4081.422  ops/ms
MathBench.maxLong       0  thrpt    8  105212.075 ± 5305.248  ops/ms
MathBench.minInt        0  thrpt    8  104321.539 ± 4342.072  ops/ms
MathBench.minLong       0  thrpt    8   97597.538 ± 3798.621  ops/ms

After:
Benchmark          (seed)   Mode  Cnt       Score      Error   Units
MathBench.maxInt        0  thrpt    8   97890.688 ± 6732.534  ops/ms
MathBench.maxLong       0  thrpt    8  107836.865 ± 3148.886  ops/ms
MathBench.minInt        0  thrpt    8  107521.081 ± 3992.511  ops/ms
MathBench.minLong       0  thrpt    8   97940.617 ± 3876.168  ops/ms

I think it will depend on the micro-architecture implementation. But the code generated should be always simplified in this case.

[1] https://github.com/openjdk/jdk/blob/master/test/micro/org/openjdk/bench/java/lang/MathBench.java#L301

@RealFYang
Copy link
Member Author

Thanks all for the review. I will proceed integrating this if there is no other comments.

@RealFYang
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 18, 2023

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

  • 89a032d: 8300002: Performance regression caused by non-inlined hot methods due to post call noop instructions
  • 7071397: 8299224: TestReporterStreams.java has bad indentation for legal header
  • 1d8b87d: 8300321: Use link tags in javax.sql.rowset package-info
  • f9883fc: 8300279: Use generalized see and link tags in core libs in client libs
  • 00b6c55: 8300254: ASan build does not correctly propagate ASAN_OPTIONS
  • e37078f: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops
  • ade08e1: 8300093: Refactor code examples to use @snippet in java.text.MessageFormat
  • d7c05d1: 8300011: Refactor code examples to use @snippet in java.util.TimeZone
  • 8c12ae8: 8283203: Fix typo in SystemTray.getTrayIconSize javadoc
  • e7e3712: 8300010: UnsatisfiedLinkError on calling System.console().readPassword() on Windows
  • ... and 24 more: https://git.openjdk.org/jdk/compare/289aed465e9b8449938d4cdb515748e7aca1d070...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 18, 2023

@RealFYang Pushed as commit f1194dc.

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

@RealFYang RealFYang deleted the JDK-8300109 branch January 23, 2023 04: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.

5 participants