r/programming • u/awesomePop7291 • Jul 23 '26
Everyone Should Know SIMD
https://mitchellh.com/writing/everyone-should-know-simd
414
Upvotes
r/programming • u/awesomePop7291 • Jul 23 '26
View all comments
Show parent comment
1
u/tanner-gooding Jul 27 '26
Its not really runtime dynamic, no operating system supports that and rather enforce it to be fixed per process instead.
Linux technically provides APIs to allow actual dynamic changing, but warns you that doing so can/will lead to UB.
It's also not really truly "variable length", you don't even really write your SIMD code that differently. You just rather have some APIs that trivially let you get the leading/trailing masks and deal with the remainder.
Predicated instructions are in fact more expensive than their unpredicated counterparts, so you don't write the entire loop predicated unless you can't help it