|
Uni20
Asynchronous tensor and runtime library.
|
Additional concepts, adaptors, and helpers that extend the reference mdspan implementation. More...
Files | |
| file | conjugate_accessor.hpp |
| Mdspan accessor adaptor for lazy complex conjugation. | |
| file | diagonal_accessor.hpp |
| Accessor support for compressed generalized diagonal tensors. | |
| file | format.hpp |
| Formatting support for mdspan extents. | |
| file | generated_accessor.hpp |
| Read-only mdspan accessor for values generated from logical indices. | |
| file | generated_layout.hpp |
| Synthetic mdspan layout for values generated from logical indices. | |
| file | iteration_plan.hpp |
| Helpers for constructing merged iteration plans over strided tensors. | |
| file | mdspan.hpp |
| Configured gateway to Uni20's mdspan implementation. | |
| file | mdspec.hpp |
| Mdspan-shaped metadata for storage whose data handle requires acquisition. | |
| file | strides.hpp |
| Stride utilities for mdspan-like tensors. | |
| file | transform_view.hpp |
| Lazy read-only elementwise transform views over mdspan-like inputs. | |
| file | zip_layout.hpp |
| Additional layout helpers and policies for zipped mdspan views. | |
Concepts | |
| concept | uni20::StridedMdspanLike |
| An mdspan-like type whose mapping is always strided and exposes stride observers. | |
| concept | uni20::StridedMdspecLike |
| An mdspec-like type whose mapping exposes multidimensional strides. | |
| concept | uni20::RankedMdspanLike |
| An mdspan-like type with a specified static rank. | |
| concept | uni20::RankedMdspecLike |
| An mdspec-like type with a specified static rank. | |
| concept | uni20::MutableRankedMdspanLike |
| A mutable mdspan-like type with a specified static rank. | |
| concept | uni20::DefaultAccessorMdspanLike |
An mdspan-like type whose accessor is stdex::default_accessor. | |
| concept | uni20::RankedStridedMdspanLike |
| A strided mdspan-like type with a specified static rank. | |
| concept | uni20::RankedStridedMdspecLike |
| A strided mdspec-like type with a specified static rank. | |
| concept | uni20::MutableRankedStridedMdspanLike |
| A mutable strided mdspan-like type with a specified static rank. | |
| concept | uni20::AccessorPolicy |
| A model of the C++ mdspan AccessorPolicy named requirement. | |
| concept | uni20::MdspanLike |
| A readable type implementing the mdspan observers and multidimensional subscript contract. | |
| concept | uni20::MdspecLike |
| Mdspan metadata whose data handle is immediate or available through a data descriptor. | |
| concept | uni20::MutableMdspanLike |
| MdspanLike types whose accessor supports indexed assignment. | |
| concept | uni20::MutableMdspecLike |
| MdspecLike types whose eventual storage supports writes. | |
| concept | uni20::MutableStridedMdspanLike |
| Mutable mdspan-like types whose layout reports they are always strided. | |
| concept | uni20::MutableStridedMdspecLike |
| Mutable mdspec-like type whose mapping is always strided. | |
| concept | uni20::DiagonalMdspecLike |
| Full logical mdspec with a rank-one view of its generalized diagonal components. | |
| concept | uni20::MutableDiagonalMdspecLike |
| Writable generalized-diagonal mdspec with writable rank-one components. | |
| concept | uni20::MutableRankedMdspecLike |
| Mutable mdspec-like type with a specified static rank. | |
| concept | uni20::MutableRankedStridedMdspecLike |
| Mutable strided mdspec-like type with a specified static rank. | |
Classes | |
| class | uni20::const_accessor_adaptor< Accessor > |
| Adaptor that exposes a mutable lvalue accessor as read-only. More... | |
| struct | uni20::extent_strides< N > |
| Structure to represent a common extent and an array of strides. More... | |
| struct | uni20::GeneralZipLayout< Layouts > |
| Fallback zip layout for arbitrary mapping policies. More... | |
| struct | uni20::is_default_accessor< Accessor > |
| Trait that recognizes the standard mdspan default accessor. More... | |
| struct | uni20::is_default_accessor< stdex::default_accessor< ElementType > > |
Specialization for stdex::default_accessor<T>. More... | |
| struct | uni20::span_offset_type< AP, typename > |
| Trait to pull an AccessorPolicy’s offset_type if present, or fall back to std::size_t otherwise. More... | |
| struct | uni20::span_offset_type< AP, std::void_t< typename AP::offset_type > > |
| Partial specialization that uses an accessor policy’s declared offset_type. More... | |
| struct | uni20::StridedZipLayout< NumSpans > |
Zip layout for NumSpans strided spans (all using layout_stride). More... | |
| struct | uni20::StridedZipLayout< NumSpans >::mapping< Ext > |
Nested mapping policy for extents Ext, modeling LayoutMappingPolicy. More... | |
| struct | uni20::zip_layout_selector< Spans > |
| Picks the right zip layout for a pack of mdspan types. More... | |
| struct | uni20::zip_layout_selector< Spans... > |
| Specialization that selects StridedZipLayout when all spans are strided. More... | |
Typedefs | |
| template<AccessorPolicy Acc> | |
| using | uni20::const_accessor_t = decltype(const_accessor(std::declval< Acc >())) |
| Type alias that produces the const-qualified version of an accessor policy. | |
| template<typename AP > | |
| using | uni20::span_offset_t = typename span_offset_type< AP >::type |
| Convenience alias for accessor_offset_type<AP>::type. | |
| using | uni20::span_offset_type< AP, typename >::type = std::size_t |
| The resulting offset type (std::size_t by default). | |
| using | uni20::span_offset_type< AP, std::void_t< typename AP::offset_type > >::type = typename AP::offset_type |
| The resulting offset type defined by the accessor policy. | |
| template<typename... Spans> | |
| using | uni20::zip_layout_t = typename zip_layout_selector< Spans... >::type |
| Alias to extract the chosen layout policy for the given spans. | |
Functions | |
| UNI20_HOST_DEVICE std::array< std::array< index_type, Ext::rank()>, num_spans > const & | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::all_strides () const noexcept |
| Retrieve the 2-D array of all per-span strides. | |
| constexpr bool | uni20::extent_strides< N >::can_merge_with_inner (extent_strides inner) const noexcept |
| Returns true if the current (outer) dimension and the given inner dimension can be merged. | |
| template<MdspanLike Span, class... Index> requires detail::MdspanIndexPack<Span, Index...> | |
| constexpr decltype(auto) | uni20::const_access (Span const &span, Index... indices) |
| Access one mdspan element through a read-only adaptation of its stored accessor. | |
| template<AccessorPolicy Acc> requires (!std::is_const_v<typename Acc::element_type> && std::is_same_v<typename Acc::reference, typename Acc::element_type&>) | |
| constexpr auto | uni20::const_accessor (Acc const &acc) |
| Wrap any accessor whose reference is T& into a const adaptor. | |
| template<typename T > | |
| constexpr stdex::default_accessor< T const > | uni20::const_accessor (stdex::default_accessor< T > const &accessor_policy) |
| Wrap a default_accessor<T> into a const_default_accessor<T>. | |
| template<typename Ext , typename Str > requires std::is_integral_v<Ext> && std::is_integral_v<Str> | |
| constexpr | uni20::extent_strides< N >::extent_strides (Ext e, std::array< Str, N > s) |
| Construct from an extent and an array of strides. | |
| template<typename Ext > requires std::is_integral_v<Ext> | |
| constexpr | uni20::extent_strides< N >::extent_strides (Ext e, std::initializer_list< std::ptrdiff_t > s) |
| Construct from an extent and initializer-list strides. | |
| template<typename Ext , typename... Strides> requires (std::is_integral_v<Ext> && sizeof...(Strides) == N) | |
| constexpr | uni20::extent_strides< N >::extent_strides (Ext e, Strides... s) |
| Construct from an extent and a parameter pack of stride values. | |
| UNI20_HOST_DEVICE constexpr extents_type const & | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::extents () const noexcept |
| Return the extents of the layout. | |
| UNI20_HOST_DEVICE constexpr extents_type const & | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::extents () const noexcept |
| Access the common extents. | |
| template<StridedMdspanLike AType, StridedMdspanLike BType, StridedMdspanLike CType, std::size_t N> | |
| auto | uni20::extract_strides (AType const &A, BType const &B, std::array< std::pair< std::size_t, std::size_t >, N > const &contractDims, CType const &C) |
| Extract merged stride groups for a tensor contraction. | |
| static UNI20_HOST_DEVICE constexpr bool | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::is_always_exhaustive () noexcept |
| Never exhaustive: no single contiguous backing buffer. | |
| static UNI20_HOST_DEVICE constexpr bool | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::is_always_exhaustive () noexcept |
| Never exhaustive: no single contiguous backing buffer. | |
| static UNI20_HOST_DEVICE constexpr bool | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::is_always_strided () noexcept |
| Statically unknown if strided: may differ per dimension. | |
| static UNI20_HOST_DEVICE constexpr bool | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::is_always_strided () noexcept |
| Not strided. | |
| static UNI20_HOST_DEVICE constexpr bool | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::is_always_unique () noexcept |
| Always unique for uni20 tensors. | |
| static UNI20_HOST_DEVICE constexpr bool | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::is_always_unique () noexcept |
| Always unique for uni20 tensors. | |
| UNI20_HOST_DEVICE constexpr bool | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::is_exhaustive () const noexcept |
| Never exhaustive at runtime. | |
| UNI20_HOST_DEVICE constexpr bool | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::is_strided () const noexcept |
| True if every dimension uses the same stride across all spans. | |
| UNI20_HOST_DEVICE constexpr bool | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::is_unique () const noexcept |
| Always unique at runtime. | |
| UNI20_HOST_DEVICE constexpr | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::mapping (Extents const &ext, typename Layouts::template mapping< Extents > const &... m) noexcept |
| Construct child mappings. | |
| template<typename... Mappings> | |
| UNI20_HOST_DEVICE constexpr | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::mapping (extents_type const &exts, Mappings... maps) noexcept |
| Construct from extents and existing child mappings. | |
| UNI20_HOST_DEVICE constexpr | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::mapping (extents_type const &exts, std::array< std::array< index_type, Ext::rank()>, NumSpans > const &strides_pack) noexcept |
| Construct from shared extents and per-span raw strides. | |
| template<typename LeftMap , typename RightMap > requires (LeftMap::num_spans + RightMap::num_spans == num_spans) | |
| UNI20_HOST_DEVICE constexpr | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::mapping (LeftMap const &left, RightMap const &right) noexcept |
| Merge two sub-mappings whose span counts sum to NumSpans. | |
| template<typename OtherExt > | |
| UNI20_HOST_DEVICE constexpr | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::mapping (std::array< index_type, Ext::rank()> const &new_strides, typename StridedZipLayout< num_spans - 1 >::template mapping< OtherExt > const &other) noexcept |
| Prepend one span’s strides before an existing mapping of N–1 spans. | |
| template<typename OtherExt > | |
| UNI20_HOST_DEVICE constexpr | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::mapping (typename StridedZipLayout< num_spans - 1 >::template mapping< OtherExt > const &other, std::array< index_type, Ext::rank()> const &new_strides) noexcept |
| Append one span’s strides after an existing mapping of N–1 spans. | |
| template<typename Extents , std::size_t R> requires (Extents::rank() == R) | |
| static_vector< extent_strides< 2 >, R > | uni20::merge_strides_left (Extents const &ext, std::array< std::ptrdiff_t, R > const &Stride1, std::array< std::ptrdiff_t, R > const &Stride2) |
| Build and merge stride metadata from two stride arrays favouring column-major (left) order. | |
| template<std::size_t N, std::size_t R> | |
| void | uni20::merge_strides_left (static_vector< extent_strides< N >, R > &out) |
| Merge adjacent stride descriptors in place using column-major (left) ordering. | |
| template<typename Extents , std::size_t R> requires (Extents::rank() == R) | |
| static_vector< extent_strides< 2 >, R > | uni20::merge_strides_right (Extents const &ext, std::array< std::ptrdiff_t, R > const &Stride1, std::array< std::ptrdiff_t, R > const &Stride2) |
| Build and merge stride metadata from two stride arrays favouring row-major (right) order. | |
| template<std::size_t N, std::size_t R> | |
| void | uni20::merge_strides_right (static_vector< extent_strides< N >, R > &out) |
| Merge adjacent stride descriptors in place using row-major (right) ordering. | |
| constexpr void | uni20::extent_strides< N >::merge_with_inner (extent_strides inner) noexcept |
| Merge an inner dimension into this one when merging is valid. | |
| UNI20_HOST_DEVICE constexpr bool | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::operator!= (mapping const &o) const noexcept |
| Compare two mappings for inequality. | |
| template<typename... Idx> | |
| UNI20_HOST_DEVICE constexpr offset_type | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::operator() (Idx... idxs) const noexcept |
| Compute per-span linear offsets for a multi-index. | |
| template<typename... Idx> | |
| UNI20_HOST_DEVICE constexpr offset_type | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::operator() (Idx... idxs) const noexcept |
| Compute the per-layout offsets for a given multi-index. | |
| UNI20_HOST_DEVICE constexpr bool | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::operator== (mapping const &o) const noexcept |
| Compare two mappings for equality. | |
| UNI20_HOST_DEVICE constexpr std::size_t | uni20::GeneralZipLayout< Layouts >::mapping< Extents >::required_span_size () const noexcept |
| Return the maximum required span size among the child mappings. | |
| UNI20_HOST_DEVICE constexpr index_type | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::stride (rank_type r) const noexcept |
Return the common stride in dimension r. | |
| UNI20_HOST_DEVICE constexpr std::array< index_type, Ext::rank()> | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::strides () const noexcept |
| Return the common strides for each dimension. | |
| template<StridedMdspecLike S> | |
| auto | uni20::strides (S const &s) |
| Retrieve the strides associated with a strided mdspec-like type. | |
Variables | |
| template<class Accessor > | |
| constexpr bool | uni20::is_default_accessor_v = is_default_accessor<std::remove_cvref_t<Accessor>>::value |
True when an accessor is stdex::default_accessor<T>. | |
| static constexpr std::size_t | uni20::StridedZipLayout< NumSpans >::mapping< Ext >::num_spans = NumSpans |
| Number of spans in this zip layout. | |
Additional concepts, adaptors, and helpers that extend the reference mdspan implementation.
| using uni20::const_accessor_t = typedef decltype(const_accessor(std::declval<Acc>())) |
Type alias that produces the const-qualified version of an accessor policy.
| Acc | An accessor policy. |
| using uni20::span_offset_t = typedef typename span_offset_type<AP>::type |
Convenience alias for accessor_offset_type<AP>::type.
| AP | The accessor policy to inspect. |
| using uni20::span_offset_type< AP, typename >::type = std::size_t |
The resulting offset type (std::size_t by default).
| using uni20::span_offset_type< AP, std::void_t< typename AP::offset_type > >::type = typename AP::offset_type |
The resulting offset type defined by the accessor policy.
| using uni20::zip_layout_t = typedef typename zip_layout_selector<Spans...>::type |
Alias to extract the chosen layout policy for the given spans.
| Spans | Mdspan types. |
|
inlinenoexcept |
Retrieve the 2-D array of all per-span strides.
|
inlineconstexprnoexcept |
Returns true if the current (outer) dimension and the given inner dimension can be merged.
An extent-one dimension is always mergeable because its stride is not observed by any logical index.
| inner | The inner dimension metadata to test. |
|
constexpr |
Access one mdspan element through a read-only adaptation of its stored accessor.
This preserves the mapping and accessor state without constructing a second mdspan descriptor. Index eligibility and conversion match the multidimensional mdspan subscript operation.
| Span | The mdspan-like descriptor type. |
| Index | One index type per mdspan rank. |
| span | Descriptor whose mapping, handle, and accessor are used. |
| indices | Coordinates for every mdspan axis. |
|
constexpr |
Wrap any accessor whose reference is T& into a const adaptor.
| Acc | A mutable accessor policy with reference equal to element_type&. |
| acc | The accessor to wrap. |
|
constexpr |
Wrap a default_accessor<T> into a const_default_accessor<T>.
| T | Element type accessed by the policy. |
| accessor_policy | The accessor policy to upgrade. |
T const.
|
inlineconstexpr |
Construct from an extent and an array of strides.
| Ext | Integral type for the extent. |
| Str | Integral type for the stride values. |
| e | The extent value. |
| s | The strides associated with the dimension. |
|
inlineconstexpr |
Construct from an extent and initializer-list strides.
| Ext | Integral type for the extent. |
| e | The extent value. |
| s | The strides associated with the dimension. |
|
inlineconstexpr |
Construct from an extent and a parameter pack of stride values.
| Ext | Integral type for the extent. |
| Strides | Integral stride arguments matching N. |
| e | The extent value. |
| s | The stride values. |
|
inlineconstexprnoexcept |
Return the extents of the layout.
|
inlineconstexprnoexcept |
Access the common extents.
| auto uni20::extract_strides | ( | AType const & | A, |
| BType const & | B, | ||
| std::array< std::pair< std::size_t, std::size_t >, N > const & | contractDims, | ||
| CType const & | C | ||
| ) |
Extract merged stride groups for a tensor contraction.
| AType | Strided mdspan describing the A operand. |
| BType | Strided mdspan describing the B operand. |
| CType | Strided mdspan describing the C operand. |
| N | Number of contraction dimensions. |
| A | The left operand tensor. |
| B | The right operand tensor. |
| contractDims | Pairs of contraction indices mapping A to B dimensions. |
| C | The output tensor. |
|
inlinestaticconstexprnoexcept |
Never exhaustive: no single contiguous backing buffer.
|
inlinestaticconstexprnoexcept |
Never exhaustive: no single contiguous backing buffer.
|
inlinestaticconstexprnoexcept |
Statically unknown if strided: may differ per dimension.
|
inlinestaticconstexprnoexcept |
Not strided.
|
inlinestaticconstexprnoexcept |
Always unique for uni20 tensors.
|
inlinestaticconstexprnoexcept |
Always unique for uni20 tensors.
|
inlineconstexprnoexcept |
Never exhaustive at runtime.
|
inlineconstexprnoexcept |
True if every dimension uses the same stride across all spans.
|
inlineconstexprnoexcept |
Always unique at runtime.
|
inlineexplicitconstexprnoexcept |
Construct child mappings.
| ext | Common extents shared by every mapping. |
| m | Child mappings stored within the layout. |
|
inlineconstexprnoexcept |
Construct from extents and existing child mappings.
| exts | Shared extents of all spans. |
| maps | Existing mappings whose strides are copied into this layout. |
|
inlineconstexprnoexcept |
Construct from shared extents and per-span raw strides.
| exts | Common extents of the view. |
| strides_pack | strides_pack[s][d] is the stride of span s in dimension d. |
|
inlineconstexprnoexcept |
Merge two sub-mappings whose span counts sum to NumSpans.
| LeftMap | Mapping of the first n spans. |
| RightMap | Mapping of the remaining spans. |
|
inlineconstexprnoexcept |
Prepend one span’s strides before an existing mapping of N–1 spans.
| OtherExt | Extents type of the smaller mapping. |
|
inlineconstexprnoexcept |
Append one span’s strides after an existing mapping of N–1 spans.
| OtherExt | Extents type of the smaller mapping. |
|
inline |
Build and merge stride metadata from two stride arrays favouring column-major (left) order.
| Extents | Extents type supplying extents via operator[]. |
| R | Tensor rank captured by the stride arrays. |
| ext | The extents of the tensor. |
| Stride1 | The strides for the first operand. |
| Stride2 | The strides for the second operand. |
| void uni20::merge_strides_left | ( | static_vector< extent_strides< N >, R > & | out | ) |
Merge adjacent stride descriptors in place using column-major (left) ordering.
| N | Number of stride values per descriptor. |
| R | Capacity of the static vector. |
| out | The sequence of stride descriptors to compact. |
|
inline |
Build and merge stride metadata from two stride arrays favouring row-major (right) order.
| Extents | Extents type supplying extents via operator[]. |
| R | Tensor rank captured by the stride arrays. |
| ext | The extents of the tensor. |
| Stride1 | The strides for the first operand. |
| Stride2 | The strides for the second operand. |
| void uni20::merge_strides_right | ( | static_vector< extent_strides< N >, R > & | out | ) |
Merge adjacent stride descriptors in place using row-major (right) ordering.
| N | Number of stride values per descriptor. |
| R | Capacity of the static vector. |
| out | The sequence of stride descriptors to compact. |
|
inlineconstexprnoexcept |
Merge an inner dimension into this one when merging is valid.
The merged descriptor retains the non-singleton dimension's strides. Two singleton dimensions use canonical unit strides.
| inner | The inner dimension metadata to merge. |
|
inlineconstexprnoexcept |
Compare two mappings for inequality.
| o | Mapping to compare against. |
|
inlineconstexprnoexcept |
Compute per-span linear offsets for a multi-index.
| Idx | Types of each index argument. |
| idxs | Indices for each dimension. |
|
inlineconstexprnoexcept |
Compute the per-layout offsets for a given multi-index.
| Idx | Types of each index argument. |
| idxs | Indices for each dimension. |
|
inlineconstexprnoexcept |
Compare two mappings for equality.
| o | Mapping to compare against. |
|
inlineconstexprnoexcept |
Return the maximum required span size among the child mappings.
|
inlineconstexprnoexcept |
Return the common stride in dimension r.
r. | r | Dimension index, 0 ≤ r < rank(). |
r.
|
inlineconstexprnoexcept |
Return the common strides for each dimension.
| auto uni20::strides | ( | S const & | s | ) |
Retrieve the strides associated with a strided mdspec-like type.
| S | The strided mdspec-like type. |
| s | The multidimensional descriptor whose strides will be returned. |
|
inlineconstexpr |
True when an accessor is stdex::default_accessor<T>.
| Accessor | Candidate accessor policy. |
|
staticconstexpr |
Number of spans in this zip layout.