blitz Version 1.0.2
Loading...
Searching...
No Matches
blitz::simdTypes< T > Class Template Reference

Helper class that defines the width of the simd instructions for a given type. More...

#include <simdtypes.h>

Inheritance diagram for blitz::simdTypes< T >:
Inheritance graph
Collaboration diagram for blitz::simdTypes< T >:
Collaboration graph

Public Types

typedef TinyVector< T, vecWidthvecType
 TinyVector type of T that fills the simd width.
 

Static Public Member Functions

static bool isVectorAligned (const T *restrict pointer)
 Test if a pointer to T is simd aligned.
 
static diffType offsetToAlignment (const T *restrict pointer)
 Return number of elements from pointer to next simd width boundary.
 
static size_t paddedLength (size_t length)
 Return a length which has been padded to next larger even SIMD width.
 

Static Public Attributes

static const size_t byteWidth
 SIMD width of type in bytes (sizeof(T) if simd width does not fit a T)
 
static const size_t vecWidth
 SIMD width of types in number of elements.
 

Detailed Description

template<typename T>
class blitz::simdTypes< T >

Helper class that defines the width of the simd instructions for a given type.

It also defines a type that is a TinyVector of the appropriate length to fill the simd width. This is used as the "evaluation type" to facilitate automatic vectorization. Because TinyVectors are aligned on BZ_SIMD_WIDTH, an array of vecType will be dense in memory, which is required to reinterpret an array of T to an array of vecType.

Todo
How do we check that the type fits evenly into the simd width?

Member Typedef Documentation

◆ vecType

template<typename T>
typedef TinyVector<T, vecWidth> blitz::simdTypes< T >::vecType

TinyVector type of T that fills the simd width.

Member Function Documentation

◆ isVectorAligned()

template<typename T>
static bool blitz::simdTypes< T >::isVectorAligned ( const T *restrict pointer)
inlinestatic

◆ offsetToAlignment()

template<typename T>
static diffType blitz::simdTypes< T >::offsetToAlignment ( const T *restrict pointer)
inlinestatic

Return number of elements from pointer to next simd width boundary.

This is used to figure out how many scalar operations need to be done before beginning vectorized operations.

References byteWidth, and restrict.

◆ paddedLength()

template<typename T>
static size_t blitz::simdTypes< T >::paddedLength ( size_t length)
inlinestatic

Return a length which has been padded to next larger even SIMD width.

References vecWidth.

Member Data Documentation

◆ byteWidth

template<typename T>
const size_t blitz::simdTypes< T >::byteWidth
static
Initial value:
=
BZ_SIMD_WIDTH>sizeof(T) ? BZ_SIMD_WIDTH : sizeof(T)

SIMD width of type in bytes (sizeof(T) if simd width does not fit a T)

Referenced by offsetToAlignment().

◆ vecWidth


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