QuickstartΒΆ

So how does it work?

The AVX-CPP library works on the principle of SIMD. This term stands for Single Instruction Multiple Data. In simple terms it allows processing of multiple values utilizing only one [assembler] intruction. This way performance critical parts of software can see a reduced runtime saving precious time.

Modern Intel and AMD CPUs support many SIMD instructions including:

  1. SSE
  2. SSE2
  3. SSE3
  4. SSE4
  5. SSE5
  6. SSSE3
  7. AVX
  8. AVX2
  9. AVX512
Each of them provides different sets of registers and instructions which can be used to speed up computation. SSE instructions operate on 128-bit registers, which can hold up to 4 32-bit values, AVX and AVX2 provide 256-bit registers, while AVX512 pushes it even further with 512-bit registers. This library utilizes mostly AVX and AVX2 instructions while AVX512 is enabled explicitly by using BUILD_USE_AVX512 flag in CMake.

some cool ass aniamtion...

Each class provides a set of regular math operators: + - * / %. Those operators are intended to behave in a same way as their non-SIMD counterparts. Each class has two static attributes which can be referenced when accessing them:

  • constexpr int size - number of elements stored in vector (4/8/16/32)
  • using storedType - type of elements stored in vector.