-
Notifications
You must be signed in to change notification settings - Fork 70
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
Use WebAssembly SIMD instructions #34
Conversation
I'm also preparing a PR with NEON intrinsics 😄 (which they also intend to stabilize soon, probably a bit later than the WASM ones though) |
|
I don't think safe-arch is necessary here, at least when it comes to the unsafety concern. They are soon, before stabilizing, making those intrinsics safe. For testing we could probably run the tests with wasmtime. |
I want this crate to be compilable with |
Yeah once the intrinsics are safe this will not need any unsafe anymore. They can make them safe on WASM because the runtime validates the WASM file before running it, so only instructions it supports are allowed. So either the module runs and there is no unsafety, or the module doesn't run and there's no unsafety either, because no code is ever executed. |
Here is the PR to Rust: rust-lang/rust#84988 |
Got it. Thanks! |
They are stabilized in Rust 1.54.
639940a
to
b1d1ad3
Compare
Alright many things happened:
I also benchmarked it with one of the examples and it's about twice as fast. It's 4:00am right now, I'll try to look into testing on CI when I wake up. (Though I believe last I tried wasmtime with SIMD it segfaulted, so yeah idk if they are ready yet) |
e8df804
to
4dcf890
Compare
Alright CI is implemented now too. (It uses nightly for now, your decision to wait for 1.54 to release or not) |
Nice! Do I understand correctly that |
Yes and no. It still compiles on stable if you don't activate the feature, but LLVM features are never gated by Rust's stability, so while technically SIMD128 isn't considered stable on stable Rust, you can still activate the LLVM feature and it would fail to compile. (Which honestly is maybe worth raising an issue about) |
I think we should wait until Anyway, thanks for you contribution. I'm also looking forward for NEON support, because lately I got mac M1 and I actually have a hardware for testing. Sadly, NEON is still unstable in Rust for some reason. Maybe you know when they plan to make it stable? |
I asked about NEON stabilization here: rust-lang/stdarch#1125 |
@jrmuizel Thanks. From what I understood the core team simply doesn't have time to stabilize them. |
As far as I understand it, they want more automatic testing first, and there's this fairly active PR that does exactly that: rust-lang/stdarch#1170 |
4dcf890
to
26afb11
Compare
We can merge now? |
Yes, 1.54 released, CI is green on stable. However should I maybe still keep nightly CI for the WASM part as well? So stable + nightly. For LLVM 13 and co. that might be coming up. |
I'm fine as long as it works on stable. Nightly is not a priority. One last question: what is the current MSRV? Can I build non-WASM variant on Rust < 1.54? |
non-WASM: 1.45.0 Maybe another CI run that checks non-SIMD WASM still works on 1.45.0 though? Anyways, if not, feel free to merge. |
Done. Thanks again! I hope NEON would become stable soon, because tiny-skia performance on M1 mac is pathetic. |
WebAssembly SIMD is almost here. Chrome 91 releases today. It is the first browser to ship WASM SIMD. Firefox 89 will follow in a bit over a week as well. Rust also intends to stabilize these instructions very soon. Until then this PR will stay WIP.