intel-intrinsics
intel-intrinsics copied to clipboard
WASM: use WASM intrinsics for faster performance
I just noticed that WASM also has SIMD support. (I'm not personally interested at the moment, but hope this helps someone in the future ;-)
Perhaps performance is already quite OK, but I can imagine that implementations of certain intrinsics can be improved by using WASM intrinsics.
https://v8.dev/features/simd https://emscripten.org/docs/porting/simd.html
Looks like the LDC/LLVM attribute to add is "simd128": -mattr=+simd128
. So that's __traits(targetHasFeature, "simd128")
, and version(WebAssembly)
.
https://d.godbolt.org/z/WrxP8EqMo
Yes, simd-everywhere has support for this. It's a significant amount of work, and I'm not sure if the Webasm target supports the druntime?
No druntime support yet afaik (I think @skoppe has worked on it), but that's not needed for the intrinsics.
It seems druntime doesn't build with wasm?
This is with LDC 1.27-b3
So it turns out when using WASM you can't use druntime nor libc... fun
yeah... this feature request is too soon, I think.
mmm apart from _mm_malloc
and _mm_free
I see no big difficulty (and of course the ever-difficult rounding functions)
at least for basic slow support
Impractical without a libc, since WASM builtin grow memory but do not malloc/free/realloc