blitz  Version 1.0.2
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. More...
 

Static Public Member Functions

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

Static Public Attributes

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

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

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

TinyVector type of T that fills the simd width.

Member Function Documentation

template<typename T>
static bool blitz::simdTypes< T >::isVectorAligned ( const T *restrict  pointer)
inlinestatic
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.

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.

Member Data Documentation

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)

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

SIMD width of types in number of elements.


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