3 ms·
Incidentally, SIMD is just waiting on stabilization now; it’s RFC was accepted and the implementation landed. Soon!
by steveklabnik 9y ago
Incidentally, SIMD is just waiting on stabilization now; it’s RFC was accepted and the implementation landed. Soon!
- AnimalMuppet 9y agoWill Rust have idioms for really doing SIMD in Rust? If I understand correctly, C++ has to drop into assembly to do SIMD (at least so far).
- pjmlp 9y agoC++ doesn't need Assembly for SIMD. Most compilers do a reasonable job with auto-vectorization, and if more is needed, there are instrisics. No need to write straight Assembly.
- AnimalMuppet 9y agoOK. (The one time I encountered SIMD in C++ was a decade ago; we had to use assembly then. And even then, we weren't playing with an up-to-the-minute compiler. (In my experience, your comments elsewhere on this article about embedded toolchains were accurate.) Are the intrinsics standard? If so, what version of the standard were they in? How good is compiler support for them?
- AstralStorm 9y agoNot standard, unless you count "supported with the same semantics in multiple compilers" as good enough. They are not portable between CPU architectures either way For reference, C got real alignment support in C11 and C++ in C++17. Without this, even starting on SIMD is risky. That said, you can go really far with a good C++ math library like Eigen which has singe vectorization in the operations themselves.
- steveklabnik 9y agoI don’t believe that’s correct for C++. Regardless, yes, that’s the whole point. What’s been accepted is https://doc.rust-lang.org/nightly/core/arch/index.html https://doc.rust-lang.org/nightly/core/arch/index.html , that is, intrinsics that map 1-1 to the vendor APIs. (I belive this is the same in C++ but not my area of specialty so I may be wrong) https://doc.rust-lang.org/nightly/core/simd/index.html https://doc.rust-lang.org/nightly/core/simd/index.html is the first level up the abstraction chain; this hasn’t gone through an RFC process yet, but will eventually happen. On top of that, you have stuff like https://crates.io/crates/faster https://crates.io/crates/faster , which is very high level. Looks like they need to fix up the README... but you get the idea. Also, autovectorization has existed this entire time. This stuff is for when that falls down.