EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Functions
EBGeometry::SIMD Namespace Reference

SIMD register wrappers and the scalar operations that mirror them. More...

Classes

struct  Pack
 N lanes of T in one SIMD register. Defined only for the (T, N) pairs the compiler's flags provide (see NativeWidth()), and never in a device pass. More...
 
struct  Scalar
 The scalar type of a scalar or pack type: T for T, and T for Pack<T, N>. More...
 
struct  Scalar< Pack< T, N > >
 The scalar type of Pack<T, N>. More...
 

Functions

template<class T >
T select (const bool a_mask, const T a_ifTrue, const T a_ifFalse) noexcept
 Pick a_ifTrue where a_mask holds, else a_ifFalse (scalar form).
 
bool both (const bool a_lhs, const bool a_rhs) noexcept
 Whether both conditions hold (scalar form).
 
float sqrt (const float a_x) noexcept
 Square root (scalar form).
 
double sqrt (const double a_x) noexcept
 Square root (scalar form).
 
float abs (const float a_x) noexcept
 Absolute value (scalar form).
 
double abs (const double a_x) noexcept
 Absolute value (scalar form).
 
template<class T >
constexpr size_t WidestPack () noexcept
 The widest SIMD register, in lanes of T, that this compilation pass has: 16 floats or 8 doubles under AVX-512F, 8 or 4 under AVX, 4 or 2 under SSE4.1, and 1 otherwise and in every device pass.
 
template<class T , size_t W>
constexpr size_t NativeWidth () noexcept
 The lane count to evaluate a group of W values of T with: the widest register this compilation pass has whose lane count divides W, or 1 (the scalar path) if none does.
 

Detailed Description

SIMD register wrappers and the scalar operations that mirror them.

Function Documentation

◆ abs() [1/2]

double EBGeometry::SIMD::abs ( const double  a_x)
inlinenoexcept

Absolute value (scalar form).

Parameters
[in]a_xArgument.
Returns
The absolute value.

◆ abs() [2/2]

float EBGeometry::SIMD::abs ( const float  a_x)
inlinenoexcept

Absolute value (scalar form).

Parameters
[in]a_xArgument.
Returns
The absolute value.

◆ both()

bool EBGeometry::SIMD::both ( const bool  a_lhs,
const bool  a_rhs 
)
inlinenoexcept

Whether both conditions hold (scalar form).

Parameters
[in]a_lhsOne condition.
[in]a_rhsThe other.
Returns
a_lhs && a_rhs.

◆ NativeWidth()

template<class T , size_t W>
constexpr size_t EBGeometry::SIMD::NativeWidth ( )
constexprnoexcept

The lane count to evaluate a group of W values of T with: the widest register this compilation pass has whose lane count divides W, or 1 (the scalar path) if none does.

Template Parameters
TFloating-point type.
WGroup width.
Returns
A lane count N for which Pack<T, N> exists, or 1.

◆ select()

template<class T >
T EBGeometry::SIMD::select ( const bool  a_mask,
const T  a_ifTrue,
const T  a_ifFalse 
)
inlinenoexcept

Pick a_ifTrue where a_mask holds, else a_ifFalse (scalar form).

Template Parameters
TFloating-point type.
Parameters
[in]a_maskCondition.
[in]a_ifTrueValue where the condition holds.
[in]a_ifFalseValue where it does not.
Returns
The chosen value.

◆ sqrt() [1/2]

double EBGeometry::SIMD::sqrt ( const double  a_x)
inlinenoexcept

Square root (scalar form).

Parameters
[in]a_xArgument.
Returns
The square root.

◆ sqrt() [2/2]

float EBGeometry::SIMD::sqrt ( const float  a_x)
inlinenoexcept

Square root (scalar form).

Parameters
[in]a_xArgument.
Returns
The square root.

◆ WidestPack()

template<class T >
constexpr size_t EBGeometry::SIMD::WidestPack ( )
constexprnoexcept

The widest SIMD register, in lanes of T, that this compilation pass has: 16 floats or 8 doubles under AVX-512F, 8 or 4 under AVX, 4 or 2 under SSE4.1, and 1 otherwise and in every device pass.

Template Parameters
TFloating-point type.
Returns
The lane count.