Skip to content

Commit b51e70a

Browse files
committed
Deprecate use-intrinsics, update docs&CI
1 parent 3369a17 commit b51e70a

File tree

7 files changed

+33
-32
lines changed

7 files changed

+33
-32
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ workflows:
4848
- rust:
4949
name: Rust AArch64 (stable)
5050
toolchain: stable
51-
features: --features=std,serde,num-traits,bytemuck,zerocopy
51+
features: --all-features
5252
- rust:
5353
name: Rust AArch64 (1.61.0)
5454
toolchain: 1.61.0
55-
features: --features=std,serde,num-traits,bytemuck,zerocopy
55+
features: --all-features
5656
- rust:
5757
name: Rust AArch64 (nightly)
5858
toolchain: nightly

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,29 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
44
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
55

66
## [Unreleased]
7+
### Added
8+
- Support for Kani Rust Verifier. By [@cameron1024].
9+
- Support for `rand_distr::Distribution` implementations behind `rand_distr` optional cargo
10+
feature. By [@coreylowman].
11+
- Floating point formatting options in `Display` and `Debug` implementations. By [@eiz].
12+
713
### Changed
814
- **Breaking Change** Minimum supported Rust version is now 1.61.
15+
- **Breaking Change** Minimum supported Rust version policy reverted to original policy of allowing
16+
minimum supported Rust version updates for minor releases instead of only major to avoid
17+
segmentation and allow optimizing hardware implementations without unnecessary major releases.
918
- AArch64 now uses FP16 hardware support for conversions and math operations when available.
1019

20+
### Deprecated
21+
- `use-intrinsics` cargo feature no longer used. Hardware support will now always be used whenever
22+
possible. A future version may output deprecation warnings if this feature is enabled.
23+
24+
### Fixed
25+
- Improve code generation of `leading_zeros` functions by inlining. By [@encounter].
26+
- `Sum` implementation of `bf16` incorrectly performed product instead of sum. By [@wx-csy].
27+
- Compile failed when `serde` cargo feature enabled but `std` not enabled.
28+
- Incorrect black boxing of benchmark tests.
29+
1130
## [2.2.1] - 2023-01-08 <a name="2.2.1"></a>
1231
### Changed
1332
- Reduced unnecessary bounds checks for SIMD operations on slices. By [@Shnatsel].
@@ -294,6 +313,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
294313
[@Nilstrieb]: https://github.com/Nilstrieb
295314
[@joseluis]: https://github.com/joseluis
296315
[@Shnatsel]: https://github.com/Shnatsel
316+
[@cameron1024]: https://github.com/cameron1024
317+
[@encounter]: https://github.com/encounter
318+
[@coreylowman]: https://github.com/coreylowman
319+
[@wx-csy]: https://github.com/wx-csy
320+
[@eiz]: https://github.com/eiz
297321

298322

299323
[Unreleased]: https://github.com/starkat99/half-rs/compare/v2.2.1...HEAD

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "half"
33
# Remember to keep in sync with html_root_url crate attribute
4-
version = "3.0.0-dev"
4+
version = "2.3.0-dev"
55
authors = ["Kathryn Long <[email protected]>"]
66
description = "Half-precision floating point f16 and bf16 types for Rust implementing the IEEE 754-2008 standard binary16 and bfloat16 types."
77
repository = "https://github.com/starkat99/half-rs"
@@ -16,7 +16,7 @@ exclude = [".git*", ".editorconfig"]
1616
[features]
1717
default = ["std"]
1818
std = ["alloc"]
19-
use-intrinsics = []
19+
use-intrinsics = [] # Deprecated
2020
alloc = []
2121
rand_distr = ["dep:rand", "dep:rand_distr"]
2222

Makefile.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ min_version = "0.35.0"
55
CI_CARGO_TEST_FLAGS = { value = "--locked -- --nocapture", condition = { env_true = [
66
"CARGO_MAKE_CI",
77
] } }
8-
CARGO_MAKE_CARGO_ALL_FEATURES = { source = "${CARGO_MAKE_RUST_CHANNEL}", default_value = "--features=std,serde,num-traits,bytemuck,zerocopy,rand_distr", mapping = { "nightly" = "--all-features" } }
8+
CARGO_MAKE_CARGO_ALL_FEATURES = { source = "${CARGO_MAKE_RUST_CHANNEL}", default_value = "--all-features", mapping = { "nightly" = "--all-features" } }
99
CARGO_MAKE_CLIPPY_ARGS = { value = "${CARGO_MAKE_CLIPPY_ALL_FEATURES_WARN}", condition = { env_true = [
1010
"CARGO_MAKE_CI",
1111
] } }

README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ arithmetic operations. Hardware support for these operations will be used whenev
1313
is available—either through instrinsics or targeted assembly—although a nightly Rust toolchain may
1414
be required for some hardware.
1515

