vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Classes | Functions | Variables
HWY_NAMESPACE Namespace Reference

Classes

struct  hwy_simd_type
 
struct  mchunk_t
 mask type for hwy_simd_type. This is a type which holds a set of masks stored in uint8_t, as the highway mask storing function provides. So this type is memory-backed, just like hwy_simd_type. Template arguments are the corresponding hwy_simd_type's tag type and it's lane count. highway is strict about which vectors and masks can interoperate, and only allows 'direct' interoperation if the types involved 'match' in size. Masks pertaining to vectors of differently-sized T aren't directly interoperable because they don't have the same lane count. One requires k masks of one type and k * 2 ^ i of the other. Here, we follow a different paradigm: The top-level objects we're dealing with have a fixed 'vsize', the number of lanes they hold. This should be a power of two. The paradigm is that objects with equal vsize should be interoperable, no matter what lane count the hardware vectors have which are used to implement their functionality. This makes user code simpler: users pick a vsize which they use for a body of code, all vector-like objects use the common vsize, and the implementation of the vector-like objects takes care of 'rolling out' the operations to hardware vectors. At times this produces what I call 'friction' - if the underlying hardware vectors and masks are not directly compatible, code is needed to interoperate them, and this code can at times be slow. So the recommendation for users is to avoid 'friction' by avoiding mixing differently-sized types, but with the given paradigm, this is a matter of performance tuning rather than imposing constraints on code structure. Some of the 'friction' might be mitigated by additional code using highway's up- and down-scaling routines, but for now the code rather uses 'goading' with small loops over the backing memory, relying on the compiler to handle this efficiently. More...
 

Functions

template<typename D , std::size_t N>
bool any_of (const mchunk_t< D, N > &arg)
 
template<typename D , std::size_t N>
bool all_of (const mchunk_t< D, N > &arg)
 
template<typename D , std::size_t N>
bool none_of (const mchunk_t< D, N > &arg)
 
template<typename src_t , typename trg_t , std::size_t vsize>
void convert (const hwy_simd_type< src_t, vsize > &src, hwy_simd_type< trg_t, vsize > &trg)
 
template<typename T , std::size_t vsize>
void convert (const hwy_simd_type< double, vsize > &src, hwy_simd_type< T, vsize > &trg)
 
template<typename T , std::size_t vsize>
void convert (const hwy_simd_type< T, vsize > &src, hwy_simd_type< double, vsize > &trg)
 
template<typename T , std::size_t vsize>
void convert (const vspline::simd_type< T, vsize > &src, hwy_simd_type< T, vsize > &trg)
 
template<typename T , std::size_t vsize>
void convert (const hwy_simd_type< T, vsize > &src, vspline::simd_type< T, vsize > &trg)
 
template<typename src_t , typename trg_t , std::size_t vsize>
void convert (const vspline::simd_type< src_t, vsize > &src, hwy_simd_type< trg_t, vsize > &trg)
 
template<typename src_t , typename trg_t , std::size_t vsize>
void convert (const hwy_simd_type< src_t, vsize > &src, vspline::simd_type< trg_t, vsize > &trg)
 

Variables

template<typename _value_type , std::size_t _vsize>
struct HWY_ALIGN hwy_simd_type
 class template hwy_simd_type provides a fixed-size container type for small-ish sets of fundamentals which are stored in a POD C vector. This implementation uses highway to code the loops more efficiently. It mimicks Vc::SimdArray, just like vspline::simd_type does, and The code is derived from vspline::simd_array, changing the workhorse code from simple loops to the use of highway functions. The resulting type, with it's 'container-typical' interface, slots in well with the higher-level constructs used in vspline/lux and, at the same time, 'contains' the SIMD implementation in this class, so that it's use doesn't need to be known outside. As an arithmetic type, hwy_simd_type provides many mathematical operators and some functions - most of them are realized by calling corresponding highway functions, but some (still) rely on loops, either because they aren't performance-critical or because there is no highway code to be had for the purpose. Some methods are (currently) exclusive to this class, but may be ported to other SIMD interface classes; apart from the original 'goading' class vspline::simd_type, there is also an implementation using std::simd in pv/vspline/std_simd_type.h The lane count for a hwy_simd_type in this body of code should be a power of two, and it should be at least as large as the hardware lane count of the smallest fundamental used in vectorized form. To cover all eventualities, the hardware lane count of a vector of unsigned char (uint8_t) is a good choice. This choice is to avoid that hwy_simd_type objects of small T remain partly empty when a given small vsize is chosen to cater for vectors with larger T. At times, this will lead to overly high register pressure, and the overall performance may benefit from allowing partially filled hwy_simd_type via a smaller vsize, which is feasible because hwy_simd_type uses highway vectors with CappedTag. More...
 

