Skip to content

node-api: add napi_float16_array #58889

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bnoordhuis
Copy link
Member

Fixes: #58873

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/node-api

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API. labels Jun 29, 2025
@legendecas
Copy link
Member

There is an open PR for this: #58879

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Duplicates #58879

@bnoordhuis
Copy link
Member Author

The other guy should have back-linked to the issue... from a quick glance, that PR breaks ABI; this one doesn't.

@jasnell
Copy link
Member

jasnell commented Jun 29, 2025

Ok, the other PR can be updated to fix any remaining issues. I'd encourage providing review comments and suggestions there.

This comment was marked as resolved.

@bnoordhuis
Copy link
Member Author

Why? This one is perfect. It's not first come, first serve, right?

@@ -2267,6 +2267,7 @@ typedef enum {
napi_float64_array,
napi_bigint64_array,
napi_biguint64_array,
napi_float16_array,
Copy link
Member

Choose a reason for hiding this comment

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

Without breaking the ABI, we still need to mark this as NAPI_EXPERIMENTAL as mentioned in #58879 (comment) until this is been backported to all LTS lines.

In addition, we need a feature macro, to allow addons to detect a new feature: https://github.com/nodejs/node/blob/main/doc/contributing/adding-new-napi-api.md#process-and-approval.

Copy link
Member

Choose a reason for hiding this comment

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

Without breaking the ABI

The problem with this in #58879 was that the enum value was added in the middle. Adding an extra enum value at the end, as it is done here, is generally not ABI-breaking since it does not change the numeric values of the other enum alternatives.

Copy link
Member

@legendecas legendecas Jun 30, 2025

Choose a reason for hiding this comment

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

I'm not saying this breaks ABI. My point is we need guard this with NAPI_EXPERIMENTAL (and a NAPI_VERSION bump soon in the next versions) and a feature macro to allow addons detect that APIs like napi_create_typedarray are supported with napi_float16_array at both build time and run time.

@jasnell
Copy link
Member

jasnell commented Jun 29, 2025

Certainly not first come first serve but there's also no harm at all in helping a newer contributor work through any remaining issues in their PR. And as @legendecas points out there are outstanding issues in the PR also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API.
Projects
Status: Need Triage
Development

Successfully merging this pull request may close these issues.

Add Float16Array support to node-api
5 participants