Re:Vectorization: Introduction
by dragontamer on Thursday June 01, 2023 @07:24PM
(#36158819)
The linked document describes Intel's autovectorizer, it's warnings and compiler flags that point out which loops autovectorized or not, as well as listing specific reason codes why.
Microsoft, GCC and Clang all do this too, though with different compiler flags and messages.
I'd say that the whole point of this document listed here is to build up the programmer to understanding these error messages and specifically know how to fix the errors that causes a autovectorization-fail.
Re:Vectorization: Introduction
by galangalalgol on Thursday June 01, 2023 @09:28PM
(#36159742)
In rust I've noticed using iterators instead of for loops tends to trigger auto vectorization more often.
The trick with coding for auto-vectorization is to keep your loops small and free of clutter.
I don't have the documentation handy but I think you only need to follow a couple rules:
- loop must have a defined size (for-loop instead of while-loop)
- don't muck with pointers inside the loop (simple pointer increment is okay)
- don't modify other variables (only the array should be modified)