Skip to content
Merged
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
# If the compilation fails, then the version specified here needs to be bumped up to reality.
# Be sure to also update the rust-version property in the workspace Cargo.toml file,
# plus all the README.md files of the affected packages.
RUST_MIN_VER: "1.86"
RUST_MIN_VER: "1.88"
# List of packages that will be checked with the minimum supported Rust version.
# This should be limited to packages that are intended for publishing.
RUST_MIN_VER_PKGS: "-p fearless_simd"
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ You can find its changes [documented below](#020-2025-10-10).

## [Unreleased]

This release has an [MSRV][] of 1.86.
This release has an [MSRV][] of 1.88.

### Changed

- Breaking change: `Level::fallback` has been removed, replaced with `Level::baseline`. ([#105][] by [@DJMcNab][])
This corresponds with a change to avoid compiling in support for the fallback level on compilation targets which don't
require it; this is most impactful for binary size on WASM, Apple Silicon Macs or Android.
A consequence of this is that the available variants on `Level` are now dependent on the target features you are compiling with.
The fallback level can be restored with the `force_support_fallback` cargo feature. We don't expect this to be necessary outside
of tests.

### Removed

- Breaking change: The (deprecated) `simd_dispatch!` macro. ([#105][] by [@DJMcNab][])

## [0.3.0][] (2025-10-10)

Expand Down Expand Up @@ -85,6 +98,7 @@ No changelog was kept for this release.
[#93]: https://github.com/linebender/fearless_simd/pull/93
[#96]: https://github.com/linebender/fearless_simd/pull/96
[#99]: https://github.com/linebender/fearless_simd/pull/99
[#105]: https://github.com/linebender/fearless_simd/pull/105

[Unreleased]: https://github.com/linebender/fearless_simd/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/linebender/fearless_simd/compare/v0.3.0...v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/fearless_simd"
# Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files
# and with the MSRV in the `Unreleased` section of CHANGELOG.md.
rust-version = "1.86"
rust-version = "1.88"

[workspace.lints]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ It benefited from conversations with Luca Versari, though he is not responsible

## Minimum supported Rust Version (MSRV)

This version of Fearless SIMD has been verified to compile with **Rust 1.86** and later.
This version of Fearless SIMD has been verified to compile with **Rust 1.88** and later.

Future versions of Fearless SIMD might increase the Rust version requirement.
It will not be treated as a breaking change and as such can even happen with small patch releases.
Expand Down
41 changes: 41 additions & 0 deletions check_targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# A script to run cargo check for fearless_simd on each supported platform.
# We currently don't run this in CI, as we expect it would take too long.
# Before using, you must run:
# rustup target add aarch64-linux-android x86_64-unknown-linux-gnu i686-pc-windows-msvc wasm32-unknown-unknown riscv64gc-unknown-linux-gnu

# Run using `sh ./check_targets.sh`
# TODO: Make into an xtask like thing so that windows users can use easily.

# aarch64, both with and without neon support.
# Note that doing `-neon` is not sound due to the standard library's ABI, but the
# binary is never executed (nor indeed is it even created), and it's still a useful sanity check.
RUSTFLAGS=-Ctarget-feature=-neon cargo check -p fearless_simd --target aarch64-linux-android
RUSTFLAGS=-Ctarget-feature=-neon cargo check -p fearless_simd --target aarch64-linux-android --features force_support_fallback
cargo check -p fearless_simd --target aarch64-linux-android --features force_support_fallback
cargo check -p fearless_simd --target aarch64-linux-android

# x86_64, at all supported static SIMD levels.
RUSTFLAGS=-Ctarget-feature=+avx2,+fma cargo check -p fearless_simd --target x86_64-unknown-linux-gnu
RUSTFLAGS=-Ctarget-feature=+avx2,+fma cargo check -p fearless_simd --target x86_64-unknown-linux-gnu --features force_support_fallback
RUSTFLAGS=-Ctarget-feature=+sse4.2 cargo check -p fearless_simd --target x86_64-unknown-linux-gnu
RUSTFLAGS=-Ctarget-feature=+sse4.2 cargo check -p fearless_simd --target x86_64-unknown-linux-gnu --features force_support_fallback
cargo check -p fearless_simd --target x86_64-unknown-linux-gnu
cargo check -p fearless_simd --target x86_64-unknown-linux-gnu --features force_support_fallback

# x86 (i.e. 32 bit) at all supported static SIMD levels.
RUSTFLAGS=-Ctarget-feature=+avx2,+fma cargo check -p fearless_simd --target i686-pc-windows-msvc
RUSTFLAGS=-Ctarget-feature=+avx2,+fma cargo check -p fearless_simd --target i686-pc-windows-msvc --features force_support_fallback
RUSTFLAGS=-Ctarget-feature=+sse4.2 cargo check -p fearless_simd --target i686-pc-windows-msvc
RUSTFLAGS=-Ctarget-feature=+sse4.2 cargo check -p fearless_simd --target i686-pc-windows-msvc --features force_support_fallback
cargo check -p fearless_simd --target i686-pc-windows-msvc
cargo check -p fearless_simd --target i686-pc-windows-msvc --features force_support_fallback

# Wasm, both with and without SIMD.
cargo check -p fearless_simd --target wasm32-unknown-unknown
cargo check -p fearless_simd --target wasm32-unknown-unknown --features force_support_fallback
RUSTFLAGS=-Ctarget-feature=+simd128 cargo check -p fearless_simd --target wasm32-unknown-unknown
RUSTFLAGS=-Ctarget-feature=+simd128 cargo check -p fearless_simd --target wasm32-unknown-unknown --features force_support_fallback

# riscv64, which is importantly a target we don't support any SIMD levels for.
cargo check -p fearless_simd --target riscv64gc-unknown-linux-gnu
cargo check -p fearless_simd --target riscv64gc-unknown-linux-gnu --features force_support_fallback
4 changes: 4 additions & 0 deletions fearless_simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ libm = ["dep:libm"]
# beyond the basic SIMD operations abstracted on all platforms
safe_wrappers = []

# Force the "fallback" SIMD level to be supported
# This is primarily used for tests
force_support_fallback = []

[lints]
workspace = true

Expand Down
3 changes: 2 additions & 1 deletion fearless_simd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ The following crate [feature flags](https://doc.rust-lang.org/cargo/reference/fe
- `libm`: Use floating point implementations from [libm].
- `safe_wrappers`: Include safe wrappers for (some) target feature specific intrinsics,
beyond the basic SIMD operations abstracted on all platforms.
- `force_support_fallback`: Force scalar fallback, to be supported, even if your compilation target has a better baseline.

At least one of `std` and `libm` is required; `std` overrides `libm`.

Expand All @@ -124,7 +125,7 @@ At least one of `std` and `libm` is required; `std` overrides `libm`.

## Minimum supported Rust Version (MSRV)

This version of Fearless SIMD has been verified to compile with **Rust 1.86** and later.
This version of Fearless SIMD has been verified to compile with **Rust 1.88** and later.

Future versions of Fearless SIMD might increase the Rust version requirement.
It will not be treated as a breaking change and as such can even happen with small patch releases.
Expand Down
5 changes: 4 additions & 1 deletion fearless_simd/src/generated/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ impl Simd for Fallback {
type mask32s = mask32x4<Self>;
#[inline(always)]
fn level(self) -> Level {
Level::Fallback(self)
#[cfg(feature = "force_support_fallback")]
return Level::Fallback(self);
#[cfg(not(feature = "force_support_fallback"))]
Level::baseline()
}
#[inline]
fn vectorize<F: FnOnce() -> R, R>(self, f: F) -> R {
Expand Down
7 changes: 6 additions & 1 deletion fearless_simd/src/generated/sse4_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ impl Simd for Sse4_2 {
type mask32s = mask32x4<Self>;
#[inline(always)]
fn level(self) -> Level {
Level::Sse4_2(self)
#[cfg(not(all(target_feature = "avx2", target_feature = "fma")))]
return Level::Sse4_2(self);
#[cfg(all(target_feature = "avx2", target_feature = "fma"))]
{
Level::baseline()
}
}
#[inline]
fn vectorize<F: FnOnce() -> R, R>(self, f: F) -> R {
Expand Down
Loading