Get the latest tech news
The messy reality of SIMD (vector) functions
We’ve discussed SIMD and vectorization extensively on this blog, and it was only a matter of time before SIMD (or vector) functions came up. In this post, we explore what SIMD functions are, when they are useful, and how to declare and use them effectively. A SIMD function is a function that processes more than… Read
While SIMD functions offer appealing performance benefits in theory, in practice, there are several limitations and caveats that reduce their effectiveness. So even if you have a vector function, the autovectorizer will not use it unless (1) you use#pragma omp simd on the caller loop or (2) it is marked as const and nothrow, using GCC attributes. When writing this blog post, I experimented a lot with GCC’s vector function capabilities, and this feature looks like far from perfect:
Or read this on Hacker News