SIMD in C++20:

EVE of a New Era

Joel Falcou & Denis Yaroshevskiy

Slides: tinyurl.com/eve-simd-2021

Elevator pitch

What is EVE ?

1001 Flavors of SIMD

  • x86
    • 128 bits: SSE2, SSE3, SSSE3, SSE4.1, SSE4.2
    • 256 bits: AVX, AVX2, XOP
    • 512 bits: AVX512 and its myriad of sub-genre
  • ARM
    • 128 bits: NEON, ASIMD
  • PowerPC
    • 128 bits: Altivec on Power7-9
    • 256 bits: Blue Gene Q QPX

What exists out there?

  • Compiler's autovectorization
  • Pragmas/special compilers
  • std::execution::unseq, hpx
  • Specialized tools: Halide, simdjson
  • write by hand

EVE - Expressive Velocity Engine

  • C++ 20 wrapper around SIMD intrinsincs
    • Library of core types
    • Algorithms
    • 250+ numerical functions
  • Supports all x86 flavors and AARCH64
  • MIT license

Supported compilers/standards

  • C++20
  • Clang/GCC
  • latest until modules
  • msvc-clang/msvc latest soon~ish

EVE Type Wrappers

Why decorators?

EVE as a C++20 library

EVE internal implementation

eve::algo

Algorithms available

  • all_of/any_of/none_of
  • find/find_if/find_if_not
  • equal/mismatch
  • transform_inplace/transform_to
  • reduce
  • inclusive_scan_inplace/inclusive_scan_to
  • remove/remove_if (*)

Find a negative number

Find a negative number

Tuning algorithms

Mismatch interface

					
auto std::mismatch(I1 f1, I1 l1, I2 f2, P p) -> std::pair

auto mismatch(R1&& r1, R2&& r2, P p) -> zip_iterator
  requires zip_to_range<R1, R2>

auto mismatch(zipped_range_pair auto&& r, P p) -> zip_iterator
					
				

memcmp

inclusive_scan complex numbers

Collect indexes example

Collect indexes

Back to inclusive_scan complex numbers

OBJECTively better

Data-Oriented Design

Practicalities

What about bugs?

YES

API stability?

NO

Recommended workflow

  • focus on the critical components
  • build a standalone library
  • dynamic linking
  • contact us

Similar Libraries

Mentions

  • Jean-Thierry Laprest√©
  • Stack Overflow: @aqrit, @Peter Cordes, @Z boson, @Stephen Canon
  • Unity for soa_vector idea

Other talks

Contact information