4 ms·
This sort of vectorised pseudo branching is often used in SIMD algorithms
by VHRanger 6y ago
This sort of vectorised pseudo branching is often used in SIMD algorithms
- cozzyd 6y agoYes... and the transformations are often non-trivial (especially when considering the possibility of out-of-bounds elements, which can't just safely be multiplied by zero--they might be a NaN, or on the edge of a page). It would be nice if there was a tool (or compiler option!) that could convert my branchy code into an "identical" (assuming floating-point associativity, etc.) branchless version.
- snovv_crash 6y agoThe Eigen Array [1] object is fairly close to this. Combining the 'select' with comparisons, chained operators etc. Eigen vectorized stuff pretty effectively too. 1. https://eigen.tuxfamily.org/dox/group__TutorialArrayClass.html https://eigen.tuxfamily.org/dox/group__TutorialArrayClass.ht...
- cozzyd 6y agoInteresting... I've used Eigen for matrix operations before, I did not know they had such a smart general-purpose array implementation!