template<typename V>
class ROOT::Vc::Memory< V, 0u, 0u >
A helper class that is very similar to Memory<V, Size> but with dynamically allocated memory and thus dynamic size.
Example:
size_t size = 11;
for (size_t i = 0; i < array.entriesCount(); ++i) {
array[i] = i;
}
for (size_t i = 0; i < array.vectorsCount(); ++i) {
}
This code allocates a small array with 11 scalar entries and implements two equivalent loops that initialize the memory. The scalar loop writes each individual int. The vectorized loop writes int_v::Size values to memory per iteration. Since the size of 11 is not a multiple of int_v::Size (unless you use the scalar Vc implementation) the last write access of the vector loop would normally be out of bounds. But the Memory class automatically pads the memory such that the whole array can be accessed with correctly aligned memory addresses. (Note: the scalar loop can be auto-vectorized, except for the last three assignments.)
- Note
- The internal data pointer is not declared with the
restrict
keyword. Therefore modifying memory of V::EntryType will require the compiler to assume aliasing. If you want to use the restrict
keyword you need to use a standard pointer to memory and do the vector address calculation and loads and stores manually.
- Parameters
-
V | The vector type you want to operate on. (e.g. float_v or uint_v) |
- See also
- Memory<V, Size>
Definition at line 420 of file memory.h.
|
Vc_ALWAYS_INLINE | Memory (size_t size) |
| Allocate enough memory to access size values of type V::EntryType . More...
|
|
template<typename Parent , typename RM > |
Vc_ALWAYS_INLINE | Memory (const MemoryBase< V, Parent, 1, RM > &rhs) |
| Copy the memory into a new memory area. More...
|
|
Vc_ALWAYS_INLINE | Memory (const Memory &rhs) |
| Overload of the above function. More...
|
|
Vc_ALWAYS_INLINE | ~Memory () |
| Frees the memory which was allocated in the constructor. More...
|
|
void | swap (Memory &rhs) |
| Swap the contents and size information of two Memory objects. More...
|
|
Vc_ALWAYS_INLINE Vc_PURE size_t | entriesCount () const |
|
Vc_ALWAYS_INLINE Vc_PURE size_t | vectorsCount () const |
|
template<typename Parent , typename RM > |
Vc_ALWAYS_INLINE Memory & | operator= (const MemoryBase< V, Parent, 1, RM > &rhs) |
| Overwrite all entries with the values stored in rhs . More...
|
|
Vc_ALWAYS_INLINE Memory & | operator= (const Memory &rhs) |
|
Vc_ALWAYS_INLINE Memory & | operator= (const EntryType *rhs) |
| Overwrite all entries with the values stored in the memory at rhs . More...
|
|
Vc_ALWAYS_INLINE Vc_PURE size_t | entriesCount () const |
|
Vc_ALWAYS_INLINE Vc_PURE size_t | vectorsCount () const |
|
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlag > | vector (size_t i) |
|
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlag > | vector (size_t i) const |
| Const overload of the above function. More...
|
|
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, UnalignedFlag > | vector (size_t i, int shift) |
|
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, UnalignedFlag > | vector (size_t i, int shift) const |
| Const overload of the above function. More...
|
|
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, A > | vectorAt (size_t i, A) |
|
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, A > | vectorAt (size_t i, A) const |
|
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlag > | vectorAt (size_t i) |
|
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlag > | vectorAt (size_t i) const |
|
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlag > | firstVector () |
|
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlag > | firstVector () const |
| Const overload of the above function. More...
|
|
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlag > | lastVector () |
|
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlag > | lastVector () const |
| Const overload of the above function. More...
|
|
Vc_ALWAYS_INLINE Vc_PURE V | gather (const unsigned char *indexes) const |
|
Vc_ALWAYS_INLINE Vc_PURE V | gather (const unsigned short *indexes) const |
|
Vc_ALWAYS_INLINE Vc_PURE V | gather (const unsigned int *indexes) const |
|
Vc_ALWAYS_INLINE Vc_PURE V | gather (const unsigned long *indexes) const |
|
Vc_ALWAYS_INLINE void | setZero () |
|
Memory< V, 0u, 0u > & | operator+= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
|
Memory< V, 0u, 0u > & | operator+= (EntryType rhs) |
|
Memory< V, 0u, 0u > & | operator-= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
|
Memory< V, 0u, 0u > & | operator-= (EntryType rhs) |
|
Memory< V, 0u, 0u > & | operator*= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
|
Memory< V, 0u, 0u > & | operator*= (EntryType rhs) |
|
Memory< V, 0u, 0u > & | operator/= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
|
Memory< V, 0u, 0u > & | operator/= (EntryType rhs) |
|
bool | operator== (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
|
bool | operator!= (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
|
bool | operator< (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
|
bool | operator<= (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
|
bool | operator> (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
|
bool | operator>= (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
|