16-
This crate provides [`no_std`](https://rust-embedded.github.io/book/intro/no-std.html) support by
17-
default so can easily be used in embedded code where a smaller float format is most useful.
16+
This crate provides [`no_std`](https://rust-embedded.github.io/book/intro/no-std.html) support so can easily be used in embedded code where a smaller float format is most useful.
1817

1918
*Requires Rust 1.61 or greater.* If you need support for older versions of Rust, use 1.x versions of
2019
this crate.
@@ -26,11 +25,6 @@ See the [crate documentation](https://docs.rs/half/) for more details.
2625
- **`serde`** - Implement `Serialize` and `Deserialize` traits for `f16` and `bf16`. This adds a
2726
dependency on the [`serde`](https://crates.io/crates/serde) crate.
2827

29-
- **`use-intrinsics`** — Use unstable hardware intrinsics for `f16` and `bf16` conversions if
30-
available on the compiler target. By default, only hardware support compatible with the Rust
31-
stable toolchain will be used, or software emulation otherwise. **Available only on
32-
Rust nightly channel.**
33-
3428
- **`alloc`** — Enable use of the [`alloc`](https://doc.rust-lang.org/alloc/) crate when not using
3529
the `std` library.
3630

@@ -64,7 +58,7 @@ for specific CPU features which avoids the runtime overhead and works in a `no_s
6458

6559
| Architecture | CPU Target Feature | Notes |
6660
| ------------ | ------------------ | ----- |
67-
| `x86`/`x86_64` | `f16c` | **Only on nightly Rust toolchain with `use-intrinsics` cargo feature.** This supports conversion to/from `f16` only (including vector SIMD) and does not support any `bf16` or arithmetic operations. |
61+
| `x86`/`x86_64` | `f16c` | This supports conversion to/from `f16` only (including vector SIMD) and does not support any `bf16` or arithmetic operations. |
6862
| `aarch64` | `fp16` | This supports all operations on `f16` only. |
6963

7064
### More Documentation

src/binary16/arch.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
use crate::leading_zeros::leading_zeros_u16;
33
use core::mem;
44

5-
#[cfg(all(
6-
feature = "use-intrinsics",
7-
any(target_arch = "x86", target_arch = "x86_64")
8-
))]
5+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
96
mod x86;
107

118
#[cfg(target_arch = "aarch64")]
@@ -18,7 +15,6 @@ macro_rules! convert_fn {
1815
cfg_if::cfg_if! {
1916
// Use intrinsics directly when a compile target or using no_std
2017
if #[cfg(all(
21-
feature = "use-intrinsics",
2218
any(target_arch = "x86", target_arch = "x86_64"),
2319
target_feature = "f16c"
2420
))] {
@@ -34,7 +30,6 @@ macro_rules! convert_fn {
3430

3531
// Use CPU feature detection if using std
3632
else if #[cfg(all(
37-
feature = "use-intrinsics",
3833
feature = "std",
3934
any(target_arch = "x86", target_arch = "x86_64")
4035
))] {

src/lib.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,14 @@
5656
//!
5757
//! | Architecture | CPU Target Feature | Notes |
5858
//! | ------------ | ------------------ | ----- |
59-
//! | `x86`/`x86_64` | `f16c` | **Only on nightly Rust toolchain with `use-intrinsics` cargo feature.** This supports conversion to/from [`f16`] only (including vector SIMD) and does not support any [`bf16`] or arithmetic operations. |
59+
//! | `x86`/`x86_64` | `f16c` | This supports conversion to/from [`f16`] only (including vector SIMD) and does not support any [`bf16`] or arithmetic operations. |
6060
//! | `aarch64` | `fp16` | This supports all operations on [`f16`] only. |
6161
//!
6262
//! # Cargo Features
6363
//!
6464
//! This crate supports a number of optional cargo features. None of these features are enabled by
6565
//! default, even `std`.
6666
//!
67-
//! - **`use-intrinsics`** — Use unstable hardware intrinsics for [`f16`] and [`bf16`] conversions
68-
//! if available on the compiler target. By default, only hardware support compatible with the
69-
//! Rust stable toolchain will be used, or software emulation otherwise. **Available only on
70-
//! Rust nightly channel.**
71-
//!
7267
//! - **`alloc`** — Enable use of the [`alloc`] crate when not using the `std` library.
7368
//!
7469
//! Among other functions, this enables the [`vec`] module, which contains zero-copy
@@ -184,13 +179,6 @@
184179
#![cfg_attr(not(target_arch = "spirv"), warn(missing_debug_implementations))]
185180
#![allow(clippy::verbose_bit_mask, clippy::cast_lossless)]
186181
#![cfg_attr(not(feature = "std"), no_std)]
187-
#![cfg_attr(
188-
all(
189-
feature = "use-intrinsics",
190-
any(target_arch = "x86", target_arch = "x86_64")
191-
),
192-
feature(stdsimd)
193-
)]
194182
#![doc(html_root_url = "https://docs.rs/half/2.2.1")]
195183
#![doc(test(attr(deny(warnings), allow(unused))))]
196184
#![cfg_attr(docsrs, feature(doc_cfg))]

0 commit comments

Comments
 (0)