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:

Get the Android app

Or read this on Hacker News

Read more on:

Photo of functions

functions

Photo of vector

vector

Photo of messy reality

messy reality

Related news:

News photo

Finding a billion factorials in 60 ms with SIMD

News photo

SIMD-friendly algorithms for substring searching (2016)

News photo

21 GB/s CSV Parsing Using SIMD on AMD 9950X