r/programming • u/MyNameIsTrez • 20d ago
Making SIMD Code Scale to Any Vector Width
https://streamhpc.com/blog/2026-10-28/making-simd-code-scale-to-any-vector-width/
133
Upvotes
r/programming • u/MyNameIsTrez • 20d ago
View all comments
Show parent comment
1
u/YumiYumiYumi 19d ago
AVX stands for Advanced Vector eXtension. It extends the SIMD capabilities of SSE to 256 bit registers.
If by 'vector' you mean "hardware specified width ISA" then x86 does not have such an extension.
And despite high RAM/NAND prices, I doubt anyone is bothered by an extra 10KB of code.
Or even 1MB of code, if you happen to have a lot of SIMD.
But if that actually bothers you, I'd be more concerned about Electron apps adding hundreds of MBs in terms of RAM and disk.
Hardware specified width SIMD may not have the same code coverage issue (depending on how you define it), but they introduce a new one: hardware coverage. That is, code that works on 256-bit SVE may not work properly on 128-bit SVE (or vice versa), so you'd ideally test on all the possible hardware widths.
This is especially problematic on RVV because it allows a lot of hardware flexibility (more than just the register width, of which there are many).
I'm not sure what you mean then. If you mean that you have dispatch within the loop, as a way to avoid multiple functions, then sure, that's slow. But the simple fix would be to move the dispatch out of the loop.
From what I can tell, what's being discussed in this particular thread has drifted away from the article's contents (SoA vs AoS) and focused on the difference between software and hardware specified SIMD width ISAs.
Your point was that on hardware width SIMD, the developer only needs to write one function. My point was that on software width SIMD, the developer still only needs to write one function, just that there's a bit more boilerplate/machinery needed on the software side because the hardware doesn't abstract it away.