-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[docs] Clarify that Float16 is supported natively when possible #57725
Conversation
@@ -334,8 +334,7 @@ julia> typeof(x) | |||
Float64 | |||
``` | |||
|
|||
Half-precision floating-point numbers are also supported ([`Float16`](@ref)), but they are | |||
implemented in software and use [`Float32`](@ref) for calculations. | |||
Half-precision floating-point numbers are also supported ([`Float16`](@ref)) on all platforms, with native instructions used on hardware which supports this number format, otherwise operations are implemented in software and use [`Float32`](@ref) for intermediate calculations. |
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.
Maybe point out that this equivalent to gcc -fexcess-precision=ieee
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 presume you meant -fexcess-precision=standard
?
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 think we actually implement -fexcess-precision=16
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fexcess-precision
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.
On x86 targets with SSE2 enabled, without -mavx512fp16, all operations will be emulated by software emulation and the float instructions. The default behavior for FLT_EVAL_METHOD is to keep the intermediate result of the operation as 32-bit precision. This may lead to inconsistent behavior between software emulation and AVX512-FP16 instructions. Using -fexcess-precision=16 will force round back after each operation.
Yeah we force round back after each operation.
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.
We techically just do the LLVM default nowadays, the demote float16 pass is basically unused since #55486
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.
Ok, I tried to incorporate both comments above, explaining this is an implementation detail (but I think some non-Julia people reading the manual may be interested in knowing it)
LGTM |
Co-authored-by: Jishnu Bhattacharya <jishnub.github@gmail.com>
Pointed out in casangi/xradio#304 (comment)