Skip to content

Commit adb9600

Browse files
committed
Rewrite f16 and f128 hw support comments to match PR feedback
I wrote RISC-V allcaps in all cases, and wrote amd64 lowercase in all cases, im not sure if either is the more correct way for either platform, thats just how I normally write them, if theres a precedent elsewhere it should probably be changed to match though.
1 parent e759a1f commit adb9600

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

library/core/src/primitive_docs.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,9 +1082,12 @@ impl<T> (T,) {}
10821082
/// bits. Please see [the documentation for [`prim@f32`] or [Uncyclopedia on
10831083
/// half-precision values][wikipedia] for more information.
10841084
///
1085-
/// Note that most major platforms will provide `f16` math support by converting to and from
1086-
/// an `f32`, which is usually fairly performant but will not be as fast as using `f32` directly.
1087-
1085+
/// Note that most common platforms will not support `f16` in hardware without enabling extra target
1086+
/// features, with the notable exception of Apple Silicon (also known as M1/2/etc) processors. For
1087+
/// amd64 this requires the avx512fp16 feature, while RISC-V requires Zhf or Zhfmin, to have hardware support.
1088+
/// Usually the fallback implementation will be to use `f32` hardware if it exists, and convert
1089+
/// between `f16` and `f32` when performing math.
1090+
///
10881091
/// *[See also the `std::f16::consts` module](crate::f16::consts).*
10891092
///
10901093
/// [wikipedia]: https://en.wikipedia.org/wiki/Half-precision_floating-point_format
@@ -1184,12 +1187,15 @@ mod prim_f64 {}
11841187
/// as many bits as `f64`. Please see [the documentation for [`prim@f32`] or [Uncyclopedia on
11851188
/// quad-precision values][wikipedia] for more information.
11861189
///
1187-
/// Note that most major platforms do not have hardware support for `f128`, in which case a
1188-
/// software implementation will be used. This can be significantly slower than using `f64`.
1190+
/// Note that no platforms have hardware support for `f128` without enabling target specific features
1191+
/// (and [only some consumer level hardware has support][wikipedia-support], for example RISC-V has support, but
1192+
/// neither amd64 nor aarch64 has support), in which case a software implementation will be used. This can be
1193+
/// significantly slower than using `f64`.
11891194
///
11901195
/// *[See also the `std::f128::consts` module](crate::f128::consts).*
11911196
///
11921197
/// [wikipedia]: https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format
1198+
/// [wikipedia-support]: https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format#Hardware_support
11931199
#[unstable(feature = "f128", issue = "116909")]
11941200
mod prim_f128 {}
11951201

0 commit comments

Comments
 (0)