Optimize norm gathering asm in C++
https://blog.serenedb.com/norm-gatheringWe replaced SereneDB's AVX2 gather intrinsics with pure C++ and it actually beat intrinsics on x86_64.
The trick is combining сlang's auto-vectorization for dense data with #pragma unroll to let out-of-order execution handle sparse data. The post covers the assembly breakdown and some compiler traps that can make your code slower.
Happy to answer any questions below!
If you enjoy C++ systems optimization star us we appreciate your support!
25
Upvotes
View all comments
Show parent comment
2
u/MBkkt Apr 08 '26
Sounds interesting, I think there're two options:
From my experience avx512 sometimes have great instructions (and register size doesn't really matter), and the only bad thing about it, that not all processors support them.
Anyway, thanks for suggestions!