Skip to content

x86: Implement fma intrinsic - #21118

Merged
hzongaro merged 1 commit into
eclipse-openj9:masterfrom
BradleyWood:fma
Feb 27, 2025
Merged

x86: Implement fma intrinsic#21118
hzongaro merged 1 commit into
eclipse-openj9:masterfrom
BradleyWood:fma

Conversation

@BradleyWood

@BradleyWood BradleyWood commented Feb 12, 2025

Copy link
Copy Markdown
Member

This PR implements Math.fma intrinsics on x86 with vfmadd instructions.

Issue: #7474

@BradleyWood

Copy link
Copy Markdown
Member Author

Requires fma, extensions.

Here are performance numbers,

Benchmark Compared to Baseline Compared to Hotspot
FMABench.benchFloatFMA 552x 1.19x
FMABench.benchDoubleFMA 1482x 1.16x

@BradleyWood
BradleyWood force-pushed the fma branch 4 times, most recently from ff7bb16 to 229e619 Compare February 12, 2025 06:34
@BradleyWood

Copy link
Copy Markdown
Member Author

FYI @0xdaryl, @JamesKingdon

@hzongaro Would you mind reviewing?

@JamesKingdon

Copy link
Copy Markdown
Contributor

Thanks Brad, what a result!

@hzongaro
hzongaro self-requested a review February 12, 2025 15:48
@hzongaro hzongaro self-assigned this Feb 12, 2025

@hzongaro hzongaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for pulling this together so quickly! I just have a few comments and questions.

Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.hpp Outdated
Comment thread runtime/compiler/x/codegen/J9CodeGenerator.cpp
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
@BradleyWood

Copy link
Copy Markdown
Member Author

See the force-push

@hzongaro hzongaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the changes look good. I will wait for @0xdaryl to review before running tests.

@0xdaryl 0xdaryl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the logic behind choosing the best instruction format to use is sound. I just have a few issues with the approach behind that.

Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp
@BradleyWood

Copy link
Copy Markdown
Member Author

@hzongaro The only thing I changed is comments, but was forced to rebase and fix conflicts. I think everything is ready to run testing.

Comment thread runtime/compiler/x/codegen/J9TreeEvaluator.cpp Outdated
@hzongaro

Copy link
Copy Markdown
Member

@0xdaryl, may I ask you to confirm that your comments were all resolved to your satisfaction?

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity.functional,sanity.openjdk xlinux,win,xmac jdk11,jdk17,jdk21

@hzongaro

Copy link
Copy Markdown
Member

The many jvmti test failures in JDK 11 sanity.functional xlinux and Windows appear to be unrelated to this change. I see the same failures with another pull request test run.

The failures running cmdlineTester_jfr_0 for JDK 17 sanity.functional Windows and JDK 21 sanity.functional Windows are due to known issue #21181.

The failures in JDK running jdk_util_1 for JDK 21 sanity.openjdk x86-64 macOS appears to be known issue #17270.

I will rerun sanity.functional testing for JDK 11 x86-64 macOS

Jenkins test sanity.functional xmac jdk11

@hzongaro

Copy link
Copy Markdown
Member

@BradleyWood, it looks there are merge conflicts that you will need to resolve before I will be able to rerun the JDK 11 xmac testing.

Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
@BradleyWood

Copy link
Copy Markdown
Member Author

@hzongaro Fixed conflicts

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity.functional xmac jdk11

@hzongaro
hzongaro merged commit 2dd07eb into eclipse-openj9:master Feb 27, 2025
@BradleyWood

Copy link
Copy Markdown
Member Author

@hzongaro Should I double-deliver on monday if no issues arise by then?

@hzongaro

hzongaro commented Mar 3, 2025

Copy link
Copy Markdown
Member

Should I double-deliver on monday if no issues arise by then?

I this is a safe change. I would be OK with it if there are no objections.

@BradleyWood

Copy link
Copy Markdown
Member Author

Is this is a safe change.

I think its on the safer side as far as intrinsics go. The only concern I have is that the operands which may be loaded directly from memory could come in any of many possible combinations. I did my best to test this whilst I was working on it buy disabling a few optimizations and placing constants (such as 1f) in place of variables to force memory loads at specific spots.

On the other hand, this change has survived 4 or 5 days of builds/tests without issues, provides significant performance benefits, and has a workaround option to disable the intrinsic if needed.

FYI, @pshipton

@hzongaro

hzongaro commented Mar 4, 2025

Copy link
Copy Markdown
Member

I this is a safe change.

Sorry for that typo! I meant to say, "I think this is a safe change." I agree with @BradleyWood's analysis.

@pshipton

pshipton commented Mar 4, 2025

Copy link
Copy Markdown
Member

Getting it in today would be good, before we start any milestone builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants