#include <datatype.h>
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.
Public Types | |
using | StrideType = typename std::conditional< GENERIC, Char, T >::type |
Public Member Functions | |
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 |
T * | GetPtr (Int index) const |
Static Public Attributes | |
static const Bool | SIMD |
static const Bool | GENERIC |
Private Attributes | |
T * | _ptr |
Int | _size |
Int | _stride |
SimdInfo::Compact | _simd |
Int | _logComponentSize |
using StrideType = typename std::conditional<GENERIC, Char, T>::type |
T& operator[] | ( | Int | index | ) | const |
const StridedBlock<T>& ToBlock | ( | ) | const |
StridedBlock<T>& ToBlock | ( | ) |
T* GetFirst | ( | ) | const |
Int GetCount | ( | void | ) | 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 |
T* GetPtr | ( | Int | index | ) | const |
|
static |
|
static |
|
private |
Pointer to first element.
|
private |
Number of elements.
|
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.
|
private |
|
private |