Function Documentation

◆ all_of()

template<typename D , std::size_t N>
bool HWY_NAMESPACE::all_of ( const mchunk_t< D, N > &  arg)

Definition at line 539 of file hwy_simd_type.h.

◆ any_of()

template<typename D , std::size_t N>
bool HWY_NAMESPACE::any_of ( const mchunk_t< D, N > &  arg)

Definition at line 533 of file hwy_simd_type.h.

◆ convert() [1/7]

template<typename T , std::size_t vsize>
void HWY_NAMESPACE::convert ( const hwy_simd_type< double, vsize > &  src,
hwy_simd_type< T, vsize > &  trg 
)

Definition at line 740 of file hwy_simd_type.h.

◆ convert() [2/7]

template<typename src_t , typename trg_t , std::size_t vsize>
void HWY_NAMESPACE::convert ( const hwy_simd_type< src_t, vsize > &  src,
hwy_simd_type< trg_t, vsize > &  trg 
)

Definition at line 601 of file hwy_simd_type.h.

◆ convert() [3/7]

template<typename src_t , typename trg_t , std::size_t vsize>
void HWY_NAMESPACE::convert ( const hwy_simd_type< src_t, vsize > &  src,
vspline::simd_type< trg_t, vsize > &  trg 
)

Definition at line 789 of file hwy_simd_type.h.

◆ convert() [4/7]

template<typename T , std::size_t vsize>
void HWY_NAMESPACE::convert ( const hwy_simd_type< T, vsize > &  src,
hwy_simd_type< double, vsize > &  trg 
)

Definition at line 750 of file hwy_simd_type.h.

◆ convert() [5/7]

template<typename T , std::size_t vsize>
void HWY_NAMESPACE::convert ( const hwy_simd_type< T, vsize > &  src,
vspline::simd_type< T, vsize > &  trg 
)

Definition at line 769 of file hwy_simd_type.h.

◆ convert() [6/7]

template<typename src_t , typename trg_t , std::size_t vsize>
void HWY_NAMESPACE::convert ( const vspline::simd_type< src_t, vsize > &  src,
hwy_simd_type< trg_t, vsize > &  trg 
)

Definition at line 780 of file hwy_simd_type.h.

◆ convert() [7/7]

template<typename T , std::size_t vsize>
void HWY_NAMESPACE::convert ( const vspline::simd_type< T, vsize > &  src,
hwy_simd_type< T, vsize > &  trg 
)

Definition at line 762 of file hwy_simd_type.h.

◆ none_of()

template<typename D , std::size_t N>
bool HWY_NAMESPACE::none_of ( const mchunk_t< D, N > &  arg)

Definition at line 545 of file hwy_simd_type.h.

Variable Documentation

◆ hwy_simd_type

template<typename _value_type , std::size_t _vsize>
struct HWY_ALIGN HWY_NAMESPACE::hwy_simd_type

class template hwy_simd_type provides a fixed-size container type for small-ish sets of fundamentals which are stored in a POD C vector. This implementation uses highway to code the loops more efficiently. It mimicks Vc::SimdArray, just like vspline::simd_type does, and The code is derived from vspline::simd_array, changing the workhorse code from simple loops to the use of highway functions. The resulting type, with it's 'container-typical' interface, slots in well with the higher-level constructs used in vspline/lux and, at the same time, 'contains' the SIMD implementation in this class, so that it's use doesn't need to be known outside. As an arithmetic type, hwy_simd_type provides many mathematical operators and some functions - most of them are realized by calling corresponding highway functions, but some (still) rely on loops, either because they aren't performance-critical or because there is no highway code to be had for the purpose. Some methods are (currently) exclusive to this class, but may be ported to other SIMD interface classes; apart from the original 'goading' class vspline::simd_type, there is also an implementation using std::simd in pv/vspline/std_simd_type.h The lane count for a hwy_simd_type in this body of code should be a power of two, and it should be at least as large as the hardware lane count of the smallest fundamental used in vectorized form. To cover all eventualities, the hardware lane count of a vector of unsigned char (uint8_t) is a good choice. This choice is to avoid that hwy_simd_type objects of small T remain partly empty when a given small vsize is chosen to cater for vectors with larger T. At times, this will lead to overly high register pressure, and the overall performance may benefit from allowing partially filled hwy_simd_type via a smaller vsize, which is feasible because hwy_simd_type uses highway vectors with CappedTag.

Definition at line 584 of file hwy_simd_type.h.