dune-common 2.12-git
Loading...
Searching...
No Matches
SIMD Abstraction Implementation for std::experimental::simd
Collaboration diagram for SIMD Abstraction Implementation for std::experimental::simd:

Files

file  stdsimd.hh
 SIMD abstractions for std::experimental::simd
 

Detailed Description

This implements the vectorization interface for the types of the C++ Parallelism TS v2, namely std::experimental::simd<T, Abi> and std::experimental::simd_mask<T, Abi>, e.g. native_simd<double> or fixed_size_simd<double, 4>.

The types are specified in section 9 "Data-Parallel Types" of the Technical Specification "C++ Extensions for Parallelism Version 2" (ISO/IEC TS 19570:2018). A freely available reference is https://en.cppreference.com/w/cpp/experimental/simd. The types have been adopted into C++26 as std::simd.

As an application developer, you need to #include <dune/common/simd/stdsimd.hh>. It is only available if the standard library provides std::experimental::simd, which is indicated by the preprocessor macro DUNE_HAVE_CXX_EXPERIMENTAL_SIMD:

No library or special compiler flags are needed. The number of lanes of native_simd<T> depends on the target architecture, so compile with e.g. -march=native to make use of the vector instructions of your CPU.

Rebinding a vector type to another scalar type yields std::experimental::rebind_simd_t, which may change the ABI tag, e.g. from native_simd<float> to a fixed_size_simd<double, N>. A rebind round trip therefore does not necessarily yield the original type.

Restrictions

The types follow the rules of the Parallelism TS, in particular: