Skip to content

Conversation

@eme64
Copy link
Contributor

@eme64 eme64 commented Oct 31, 2025

We should test Float16 with Template Framework Tests. For this, I'm now implementing:

  • Template Framework Library: add Float16Type that represents Float16. Extend Operations.java with Float16 operations.
  • Verify.java: add verification for Float16, and corresponding tests in TestVerifyIncubatorVector.java. We could have done this separately, but it is not much code and completes the pipeline from code generation through execution and finally result verification in the following two tests.
  • Adding Float16 to ExpressionFuzzer.java and TestExpressions.java.

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-8370922: Template Framework Library: Float16 type and operations (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28095

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2025

👋 Welcome back epeter! 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 Oct 31, 2025

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

8370922: Template Framework Library: Float16 type and operations

Reviewed-by: galder, thartmann, bmaillard

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 23 new commits pushed to 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 changed the title JDK-8370922 8370922: Template Framework Library: Float16 type and operations Oct 31, 2025
@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Oct 31, 2025
@openjdk
Copy link

openjdk bot commented Oct 31, 2025

@eme64 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.

@eme64 eme64 marked this pull request as ready for review December 1, 2025 06:52
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 1, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 1, 2025

Webrevs

@eme64
Copy link
Contributor Author

eme64 commented Dec 10, 2025

Can someone please review this?

Copy link
Contributor

@galderz galderz 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, just a small question about the name of the test


import compiler.lib.verify.*;

public class TestVerifyIncubatorVector {
Copy link
Contributor

Choose a reason for hiding this comment

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

I have doubts about leaving the "Incubator" name in the test class name as it's temporary. Are you going to refactor the class name when API is not incubator any more? Maybe TestVerifyVectorAPI instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I might refactor it away actually. We could also remove the special handling in verify for foreign classes. Currently I have to do the hack with reflection. I'd like to get rid of that.

This test is here for the cases where we need to include foreign, and because we need @modules jdk.incubator.vector. There is the other test that already exists and does not need this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@galderz I now renamed it to TestVerifyFloat16.java, I think it is better, even if I eventually have to refactor the internals of the test we don't have to rename the test itself :)

Copy link
Contributor

@benoitmaillard benoitmaillard 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, nice work! I only have one question.


// Generate expressions with any scalar numeric types.
for (CodeGenerationDataNameType type : SCALAR_NUMERIC_TYPES) {
for (int i = 0; i < 2; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this loop do? And why do we have only 2 iterations here, but 10 for PRIMITIVE_TYPES?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It Generate[s] expressions with any scalar numeric types. ;)
The question is just how many per (output) type. Here we do 2 for each type.

The 2 vs 10 is quite arbitrary. I did not want to increase the runtime of the test too much. For now, focusing more on the primitive types an operations is probably good, Float16 is still rather niche. But we can change the balance in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, and note: even if we start with a type other than Float16 as the output, we can still have Float16 components in the expression, via conversion for example. We can do float -> Float16 -> float for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant to ask specificially about the inner loop sorry :)
The explanation makes sense, thanks for explaining a little more. Perhaps we could have a comment for that, or have constants with more explicit names for 2 and 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benoitmaillard I added some extra comments. What do you think, is it better now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thank you!

@openjdk
Copy link

openjdk bot commented Dec 12, 2025

@eme64 this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8370922-TemplateFramework-Library-Float16
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Dec 12, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Dec 15, 2025
Copy link
Contributor

@galderz galderz left a comment

Choose a reason for hiding this comment

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

@eme64 I have one additional question. How did you test this? Did you have HF hardware access or did you emulate it? In a recent chat with @benoitmaillard, I think he mentioned about using QEMU to emulate and do some testing.

@eme64
Copy link
Contributor Author

eme64 commented Dec 15, 2025

@eme64 I have one additional question. How did you test this? Did you have HF hardware access or did you emulate it? In a recent chat with @benoitmaillard, I think he mentioned about using QEMU to emulate and do some testing.

I ran it through out internal testing machines. Some of them do have specific hardware support for Float16 operations :)
I've used QEMU in the past for Float16 and SVE, but it is relatively slow, so I did not bother with that for this PR.

@galderz
Copy link
Contributor

galderz commented Dec 15, 2025

@eme64 Thanks for explanation, all good :)

@eme64
Copy link
Contributor Author

eme64 commented Dec 15, 2025

@benoitmaillard @galderz Thanks for the reviews and approvals!

Now we'll have to get a reviewer rubber-stamp this :)

Copy link
Member

@TobiHartmann TobiHartmann 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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 16, 2025
@eme64
Copy link
Contributor Author

eme64 commented Dec 16, 2025

@benoitmaillard @galderz @TobiHartmann Thanks for the reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Dec 16, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 16, 2025

@eme64 Pushed as commit 89e7751.

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

@galderz
Copy link
Contributor

galderz commented Dec 18, 2025

Great timing @eme64 with this, the #28895 PR uses the work here :)

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.

4 participants