Hacker News new | ask | show | jobs
by cobbzilla 6 days ago
If you’re processing N things at a time and your “scalar tail” is N-1 why can’t you put in a dummy value for the last entry, run one last SIMD iteration, and discard the dummy return value?
2 comments

You can, but usually the code may have problems with this. For example, storing out of bounds is often going to give you a bad time. Some platforms that are all SIMD all the time will support masked operations for this kind of thing.
There is some discussion of the possible options here: https://github.com/google/highway#strip-mining-loops