vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
HWY_NAMESPACE::mchunk_t< D, _vsize > Struct Template Reference

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...

#include <hwy_simd_type.h>

Public Types

typedef hn::TFromD< D > T
 
typedef hn::Vec< D > vec_t
 
typedef T value_type
 
typedef hn::Mask< D > vmask_type
 

Public Member Functions

uint8_t * data ()
 
const uint8_t * data () const
 
vmask_type yield (const std::size_t &i) const
 
void take (const std::size_t &i, const vmask_type &rhs)
 
void SaveToBytes (uint8_t *p_trg) const
 
void LoadFromBytes (const uint8_t *p_trg)
 
template<typename D1 , typename D2 >
void transfer (const mchunk_t< D1, vsize > &in_mask, mchunk_t< D2, vsize > &out_mask)
 
 mchunk_t ()=default
 
 mchunk_t (const mchunk_t &)=default
 
mchunk_toperator= (const mchunk_t &)=default
 
 mchunk_t (bool v)
 
template<typename D2 >
mchunk_toperator= (const mchunk_t< D2, vsize > &rhs)
 
template<typename D2 >
 mchunk_t (const mchunk_t< D2, vsize > &rhs)
 
bool none_of () const
 
bool any_of () const
 
bool all_of () const
 

Static Public Member Functions

static constexpr std::size_t L ()
 

Static Public Attributes

static const std::size_t vsize = _vsize
 
static const std::size_t mask_bytes = vsize
 

Friends

std::ostream & operator<< (std::ostream &osr, mchunk_t it)
 

Detailed Description

template<typename D, std::size_t _vsize>
struct HWY_NAMESPACE::mchunk_t< D, _vsize >

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.

Definition at line 151 of file hwy_simd_type.h.

Member Typedef Documentation

◆ T

template<typename D , std::size_t _vsize>
typedef hn::TFromD< D > HWY_NAMESPACE::mchunk_t< D, _vsize >::T

Definition at line 153 of file hwy_simd_type.h.

◆ value_type

template<typename D , std::size_t _vsize>
typedef T HWY_NAMESPACE::mchunk_t< D, _vsize >::value_type

Definition at line 155 of file hwy_simd_type.h.

◆ vec_t

template<typename D , std::size_t _vsize>
typedef hn::Vec< D > HWY_NAMESPACE::mchunk_t< D, _vsize >::vec_t

Definition at line 154 of file hwy_simd_type.h.

◆ vmask_type

template<typename D , std::size_t _vsize>
typedef hn::Mask< D > HWY_NAMESPACE::mchunk_t< D, _vsize >::vmask_type

Definition at line 207 of file hwy_simd_type.h.

Constructor & Destructor Documentation

◆ mchunk_t() [1/4]

template<typename D , std::size_t _vsize>
HWY_NAMESPACE::mchunk_t< D, _vsize >::mchunk_t ( )
default

◆ mchunk_t() [2/4]

template<typename D , std::size_t _vsize>
HWY_NAMESPACE::mchunk_t< D, _vsize >::mchunk_t ( const mchunk_t< D, _vsize > &  )
default

◆ mchunk_t() [3/4]

template<typename D , std::size_t _vsize>
HWY_NAMESPACE::mchunk_t< D, _vsize >::mchunk_t ( bool  v)
inline

Definition at line 357 of file hwy_simd_type.h.

◆ mchunk_t() [4/4]

template<typename D , std::size_t _vsize>
template<typename D2 >
HWY_NAMESPACE::mchunk_t< D, _vsize >::mchunk_t ( const mchunk_t< D2, vsize > &  rhs)
inline

Definition at line 436 of file hwy_simd_type.h.

Member Function Documentation

◆ all_of()

template<typename D , std::size_t _vsize>
bool HWY_NAMESPACE::mchunk_t< D, _vsize >::all_of ( ) const
inline

Definition at line 497 of file hwy_simd_type.h.

