You can use the alignment functions and macros provided by Intel(R) Array Building Blocks (Intel(R) ArBB) to allocate C++ data aligned to boundaries that may improve the performance of computations on such data.
Any memory allocated by Intel(R) ArBB itself, such as memory used to store the intermediate results of a computation, is automatically aligned to boundaries suitable for fast computation. When you pass your own C++ data to Intel(R) ArBB using the arbb::bind() functions, you can allocate the data using the facilities described in this section. This will allow Intel(R) ArBB to perform well when it directly operates on such data.
Defines | |
#define | ARBB_CPP_ALIGN(decl) "platform-specific" |
Declare a local variable using the declaration passed in as decl with an alignment appropriate to be bound to an ArBB container using arbb::bind(). | |
#define | ARBB_CPP_ALIGN_ALLOCA(bytes) "platform-specific" |
Allocate the provided number of bytes on the stack using the system-specific stack allocation facility (e.g. | |
Functions | |
void * | arbb::aligned_malloc (std::size_t length) |
Allocate data on the heap, ensuring that it is aligned sufficiently to be bound to an ArBB container using arbb::bind(). | |
void | arbb::aligned_free (void *data) |
Free data previously allocated with arbb::aligned_malloc(). |
#define ARBB_CPP_ALIGN | ( | decl | ) | "platform-specific" |
Declare a local variable using the declaration passed in as decl with an alignment appropriate to be bound to an ArBB container using arbb::bind().
For example:
ARBB_CPP_ALIGN(float data[1024]); dense<f32> container; arbb::bind(container, data, 1024);
decl | The object to be declared. E.g. float a[16] . |
Definition at line 43 of file alignment.hpp.
#define ARBB_CPP_ALIGN_ALLOCA | ( | bytes | ) | "platform-specific" |
Allocate the provided number of bytes on the stack using the system-specific stack allocation facility (e.g.
alloca()), but ensure that it is aligned sufficiently to be bound to an ArBB container using arbbb::bind(). The data will be freed when the current function returns.
bytes | The number of bytes to be allocated. |
Definition at line 54 of file alignment.hpp.
void* arbb::aligned_malloc | ( | std::size_t | length | ) |
Allocate data on the heap, ensuring that it is aligned sufficiently to be bound to an ArBB container using arbb::bind().
Such data should be freed using arbb::aligned_free().
length | The number of bytes to allocate. |
void arbb::aligned_free | ( | void * | data | ) |
Free data previously allocated with arbb::aligned_malloc().
Copyright © 2010, Intel Corporation. All rights reserved.