Skip to content

Add f16 vector support#513

Merged
calebzulawski merged 4 commits intorust-lang:masterfrom
folkertdev:f16-support
Apr 11, 2026
Merged

Add f16 vector support#513
calebzulawski merged 4 commits intorust-lang:masterfrom
folkertdev:f16-support

Conversation

@folkertdev
Copy link
Copy Markdown
Contributor

@folkertdev folkertdev commented Mar 18, 2026

closes #484

This is blocked on a proptest release: the required changes have been merged, but not released yet.

Comment thread crates/core_simd/src/vector.rs Outdated
@folkertdev folkertdev force-pushed the f16-support branch 6 times, most recently from 223b255 to a8ff036 Compare March 18, 2026 23:16
@folkertdev folkertdev mentioned this pull request Mar 18, 2026
@rustbot

This comment has been minimized.

@folkertdev folkertdev force-pushed the f16-support branch 2 times, most recently from fc96ee5 to fd68e12 Compare March 24, 2026 11:13
@folkertdev
Copy link
Copy Markdown
Contributor Author

The latest release of proptest https://crates.io/crates/proptest/1.11.0 includes the f16 feature flag that enables the functionality we need for f16 support here. So assuming CI still passes this is ready.

@folkertdev folkertdev marked this pull request as ready for review March 24, 2026 11:17
@folkertdev
Copy link
Copy Markdown
Contributor Author

I'm not sure what's up with the wasm tests, locally running wasm-pack test --firefox --headless crates/core_simd works fine but on CI it appears to just get stuck on building the crates.

@calebzulawski
Copy link
Copy Markdown
Member

Might be worth trying a cargo update before trying to actually debug it

@folkertdev
Copy link
Copy Markdown
Contributor Author

Turns out this LLVM IR with +simd128 will just get stuck

define <8 x i16> @foo(<8 x half> %x) {
start:
  %1 = fcmp uno <8 x half> %x, zeroinitializer
  %2 = sext <8 x i1> %1 to <8 x i16>
  ret <8 x i16> %2
}

I'll debug that further, of course. Should we block on this? f16 is unstable anyway so it seems unlikely for someone to run into this in practice.

@calebzulawski
Copy link
Copy Markdown
Member

Historically we've identified the function that generates the bad LLVM behavior and replace it with a temporary scalar loop for that architecture. The next best option is if you could find the test that hits it, disable it for that architecture. I don't think we need to block on this, but probably report it to LLVM.

@folkertdev
Copy link
Copy Markdown
Contributor Author

I believe it's any comparison on f16, so things like is_finite or is_nan. We don't have a really targeted way of skipping those tests though so we'd just have to skip f16 tests on wasm32 + simd128.

@folkertdev
Copy link
Copy Markdown
Contributor Author

@calebzulawski if that's acceptable, this should be ready now. I did open an LLVM issue also llvm/llvm-project#189251.

@folkertdev
Copy link
Copy Markdown
Contributor Author

@calebzulawski quick ping, or should I assign someone else?

@calebzulawski calebzulawski merged commit 0557e34 into rust-lang:master Apr 11, 2026
53 checks passed
@calebzulawski
Copy link
Copy Markdown
Member

Sorry about that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fp16 support

4 participants