Interface concept for objects describing multidimensional memory access.
More...
#include <IMdSpan.hpp>
template<typename T, typename T_Mut, typename T_Const>
concept IMdSpan =
requires(T t, T_Mut mut_t, T_Const const_t,
alpaka::Vec<
typename T::index_type, T::dim()> vec) {
typename T::reference;
typename T::const_reference;
typename T::pointer;
typename T::const_pointer;
{ *mut_t } -> std::same_as<typename T::reference>;
{ *const_t } -> std::same_as<typename T::const_reference>;
{ mut_t.data() } -> std::same_as<typename T::pointer>;
{ const_t.data() } -> std::same_as<typename T::const_pointer>;
{ mut_t[vec] } -> std::same_as<typename T::reference>;
{ const_t[vec] } -> std::same_as<typename T::const_reference>;
requires(T::dim() != 1u) || (T::dim() == 1u && requires {
{ mut_t[typename T::index_type{0}] } -> std::same_as<typename T::reference>;
});
requires(T::dim() != 1u) || (T::dim() == 1u && requires {
{ const_t[typename T::index_type{0}] } -> std::same_as<typename T::const_reference>;
});
Interface concept for objects describing a multidimensional data source.
Interface concept for objects describing multidimensional memory access.
- Todo
- add getSlice, getConstSlice and getView, getConstView functions
Interface concept for objects describing multidimensional memory access.
An object of type alpaka::mdspan does not store any information about the storage location, e.g., whether the memory is located on a CPU or a GPU. The interface corresponds to that of a standard library container with continuous memory, but has some differences to support multidimensional memory. For example, instead of the member function size(), which returns the 1D size, alpaka::mdspan like objects provides the function getExtents(), which returns the size of each dimension.
- Parameters
-
| t | Object of type alpaka::mdspan. May or may not have a const modifier. |
| mut_t | Mutable object of type alpaka::mdspan. Does not have a const modifier. |
| const_t | Constant object of type alpaka::mdspan. Does have a const modifier. |
| vec | Vector with the same number of elements as the dimension of the alpaka::mdspan like object. Used to call the access operator. |
Components
An alpaka::mdspan like object contains 4 components:
- A pointer to the actual memory.
- An extents object that describes the number of dimensions and their respective sizes.
- A pitch object that specifies how many bytes are required to jump to the next element in each dimension.
- An alignment object that describes how the elements are aligned in memory, see: alpaka::concepts::Alignment
Member types
- T::reference: The element reference type is either const or non-const, depending on T::value_type.
- T::const_reference: The constant reference type for an element. Always const.
- T::pointer: The element pointer type is either const or non-const, depending on T::value_type.
- T::const_pointer: The constant pointer type for an element. Always pointer-to-const.
Definition at line 53 of file IMdSpan.hpp.