-
Notifications
You must be signed in to change notification settings - Fork 272
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
Start testing runtime execution of wasm32 simd intrinsics (take 2) #740
Conversation
We can even test some of the functions!
FYI emscripten already has a header (and tests) for some of these :) |
Perhaps yeah, but I'm not sure what relation that has to this PR? |
I thought it might be interesting to inspect the tests there to see if anything that's still commented out here already should work. |
I started getting some of them passing in this PR yeah but it's going to take a lot of work to uncomment them since the interface has changed since they were first written and it's a lot of macros to update. I was going to try tackling that when I had time later but wanted to get this landed first. |
I am very interested in the LLVM failures you’re seeing when compiling with +simd128. Can you share more details? |
@tlively everything that's commented out here did not work last time we tried, this PR enables some of those tests, but we really should be filling bugs for what's not working yet. We have been low on filling LLVM bugs for those cases, but if you want to explore these it might be better for you to either play with those in godbolt (I can help you set up a godbolt environment that allows you to easily play with them), or to try to compile these with the rust toolchain (I can also help you here, you only need nightly rust, and compiling the |
@tlively sure yeah! To be clear though I didn't think these were bugs in LLVM because while LLVM may have errors with That being said there's a bunch of functions here tagged as The easiest way to see them is to work with this PR directly, but in the spirit of a shortcut an example is the define <4 x i32> @i64x2_neg(<4 x i32> %a) {
%a2 = bitcast <4 x i32> %a to <2 x i64>
%neg1 = insertelement <2 x i64> undef, i64 -1, i32 0
%neg2 = shufflevector <2 x i64> %neg1, <2 x i64> undef, <2 x i32> zeroinitializer
%negated = mul <2 x i64> %a2, %neg2
%r = bitcast <2 x i64> %negated to <4 x i32>
ret <4 x i32> %r
} That, when compiled with Because all the functions work with |
@gnzlbg FWIW I think this is ready to go, I think CI failures were introduced in the recent rdtsc change? |
Yeah, I have a fix for that, but it's in #737 . |
This commit starts to add support to CI to not only compile all wasm32 SIMD intrinsics but also actually execute some of them at runtime. Node 12 has an update of v8 which aligns internal opcode definitions with the most recent version of the wasm SIMD spec. As a result we can start actually executing some WebAssembly code with SIMD instructions in it!
Unfortunately not all SIMD instructions are implemented in v8 right now. In LLVM this is known as the
+simd128
feature (what v8 implements) and the+unsupported-simd128
(everything v8 doesn't implement but is spec'd). We continue to compile the library with both features (to make sure it works) but this PR then also adds a mdoe where it compiles with only+simd128
and executes the resulting binary in node.js. Unfortunately compiling with just+simd128
results in lots of LLVM errors, so we also compile with--cfg only_node_compatible
to statically remove non-node-compatible functions.The end result is that we're successfully executing all
#[assert_instr]
annotations! Additionally I've started uncommenting some tests inmod tests
and updating them to the new intrinsic names. There's still a lot more work to be done there, but I figured it'd be good to post this for initial feedback.In general, the changes here are:
#[cfg]
to optionally remove SIMD which isn't implemented in node.jsThis is a follow-up to #715