Skip to content

8347981: RISC-V: Add Zfa zli imm loads#23171

Closed
robehn wants to merge 8 commits intoopenjdk:masterfrom
robehn:zfa
Closed

8347981: RISC-V: Add Zfa zli imm loads#23171
robehn wants to merge 8 commits intoopenjdk:masterfrom
robehn:zfa

Conversation

@robehn
Copy link
Contributor

@robehn robehn commented Jan 17, 2025

Hi, please consider!

This patch the Zfa zli floating point immediate load.
As a bonus it adds fmv_?_x(Rd, zr); for loading fp/dp 0x0.
There are some more instruction in Zfa, but this was such a clear use-case so I only did fli as a start.

When using one of the 32 'popular' floats we can now materialze them without a load.
E.g.
float f = f1 * 0.5 + f2 * 2.0;
Only require 2 loads instead of 4: as '0.5' and '2.0' is such popular float values.

As Java is often memory bound we should also investigate doing lui+ssli+fmv for float/doubles instead of a load when materializing.

Note the _fli_s/_fli_d will be proper merged on the 8347794: RISC-V: Add Zfhmin - Float cleanup.

Passes:
./test/jdk/java/lang/Math
./test/hotspot/jtreg/compiler/floatingpoint/
./test/jdk/java/util/Formatter/
./test/jdk/java/lang/Float/
./test/jdk/java/lang/Double/
./test/hotspot/jtreg/compiler/c2/FloatingPointFoldingTest.java
./test/hotspot/jtreg/compiler/eliminateAutobox/
./test/hotspot/jtreg/vmTestbase/jit/

Running tier1

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

Issue

  • JDK-8347981: RISC-V: Add Zfa zli imm loads (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23171

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 17, 2025

👋 Welcome back rehn! 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 Jan 17, 2025

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

8347981: RISC-V: Add Zfa zli imm loads

Reviewed-by: fyang, luhenry

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

  • 4a375e5: 8344232: [PPC64] secondary_super_cache does not scale well: C1 and interpreter
  • 0df9dcb: 8346572: Check is_reserved() before using ReservedSpace instances
  • a09f06d: 8348265: RMIConnectionImpl: Remove Subject.callAs on MarshalledObject
  • 0395593: 8346751: Internal java compiler error with type annotations in constants expression in constant fields
  • 2daafe4: 8348283: java.lang.classfile.components.snippets.PackageSnippets shipped in java.base.jmod
  • 50ca450: 8340784: Remove PassFailJFrame constructor with screenshots
  • 416d469: 8347008: beancontext package spec does not clearly explain why the API is deprecated
  • 471d63c: 8343609: Broken links in java.xml
  • 7f16a08: 8348240: Remove SystemDictionaryShared::lookup_super_for_unregistered_class()
  • 48ece07: 8282862: AwtWindow::SetIconData leaks old icon handles if an exception is detected
  • ... and 36 more: https://git.openjdk.org/jdk/compare/fb438492275cd15390d26460cada2d5e1a49c159...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 Jan 17, 2025
@openjdk
Copy link

openjdk bot commented Jan 17, 2025

@robehn 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 Jan 17, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 17, 2025

Webrevs

@robehn
Copy link
Contributor Author

robehn commented Jan 18, 2025

Thanks for havinga look @luhenry !

@robehn
Copy link
Contributor Author

robehn commented Jan 21, 2025

It's seem you made a non-review comment above, I can't reply.

can_zfa_zli_float() method only checks if we can use a zli for that imm.
can_fp_imm_load() checks if we can do something better than loading the imm.

Right now we have two cases:

  • imm == 0-bits sets
  • imm == zli Rs pattern

As many application are memory bound and loading may miss L1.
This means we want to do plain materializing if we can't more or less guarantee L1 hit and the load do not stall other loads.

Therefore we should add more cases to above, for exampel:
lui + slli + fmw

The callsite is asking do I need to load from an address using fld/flw or can I materialize.
So I prefer the callsite to be unaware that in one of the cases we map an imm to a bit pattern in Rs.

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.

Thanks for the update. Seems fine to me modulo one minor comment.

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 to me. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 23, 2025
@robehn
Copy link
Contributor Author

robehn commented Jan 23, 2025

Looks good to me. Thanks.

Thank you !

@robehn
Copy link
Contributor Author

robehn commented Jan 23, 2025

@luhenry do you have any futher concerns, or are you happy ? :)

@robehn
Copy link
Contributor Author

robehn commented Jan 24, 2025

Thank you @luhenry !

@robehn
Copy link
Contributor Author

robehn commented Jan 24, 2025

/integrate

@openjdk
Copy link

openjdk bot commented Jan 24, 2025

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

  • e20bd01: 8344361: Restore null return for invalid services from legacy providers
  • 5a0bdd0: 8346890: AArch64: Type profile counters generate suboptimal code
  • 4a375e5: 8344232: [PPC64] secondary_super_cache does not scale well: C1 and interpreter
  • 0df9dcb: 8346572: Check is_reserved() before using ReservedSpace instances
  • a09f06d: 8348265: RMIConnectionImpl: Remove Subject.callAs on MarshalledObject
  • 0395593: 8346751: Internal java compiler error with type annotations in constants expression in constant fields
  • 2daafe4: 8348283: java.lang.classfile.components.snippets.PackageSnippets shipped in java.base.jmod
  • 50ca450: 8340784: Remove PassFailJFrame constructor with screenshots
  • 416d469: 8347008: beancontext package spec does not clearly explain why the API is deprecated
  • 471d63c: 8343609: Broken links in java.xml
  • ... and 38 more: https://git.openjdk.org/jdk/compare/fb438492275cd15390d26460cada2d5e1a49c159...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 24, 2025

@robehn Pushed as commit 9c55e25.

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

@robehn robehn deleted the zfa branch January 28, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants