SIMD Lanes, Masks, and Remainders
Group independent operations into lanes and explain how dependencies, masks, and floating-point semantics constrain a vector loop.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
One instruction applies to several lanes
To add two arrays into a separate result, a four-lane operation can process four independent element pairs. For ten elements, use two full groups and handle the final two with a scalar cleanup or lanes masked according to the target’s supported semantics. Memory access alignment and aliasing can constrain safe use of a vector load or store. A mask for arithmetic alone does not excuse an invalid memory access before it.
Reductions need an ordering argument
Summing elements can create four independent partial sums and combine them at the end. This changes the association of additions and can produce a different floating-point result. A vectorization rule needs permission for that change or an implementation with the expected ordering. Floating-point rounding explains the difference. Matrix tiling connects vector work to reuse of the data feeding it.[1][2]