-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
core::num::f16b Rust's 16bit Brain Float
#160859
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: main
Are you sure you want to change the base?
Changes from all commits
72e89c3
86f0b31
ce95daf
a8baf6e
b840b82
0d10959
bcb05c3
84787b4
3b3e8ae
1f9f414
7938bd4
c2162ec
6cec228
669cd12
ed74711
62a7f72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -332,6 +332,9 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { | |
| Primitive::Float(Float::F16) => { | ||
| bug!("the va_arg intrinsic does not support `f16`") | ||
| } | ||
| Primitive::Float(Float::F16B) => { | ||
| bug!("the va_arg intrinsic does not support `f16b`") | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well we could support this actually, it doesn't participate in argument promotion. Idk if it's useful. |
||
| Primitive::Float(Float::F32) => { | ||
| // c_double is actually f32 on avr. | ||
| if self.cx().sess().target.arch != Arch::Avr { | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the calling convention of other targets?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe only these files were changed because they have an exhaustive match on However, my version of abi-cafe found two interesting failures: GCC and Clang are inconsistent on // callee, compiled with GCC 12
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
typedef struct Many1 {
__bf16 f0;
} Many1;
void struct_in_1(Many1 arg0) {
printf("%d", arg0.f0);
}// caller, compiled with clang 23
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
typedef struct Many1 {
__bf16 f0;
} Many1;
void struct_in_1(Many1 arg0);
void do_test(void) {
{
Many1 arg0 = { .f0 = (((union { uint16_t bits; __bf16 value; }){ .bits = 49600 }).value) };
printf("%d", arg0.f0);
struct_in_1(arg0);
}
}hits The current Rust implementation matches clang, and is hence incompatible with GCC armv7 with hardware floats also runs into incompatibilities Finally, you can let this ICE on many targets, e.g. mips, powerpc, s390x, sparc
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also (e.g. on I think the ICEs are probably a blocker? That needs a mechanism similar to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I added it because of the exhaustive match statement in With regard to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Exactly
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's your take on those ABI mismatches? We should track that somewhere.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not particularly certain what It doesn't, at least to my knowledge, have hardware support. Given we aren't implementing scalar arithmetic and an |
Uh oh!
There was an error while loading. Please reload this page.
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.
I believe GCC actually supports this type: https://github.com/rust-lang/gccjit.rs/blob/master/src/context.rs#L1482
View changes since the review
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.
Thanks 😄, I will aim to add it in a follow up PR 👍