◆ any_of()

template<typename D , std::size_t _vsize>
bool HWY_NAMESPACE::mchunk_t< D, _vsize >::any_of ( ) const
inline

Definition at line 492 of file hwy_simd_type.h.

◆ data() [1/2]

template<typename D , std::size_t _vsize>
uint8_t * HWY_NAMESPACE::mchunk_t< D, _vsize >::data ( )
inline

Definition at line 194 of file hwy_simd_type.h.

◆ data() [2/2]

template<typename D , std::size_t _vsize>
const uint8_t * HWY_NAMESPACE::mchunk_t< D, _vsize >::data ( ) const
inline

Definition at line 199 of file hwy_simd_type.h.

◆ L()

template<typename D , std::size_t _vsize>
static constexpr std::size_t HWY_NAMESPACE::mchunk_t< D, _vsize >::L ( )
inlinestaticconstexpr

Definition at line 186 of file hwy_simd_type.h.

◆ LoadFromBytes()

template<typename D , std::size_t _vsize>
void HWY_NAMESPACE::mchunk_t< D, _vsize >::LoadFromBytes ( const uint8_t *  p_trg)
inline

Definition at line 258 of file hwy_simd_type.h.

◆ none_of()

template<typename D , std::size_t _vsize>
bool HWY_NAMESPACE::mchunk_t< D, _vsize >::none_of ( ) const
inline

Definition at line 480 of file hwy_simd_type.h.

◆ operator=() [1/2]

template<typename D , std::size_t _vsize>
mchunk_t & HWY_NAMESPACE::mchunk_t< D, _vsize >::operator= ( const mchunk_t< D, _vsize > &  )
default

◆ operator=() [2/2]

template<typename D , std::size_t _vsize>
template<typename D2 >
mchunk_t & HWY_NAMESPACE::mchunk_t< D, _vsize >::operator= ( const mchunk_t< D2, vsize > &  rhs)
inline

Definition at line 422 of file hwy_simd_type.h.

◆ SaveToBytes()

template<typename D , std::size_t _vsize>
void HWY_NAMESPACE::mchunk_t< D, _vsize >::SaveToBytes ( uint8_t *  p_trg) const
inline

Definition at line 233 of file hwy_simd_type.h.

◆ take()

template<typename D , std::size_t _vsize>
void HWY_NAMESPACE::mchunk_t< D, _vsize >::take ( const std::size_t &  i,
const vmask_type rhs 
)
inline

Definition at line 223 of file hwy_simd_type.h.

◆ transfer()

template<typename D , std::size_t _vsize>
template<typename D1 , typename D2 >
void HWY_NAMESPACE::mchunk_t< D, _vsize >::transfer ( const mchunk_t< D1, vsize > &  in_mask,
mchunk_t< D2, vsize > &  out_mask 
)
inline

Definition at line 289 of file hwy_simd_type.h.

◆ yield()

template<typename D , std::size_t _vsize>
vmask_type HWY_NAMESPACE::mchunk_t< D, _vsize >::yield ( const std::size_t &  i) const
inline

Definition at line 218 of file hwy_simd_type.h.

Friends And Related Function Documentation

◆ operator<<

template<typename D , std::size_t _vsize>
std::ostream & operator<< ( std::ostream &  osr,
mchunk_t< D, _vsize >  it 
)
friend

Definition at line 511 of file hwy_simd_type.h.

Member Data Documentation

◆ mask_bytes

template<typename D , std::size_t _vsize>
const std::size_t HWY_NAMESPACE::mchunk_t< D, _vsize >::mask_bytes = vsize
static

Definition at line 169 of file hwy_simd_type.h.

◆ vsize

template<typename D , std::size_t _vsize>
const std::size_t HWY_NAMESPACE::mchunk_t< D, _vsize >::vsize = _vsize
static

Definition at line 157 of file hwy_simd_type.h.


The documentation for this struct was generated from the following file: