Highway (vector loop)
a C++ library that provides portable SIMD/vector intrinsics. - github / HN
Online demos using Compiler Explorer:
Concept
Strip-mining loops
To vectorize a loop, “strip-mining” transforms it into an outer loop and inner loop with number of iterations matching the preferred vector width.
There are several way to do it:
Ensure all inputs/outputs are padded. Then the loop is simply
Process whole vectors as above, followed by a scalar loop
Process whole vectors as above, followed by a single call to a modified LoopBody with masking:
API synopsis / quick reference
FAQ
see also
- Entrywise addition of two double arrays using AVX - code comparison of AVX 512 / AVX / SSE2 loop
- How to use if condition in intrinsics
- Controlling the Data Flow (codingame) / some other reference - v8f - AVX x8 float. 32-bit x 8=256bits
Written on October 24, 2022, Last update on December 2, 2023
c++
lib
avx
loop