Memory.h File Reference

Go to the source code of this file.

Classes

struct  Eigen::internal::smart_copy_helper< T, true >
 
struct  Eigen::internal::smart_copy_helper< T, false >
 
struct  Eigen::internal::smart_memmove_helper< T, true >
 
struct  Eigen::internal::smart_memmove_helper< T, false >
 
class  Eigen::internal::aligned_stack_memory_handler< T >
 
class  Eigen::internal::scoped_array< T >
 
class  Eigen::aligned_allocator< T >
 STL compatible allocator to use with types requiring a non-standard alignment. More...
 
struct  Eigen::aligned_allocator< T >::rebind< U >
 

Namespaces

 Eigen
 Namespace containing all symbols from the Eigen library.
 
 Eigen::internal
 Namespace containing low-level routines from the Eigen library.
 

Macros

#define EIGEN_GLIBC_MALLOC_ALREADY_ALIGNED   0
 
#define EIGEN_FREEBSD_MALLOC_ALREADY_ALIGNED   0
 
#define EIGEN_MALLOC_ALREADY_ALIGNED   0
 
#define EIGEN_MALLOC_CHECK_THREAD_LOCAL
 
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
 
#define ei_declare_local_nested_eval(XPR_T, XPR, N, NAME)    typename Eigen::internal::nested_eval<XPR_T, N>::type NAME(XPR)
 
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
 
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW   EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(true)
 
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
 

Functions

EIGEN_DEVICE_FUNC void Eigen::internal::check_that_malloc_is_allowed ()
 
EIGEN_DEVICE_FUNC void Eigen::internal::throw_std_bad_alloc ()
 
EIGEN_DEVICE_FUNC void * Eigen::internal::handmade_aligned_malloc (std::size_t size, std::size_t alignment=EIGEN_DEFAULT_ALIGN_BYTES)
 
EIGEN_DEVICE_FUNC void Eigen::internal::handmade_aligned_free (void *ptr)
 
EIGEN_DEVICE_FUNC void * Eigen::internal::handmade_aligned_realloc (void *ptr, std::size_t new_size, std::size_t old_size, std::size_t alignment=EIGEN_DEFAULT_ALIGN_BYTES)
 Reallocates aligned memory. Since we know that our handmade version is based on std::malloc we can use std::realloc to implement efficient reallocation. More...
 
EIGEN_DEVICE_FUNC void * Eigen::internal::aligned_malloc (std::size_t size)
 
EIGEN_DEVICE_FUNC void Eigen::internal::aligned_free (void *ptr)
 
EIGEN_DEVICE_FUNC void * Eigen::internal::aligned_realloc (void *ptr, std::size_t new_size, std::size_t old_size)
 Reallocates an aligned block of memory. More...
 
template<bool Align>
EIGEN_DEVICE_FUNC void * Eigen::internal::conditional_aligned_malloc (std::size_t size)
 
template<>
EIGEN_DEVICE_FUNC void * Eigen::internal::conditional_aligned_malloc< false > (std::size_t size)
 
template<bool Align>
EIGEN_DEVICE_FUNC void Eigen::internal::conditional_aligned_free (void *ptr)
 
template<>
EIGEN_DEVICE_FUNC void Eigen::internal::conditional_aligned_free< false > (void *ptr)
 
template<bool Align>
EIGEN_DEVICE_FUNC void * Eigen::internal::conditional_aligned_realloc (void *ptr, std::size_t new_size, std::size_t old_size)
 
template<>
EIGEN_DEVICE_FUNC void * Eigen::internal::conditional_aligned_realloc< false > (void *ptr, std::size_t new_size, std::size_t old_size)
 
template<typename T >
EIGEN_DEVICE_FUNC void Eigen::internal::destruct_elements_of_array (T *ptr, std::size_t size)
 
template<typename T >
EIGEN_DEVICE_FUNC TEigen::internal::default_construct_elements_of_array (T *ptr, std::size_t size)
 
template<typename T >
EIGEN_DEVICE_FUNC TEigen::internal::copy_construct_elements_of_array (T *ptr, const T *src, std::size_t size)
 
template<typename T >
EIGEN_DEVICE_FUNC TEigen::internal::move_construct_elements_of_array (T *ptr, T *src, std::size_t size)
 
template<typename T >
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void Eigen::internal::check_size_for_overflow (std::size_t size)
 
template<typename T >
EIGEN_DEVICE_FUNC TEigen::internal::aligned_new (std::size_t size)
 
template<typename T , bool Align>
EIGEN_DEVICE_FUNC TEigen::internal::conditional_aligned_new (std::size_t size)
 
template<typename T >
EIGEN_DEVICE_FUNC void Eigen::internal::aligned_delete (T *ptr, std::size_t size)
 
template<typename T , bool Align>
EIGEN_DEVICE_FUNC void Eigen::internal::conditional_aligned_delete (T *ptr, std::size_t size)
 
template<typename T , bool Align>
EIGEN_DEVICE_FUNC TEigen::internal::conditional_aligned_realloc_new (T *pts, std::size_t new_size, std::size_t old_size)
 
template<typename T , bool Align>
EIGEN_DEVICE_FUNC TEigen::internal::conditional_aligned_new_auto (std::size_t size)
 
template<typename T , bool Align>
EIGEN_DEVICE_FUNC TEigen::internal::conditional_aligned_realloc_new_auto (T *pts, std::size_t new_size, std::size_t old_size)
 
template<typename T , bool Align>
EIGEN_DEVICE_FUNC void Eigen::internal::conditional_aligned_delete_auto (T *ptr, std::size_t size)
 
