-
Notifications
You must be signed in to change notification settings - Fork 53
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
SSE2 compatibility should be warranted #10
Comments
This emulation of smmintrin.h (adapted from SSEPlus) suffices to compile. I wanted to see what Emscripten would make of this, but the generated javascript floods the CPU... Good luck with the project. |
Correction: the first two tests work, the simple_demo() hangs (compiled with Emscripten). |
Hi, i've started to work on this having half a free day. But it is somehow strange :) I had to find out that i have no single machine not supporting sse4.1. Nevertheless, i made this small patch locally in the makefile:
And then i compile like Thanks. |
@wshager thanks for the interest. Could you please be more verbose about how you compile and test it, and what HW was used? Thanks. |
@weltling I used Emscripten to compile, and since it only supports SIMD intrinsics up to SSE2, newer headers simply won't be found in the Emscripten lib. The HW doesn't seem relevant in this case. The current lack of SIMD support in javascript kinda puts this project on hold for me, since I'm looking for a solution in the browser. |
SSE 4.1 was introduced ~ 2007. I am not sure whether anyone makes x64 CPUs today without SSE 4.1. Anyone knows? |
Checked in a version of the code that should compile fine given the proper compiler settings. @wshager Hopefully, the code should be compilable by Emscripten if there is SIMD support. |
@lemire, yeah, i was linking this ttp://store.steampowered.com/hwsurvey in another thread which tells that sse4.1 is still used by round 83% in the gaming, which should be the indicator. I was planning long to go for the emulation layer, just it was quite busy times on my side inbetween. But now when i've came to it, the strange thing was that gcc -msse2 was compiling just fine the existing code even before your patch. So maybe gcc already inserts some emulation, or ignores the option. That's why I was wondering :) BTW Visual Studio seems to not to have options to enforce some specific SSE version compatibility, seems the runtime will do the job. But by the plan I had was to implement a compatibility layer explicitly. Thanks. |
The goal of my fix is to allow @wshager to go forward with his plan to compile this library with Emscripten. I'd be very interested in hearing about the results...
It is an interesting reference.
I do not think that You can certainly emulate SSE 4.1 functions, but you will get awful performance. It is probably not worth it. Better not use SIMD instructions in the first place if you have to support obsolete hardware. |
@lemire great, I got it exactly the way you told. With your fix it satisfies SSE2. But effectively it excludes several functionality. I was more talking about keeping the APIs, but having necessary parts emulated. Regarding performance - clear, SSE 2 were worse than 4.1. But I were more about compatibility. It's just down to whether to retain APIs compatible vs. moving forward with features. Another point is also, that SIMD in any form will certainly provide a better performance compared to plain C/C++. More practical applicability vs. speed within SSE versions, as round 1/5 of cases sounds still significant to me. OFC i don't insist on this, just it was what we discussed earlier, why i opened this issue back then. I'm likely to call it a day then, mostly for the time reasons for my part. Thanks. |
Some non-SSE2 SIMD instructions we use (e.g., Even when the SIMD instruction can be emulated with SSE2 instructions (e.g., |
@lemire thanks! The example now compiles to Emscripten. Steps to reproduce: emcc -O2 src/simdbitpacking.c -o simdbitpacking.bc -msse2 -Iinclude I'll puzzle some more on dynamic calls from JS later, and report my experiences in #13. Moving forward, I expect Emscripten to support SSE4.1 in short term. |
This looks like a very interesting use case of SIMD.js! I'd be very curious to see comparison graphs of native scalar vs native SIMD vs JS scalar vs JS SIMD performance to get a reality check of the suitability of the upcoming SIMD.js specification on your SIMD use case. If you generate such benchmark results at some point, please ping me in for the numbers! |
@juj I'd be happy to. |
Which version of emscripten do you use? The fact that there is no
|
@lemire I use 1.35.0. Choose 'emsdk_portable install latest' / 'emsdk_portable activate latest'. |
@wshager Makes sense. Thanks. |
@wshager Right. It builds.
|
@lemire you can add |
Thanks. I am just checking things out in case others want to try it out (so that it is documented). |
@lemire great. I'm going to try to rewrite some functions using SIMD.js. I'll report that too. |
See the actual discussion here 1a6ea48, but in short - while various SSE versions have useful features, SSE2 is the standard set. The suggestion is to retain the compatibility with SSE2 even while some features from the upper SSE versions are used.
This is done by the following steps
The text was updated successfully, but these errors were encountered: