-
Notifications
You must be signed in to change notification settings - Fork 707
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
Support float16 #2667
Merged
Merged
Support float16 #2667
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sagudev
commented
Oct 20, 2023
sagudev
commented
Oct 20, 2023
@@ -0,0 +1,7 @@ | |||
|
|||
static _Float16 global; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static _Float16 global = 1.0;
is not supported
sagudev
force-pushed
the
f16
branch
2 times, most recently
from
October 20, 2023 08:44
c07ef32
to
937cae3
Compare
sagudev
commented
Oct 20, 2023
sagudev
force-pushed
the
f16
branch
2 times, most recently
from
October 20, 2023 16:51
b505d3e
to
b045090
Compare
This PR solves my issue of |
ping @emilio |
Tracking issue for rustc support for f16 rust-lang/rust#116909 |
emilio
approved these changes
Dec 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is done by defining
pub struct __BindgenFloat16(pub u16);
. Clang has half (__fp16
; storage type, casted to float for calculations) and float16 (__Float16
) types, both have same binary representations, and this PR handles both as same.More about half types here: https://clang.llvm.org/docs/LanguageExtensions.html#half-precision-floating-point.
When rust implements
f16
we could use those if appropriate target rust is used.Rust
f16
RFC: https://github.com/rust-lang/rfcs/blob/master/text/3453-f16-and-f128.md#f16-type (contains some clang details)Fixes #2500.