simde icon indicating copy to clipboard operation
simde copied to clipboard

Make sure SIMDe's x86 headers work as well on WASM as Emscripten's

Open nemequ opened this issue 3 years ago • 1 comments

Emscripten currently carries compatibility headers for several x86 ISA extensions. They're not nearly as extensive as ours but they are more carefully tested, and their performance is better documented (i.e., they actually have some documentation about which functions can be expected to have fairly fast implementations vs. which are scalarized).

We need someone to go through their implemenations and make sure our implementations are the same (or better). If our implementations are not as good, we should adopt their implementations (the emscripten headers are available under the MIT license, so this shouldn't be a problem). If ours are better, we should at least let the emscripten people know so they can adopt ours (a patch would be better, but a list would still be great).

It's important that we not make any assumptions, especially when it comes to autovectorization. Compiler Explorer should be a great tool to see what instructions are generated, but it would also be a good idea to create a repository to compile small code fragments to WebAssembly, then disassemble them so we can verify that there are no regressions in the future. I've done something similar in the tests branch of WAV which could be used as a guide. This should also include an option to use Emscripen's headers instead as a way to verify that the implementations match.

During this process, it will be important to track results and what has been done and what remains. This works out well because that information can also be kept for use as documentation which will be helpful for developers using the headers similar to Emscripten.

Once this is done we can get back to discussing the possibility of just using SIMDe in emscripten instead of duplicating efforts, which should be good for both projects.

nemequ avatar May 17 '21 19:05 nemequ

Just to chime in that we use SIMDe to good effect in an emulator project[1]. It would be great to see it take advantage of same from emscripten/WASM. [1] - https://github.com/danoon2/Boxedwine

kevodwyer avatar Aug 29 '21 14:08 kevodwyer