Tech News
← Back to articles

The messy reality of SIMD (vector) functions

read original related products more articles

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 one piece of data. Take for example a mathematical sin function:

double sin(double angle);

This function takes one double and returns one double. The vector version that processes four values in a single function would look like this:

double[4] sin(double angle[4]);

Or, we were to use native AVX SIMD types, it could look like this:

__m256d sin(__m256 d);

The basic idea behind vector functions is to improve performance by processing multiple data elements per function call, either through manually vectorized functions or compiler-generated vector functions.

Why do we even need vector functions?

The term vector function can refer to two related concepts:

... continue reading