SimdBlock< T > Class Template Reference Data Types

#include <datatype.h>

详细描述

template<typename T>
class maxon::SimdBlock< T >

A SimdBlock represents a block of memory which is organized as an array of struct of arrays (AOSOA). For example a normal Block<Vector> is layouted internally as xyzxyzxyzxyz (an array of structures, AOS). If you want to make use of SIMD, it is important to build groups of the x-, y- and z-components. Often this is done by making a structure of arrays (SOA), which for the example means having a structure of an x-array holding all x-components, a y-array and a z-array. But you can combine both to an array of struct of arrays (AOSOA): Only as many components are grouped to a fixed-size array as fit into one SIMD value, and then these small arrays are combined to a struct. This yields (in the case of four components per SIMD value) a memory layout xxxxyyyyzzzzxxxxyyyyzzzz which provides better cache locality than a simple structure of arrays.

公共成员函数

T &  operator[] ( Int index) const
const StridedBlock < T > &  ToBlock () const
StridedBlock < T > &  ToBlock ()
T *  GetFirst () const
Int   GetCount () const
Int   GetStride () const
Int   GetComponentStride () const
Int   GetMultiplicityMask () const
Int   GetAlignmentMask () const
Int   GetExtraStride () const
void  ResetSimdIndexing ()
void  SetSimdIndexing (const SimdInfo::Compact &simd, Int logComponentSize)
const SimdInfo::Compact GetInfo () const

静态公共属性

static const Bool   SIMD

Private Attributes

T *  _ptr
Int   _size
Int   _stride
SimdInfo::Compact   _simd
Int   _logComponentSize

成员函数文档编制

◆  operator[]()

T& operator[] ( Int   index ) const

◆  ToBlock() [1/2]

const StridedBlock <T>& ToBlock ( ) const

◆  ToBlock() [2/2]

StridedBlock <T>& ToBlock ( )

◆  GetFirst()

T* GetFirst ( ) const

◆  GetCount()

Int GetCount ( ) const

◆  GetStride()

Int GetStride ( ) const

◆  GetComponentStride()

Int GetComponentStride ( ) const

◆  GetMultiplicityMask()

Int GetMultiplicityMask ( ) const

◆  GetAlignmentMask()

Int GetAlignmentMask ( ) const

◆  GetExtraStride()

Int GetExtraStride ( ) const

◆  ResetSimdIndexing()

void ResetSimdIndexing ( )

◆  SetSimdIndexing()

void SetSimdIndexing ( const SimdInfo::Compact simd ,
Int   logComponentSize  
)

◆  GetInfo()

const SimdInfo::Compact & GetInfo ( ) const

Member Data Documentation

◆  SIMD

const Bool SIMD static

◆  _ptr

T* _ptr private

Pointer to first element.

◆  _size

Int _size
private

Number of elements.

◆  _stride

Int _stride
private

Stride in bytes between elements. In the SIMD case, this is the size of a hypothetical non-SIMD vector (having dimension components). E.g., 24 for a double precision Vec3 .

◆  _simd

SimdInfo::Compact _simd
private

◆  _logComponentSize

Int _logComponentSize
private