-
Notifications
You must be signed in to change notification settings - Fork 69
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
Support WebAssembly Relaxed SIMD #126
Conversation
1c0fd06
to
ffb16e5
Compare
I also looked into the relaxed multiply add instructions, which would be cool to use too. However, what's weird is that Skia itself uses fused multiply add (fma) as well when it's available, and it doesn't when it's not. This however means that Skia at least in theory should produce different results depending on whether those instructions are used or not. So depending on how you feel about that, I can add support for fma as well (which I have ready locally). It seems like you perceived the same problem in #88 |
Are you sure? x86 and amd64 should produce identical results. |
Got it. |
This makes use of the [WebAssembly Relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) instructions, trade off consistent results across architectures for certain edge cases to gain better performance. These differing edge case behaviors already exist in the native equivalents that are used in the SIMD implementation, so this does not regress any correctness.
I thought the just released Rust 1.81 is the one with relaxed SIMD, but it turns out to be 1.82 that releases with it. Technically the code at least still builds with 1.81, just doesn't make use of the new instructions yet, so this PR could technically already get merged and released, but we can also wait until 1.82. |
I guess fused multiply should be a separate PR anyway, because it concerns x86 and ARM as well. |
Thanks! Looks good to me. What is the difference between |
There is WASI Preview 1, which is now renamed into WASI 0.1 and also WASI 0.2 that is about to release in 1.82 (was supposed to release today, but they messed up). They renamed the target to wasip1 and wasip2 respectively (p standing for either "point" or "preview") with a warning if you still use the old one to ensure you get the WASI version that you expect. Theoretically CI could eventually start using WASI 0.2, but it's a lot more complex of a target (they have a whole new component system going on), which doesn't really buy us anything, if what we want to do is just test the actual wasm architecture, rather than any WASI relevant features themselves. |
Got it. Thanks for the explanation! |
This makes use of the WebAssembly Relaxed SIMD instructions, which trade off consistent results across architectures for certain edge cases to gain better performance. These differing edge case behaviors already exist in the native equivalents that are used in the SIMD implementation, so this does not regress any correctness.
This is about to stabilize in nightly. So this will likely have to wait for the feature to ride to stable Rust.