template<int Alignment, typename Scalar , typename Index >
EIGEN_DEVICE_FUNC Index Eigen::internal::first_aligned (const Scalar *array, Index size)
 
template<typename Scalar , typename Index >
EIGEN_DEVICE_FUNC Index Eigen::internal::first_default_aligned (const Scalar *array, Index size)
 
template<typename Index >
Index Eigen::internal::first_multiple (Index size, Index base)
 
template<typename T >
EIGEN_DEVICE_FUNC void Eigen::internal::smart_copy (const T *start, const T *end, T *target)
 
template<typename T >
void Eigen::internal::smart_memmove (const T *start, const T *end, T *target)
 
template<typename T >
EIGEN_DEVICE_FUNC TEigen::internal::smart_move (T *start, T *end, T *target)
 
template<typename T >
void Eigen::internal::swap (scoped_array< T > &a, scoped_array< T > &b)
 
void Eigen::internal::queryCacheSizes (int &l1, int &l2, int &l3)
 
int Eigen::internal::queryL1CacheSize ()
 
int Eigen::internal::queryTopLevelCacheSize ()
 
template<class T , class... Args>
EIGEN_DEVICE_FUNC TEigen::internal::construct_at (T *p, Args &&... args)
 
template<class T >
EIGEN_DEVICE_FUNC void Eigen::internal::destroy_at (T *p)
 

Macro Definition Documentation

◆ ei_declare_aligned_stack_constructed_variable

#define ei_declare_aligned_stack_constructed_variable (   TYPE,
  NAME,
  SIZE,
  BUFFER 
)
Value:
Eigen::internal::check_size_for_overflow<TYPE>(SIZE); \
TYPE* NAME = (BUFFER) != 0 ? BUFFER : reinterpret_cast<TYPE*>(Eigen::internal::aligned_malloc(sizeof(TYPE) * SIZE)); \
Eigen::internal::aligned_stack_memory_handler<TYPE> EIGEN_CAT(NAME, _stack_memory_destructor)( \
(BUFFER) == 0 ? NAME : 0, SIZE, true)
#define SIZE
Definition: BenchSparseUtil.h:11
#define EIGEN_CAT(a, b)
Definition: Macros.h:819
#define TYPE
Definition: benchFFT.cpp:39
EIGEN_DEVICE_FUNC void * aligned_malloc(std::size_t size)
Definition: Memory.h:199

The macro ei_declare_aligned_stack_constructed_variable(TYPE,NAME,SIZE,BUFFER) declares, allocates, and construct an aligned buffer named NAME of SIZE elements of type TYPE on the stack if the size in bytes is smaller than EIGEN_STACK_ALLOCATION_LIMIT, and if stack allocation is supported by the platform (currently, this is Linux, OSX and Visual Studio only). Otherwise the memory is allocated on the heap. The allocated buffer is automatically deleted when exiting the scope of this declaration. If BUFFER is non null, then the declared variable is simply an alias for BUFFER, and no allocation/deletion occurs. Here is an example:

{
// use data[0] to data[size-1]
}
int data[]
Definition: Map_placement_new.cpp:1
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition: Memory.h:806
Scalar Scalar int size
Definition: benchVecAdd.cpp:17

The underlying stack allocation function can controlled with the EIGEN_ALLOCA preprocessor token.

The macro ei_declare_local_nested_eval(XPR_T,XPR,N,NAME) is analogue to

type
Definition: compute_granudrum_aor.py:141

with the advantage of using aligned stack allocation even if the maximal size of XPR at compile time is unknown. This is accomplished through alloca if this later is supported and if the required number of bytes is below EIGEN_STACK_ALLOCATION_LIMIT.

◆ ei_declare_local_nested_eval

#define ei_declare_local_nested_eval (   XPR_T,
  XPR,
  N,
  NAME 
)     typename Eigen::internal::nested_eval<XPR_T, N>::type NAME(XPR)

◆ EIGEN_FREEBSD_MALLOC_ALREADY_ALIGNED

#define EIGEN_FREEBSD_MALLOC_ALREADY_ALIGNED   0

◆ EIGEN_GLIBC_MALLOC_ALREADY_ALIGNED

#define EIGEN_GLIBC_MALLOC_ALREADY_ALIGNED   0

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW   EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(true)

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF

#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF (   NeedsToAlign)

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE

#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE (   Scalar,
  Size 
)
Value:
bool(((Size) != Eigen::Dynamic) && \
(((EIGEN_MAX_ALIGN_BYTES >= 16) && ((sizeof(Scalar) * (Size)) % (EIGEN_MAX_ALIGN_BYTES) == 0)) || \
((EIGEN_MAX_ALIGN_BYTES >= 32) && ((sizeof(Scalar) * (Size)) % (EIGEN_MAX_ALIGN_BYTES / 2) == 0)) || \
((EIGEN_MAX_ALIGN_BYTES >= 64) && ((sizeof(Scalar) * (Size)) % (EIGEN_MAX_ALIGN_BYTES / 4) == 0)))))
#define EIGEN_MAX_ALIGN_BYTES
Definition: ConfigureVectorization.h:163
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
Definition: Memory.h:876
SCALAR Scalar
Definition: bench_gemm.cpp:45
const int Dynamic
Definition: Constants.h:25

◆ EIGEN_MALLOC_ALREADY_ALIGNED

#define EIGEN_MALLOC_ALREADY_ALIGNED   0

◆ EIGEN_MALLOC_CHECK_THREAD_LOCAL

#define EIGEN_MALLOC_CHECK_THREAD_LOCAL