-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8360559: Optimize Math.sinh for x86 64 bit platforms #26152
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back missa! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@missa-prime The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Isn't this effectively a libm benchmark (where the |
Are there plans for a cosh intrinsic as follow-up work? There was a previous effort to intrinsify tanh. |
A large fraction of floating-point numbers are in the [-2^(-28), 2^(-28)] range where there is a performance degradation with the new implementation. What is the expected distribution of arguments to sinh? |
I don't know about an expected distribution of distribution of arguments to sinh. From glancing through research papers though, I get the sense that the [-2^(-28), 2^(-28)] range isn't used all that much. A couple of papers showing this are linked below.
I think the [-2^(-28), 2^(-28)] range isn't all that interesting for sinh anyway as it just returns the input itself. So, I doubt any applications are relying all that heavily on it. |
Yes, the intention is to have cosh as next math intrinsic. |
I'm not sure which libm version you're referring to. The only current sinh benchmark I'm aware of is in MathBench.java, and the benchmarks in SinhPerf.java didn't exist until now. Could you clarify? |
The goal of this PR is to implement an x86_64 intrinsic for java.lang.Math.sinh() using libm. There is a new set of micro-benchmarks are included to check the performance of specific input value ranges to help prevent regressions in the future.
The command to run all range specific micro-benchmarks is posted below.
make test TEST="micro:SinhPerf.SinhPerfRanges"
The results of all tests posted below were captured with an Intel® Xeon 8488C using OpenJDK v26-b4 as the baseline version.
For performance data collected with the new built in range micro-benchmark, see the table below. Each result is the mean of 8 individual runs, and the input ranges used match those from the original Java implementation. Overall, the intrinsic provides an an average uplift of 64% when input values fall into the middle three ranges where heavy computation is required. However, very small inputs and very large inputs show drops of 74% and 66% respectively.
Finally, the
jtreg:test/jdk/java/lang/Math/HyperbolicTests.java
test passed with the changes.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26152/head:pull/26152
$ git checkout pull/26152
Update a local copy of the PR:
$ git checkout pull/26152
$ git pull https://git.openjdk.org/jdk.git pull/26152/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26152
View PR using the GUI difftool:
$ git pr show -t 26152
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26152.diff
Using Webrev
Link to Webrev Comment