r/programming • u/awesomePop7291 • Jul 23 '26
Everyone Should Know SIMD
https://mitchellh.com/writing/everyone-should-know-simd
413
Upvotes
r/programming • u/awesomePop7291 • Jul 23 '26
View all comments
Show parent comment
3
u/tanner-gooding Jul 27 '26
Unaligned access is still a fairly big deal today, especially for large payloads, and is only equally fast for the accesses that don't split a cache line.
If you do split a cache line, you still incur at least a 1-cycle penalty on loads (sometimes 2) and stores tend to be quite a bit more expensive. -- Unaligned accesses may then also lose out on atomicity guarantees, which can impact multithreading.
So V128 incurs a penalty every 4 accesses, V256 every 2, and V512 every access. If you have multiple inputs or destinations, it can be even more regular or higher cost.
Page splits are then even more expensive, but that's typically every 4k bytes, so tends to get lost in the noise.