Visible to Intel only — GUID: GUID-CC0D069E-5E8E-4E04-ACDE-7C661D518988
Visible to Intel only — GUID: GUID-CC0D069E-5E8E-4E04-ACDE-7C661D518988
aos1d_container
Template class for "Array of Structures" memory layout of a one-dimensional container of Primitives. #include <sdlt/aos1d_container.h>
Syntax
template<
typename PrimitiveT,
AccessBy AccessByT,
class AllocatorT = allocator::default_alloc
>
class aos1d_container;
Arguments
typename PrimitiveT |
The type that each element in the array will store |
access_by AccessByT |
Enum to control how the memory layout will be accessed. Recommend access_by_struct unless you are having issues vectorizing. See the documentation of access_by for more details |
class AllocatorT = allocator::default_alloc |
[Optional] Specify the type of allocator to be used. allocator::default_alloc is currently the only allocator supported. |
Description
Provide compatible interface with soa1d_container while keeping the memory layout as an Array of Structures internally. User can easily switch between data layouts by changing the type of container they use. The rest of the code written against accessors and proxy elements and members can stay the same.
- Dynamic resizing with interface similar to std::vector
- Accessor objects suitable for efficient data access inside SIMD loops
Member |
Description |
---|---|
|
Type to use when specifying sizes to methods of the container. |
|
Template alias to an accessor for this container |
|
Template alias to a const_accessor for this container |
Member Type |
Description |
---|---|
|
Constructs an uninitialized container of size_d1 elements, using optionally specified allocator instance, using optionally specified number of cache lines to offset the start of the buffer in memory to allow management of 4k cache aliasing. |
|
Constructs a container of size_d1 elements initializing each with a_value, using optionally specified allocator instance, using optionally specified number of cache lines to offset the start of the buffer in memory to allow management of 4k cache aliasing. |
|
Constructs a container with a copy of each of the elements in other, in the same order, using optionally specified allocator instance, using optionally specified number of cache lines to offset the start of the buffer in memory to allow management of 4k cache aliasing. |
|
Constructs a container with a copy of number_of_elements elements from the array other_array, in the same order, using optionally specified allocator instance, using optionally specified number of cache lines to offset the start of the buffer in memory to allow management of 4k cache aliasing. |
|
Constructs a container with as many elements as the range [a_begin-an_end), each with a copy of the value from its corresponding element in that range, in the same order, using optionally specified allocator instance, using optionally specified number of cache lines to offset the start of the buffer in memory to allow management of 4k cache aliasing. |
|
Returns: a new aos1d_container instance with its own copy of the elements |
|
Resize the container so that it contains new_size_d1 elements. If the new size is greater than the current container size, the new elements are unitialized |
|
Returns: accessor with no embedded index offset. |
|
Returns:accessor with an integer based embedded index offset. |
|
Returns: accessor with an aligned_offset<IndexAlignmentT> based embedded index offset. |
|
Returns: accessor with a fixed_offset<OffsetT> based embedded index offset. |
|
Returns: const_accessor with no embedded index offset. |
|
Returns: const_accessor with an integer based embedded index offset. |
|
Returns:const_accessor with an aligned_offset<IndexAlignmentT> based embedded index offset. |
|
Returns:const_accessor with a fixed_offset<OffsetT> based embedded index offset. |
STL Compatibility
In addition to the performance oriented interface explained in the table above, aos1d_container implements a subset of the std::vector interface that is intended for ease of integration, not high performance. Due to the import/export only requirement we can’t return a reference to the object, instead iterators and operator[] return a Proxy object while other "const' methods return a "value_type const". Furthermore, iterators do not support the -> operator. Despite that limitation the iterators can be passed to any STL algorithm. Also for performance reasons, resize does not initialize new elements. The following std::vector interface methods are implemented:
size, max_size, capacity, empty, reserve, shrink_to_fit
assign, push_back, pop_back, clear, insert, emplace, erase
cbegin, cend, begin, end, crbegin, crend, rbegin, rend, rbegin, rend
operator[], front() const, back() const, at() const
swap, ==, !=
swap, aos1d_container(aos1d_container&& donor), aos1d_container & operator=(aos1d_container&& donor)
- access_by
Enum to control how the memory layout will be accessed. #include <sdlt/access_by.h>