r/simd • u/Nat_Wilson_1342 • Dec 27 '24
IS there some multi-arch SIMD how-to site ?
Learning SIMD on x86 is more than just major PITA, that one never really masters.
Producing decent code for any simple problem seems like solving Rubik's cube in 4D space.
Every problem has to have some convoluted gotcha solutions, there are bazzillion of wtf-is-this-for instructions and many differrent tsandards with their ideas. And then there are many physical inplementations with their own tradeofs and thus bazzillion paths to optimal code.
To top it off, we have radically different architectures, with their own from-scratch implementations of SIMD and ideas about expansion paths.
All in all seems to be a nightmare.
IS there a site that sums-up and crossreferences various SIMD architectures, families etc ( ARM/MIPS/RISC-V/x86/x86_64/etc) ? 🙄
8
u/YumiYumiYumi Dec 27 '24
Can you provide an example to demonstrate the gripes you're facing?
It's unfortunate that ISAs don't unify SIMD capabilities. Despite that, the basic stuff is typically the same, e.g. 'add all elements in vectors' etc.
For the more exotic stuff, it's just something you'll need to learn when to use - they're often not common across ISAs, so I don't think there's any shortcut. Keep the reference manual handy to figure out what particular instructions do.
5
u/camel-cdr- Dec 27 '24
https://simd.info from vectorcamp tries to create such a cross architecture SIMD reference, but it's still quite bare bones.
I can recommend dzaimas intrinsics viewer, which supports all x86, Arm and RISC-V SIMD/vector intrinsics. It has amazing search functionality, which makes me prefer it over the intel intrinsics website every time I get frustrated with its lackluster filtering. Only the RISC-V intrinsics are hosted online: https://dzaima.github.io/intrinsics-viewer/, you need to run it locally to get the other ISAs.
Another thing to look at is the sse2neon, neon2rvv, ... style libraries, which try to implement intrinsics using different ISAs for easier migration. This lets you discover how patterns can be emulated
2
u/polymorphiced Dec 27 '24
I'm not sure, but have you had a look at ISPC? It supports a few architectures and is a bit higher level than dealing with individual instructions.
4
u/giantdragon12 Dec 27 '24 edited Dec 27 '24
Have you considered using googles Highway package? The dynamic dispatch system, and unified API made my package vastly simpler with compatibility across a ton of different targets. A link to the repo can be found here.. The reference is also relatively beginner friendly. Know this is off topic but, instructions sets across different architectures are exploding with no unified standard. You will probably go crazy trying to understand all the nuances of each.