Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Typedefs | Functions | Variables
concepts.hpp File Reference

Mdspan concept and accessor extensions for Uni20. More...

#include <uni20/core/compiler_attributes.hpp>
#include <uni20/mdspan/mdspan.hpp>
#include <concepts>
#include <type_traits>
#include <utility>
Include dependency graph for mdspan/concepts.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  uni20::const_accessor_adaptor< Accessor >
 Adaptor that exposes a mutable lvalue accessor as read-only. More...
 
struct  uni20::cuda_access_domain
 Execution domain in which CUDA device code may evaluate an accessor. More...
 
struct  uni20::host_access_domain
 Execution domain in which ordinary host code may evaluate an accessor. 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...
 

Namespaces

namespace  uni20
 

Concepts

concept  uni20::AccessorPolicy
 A model of the C++ mdspan AccessorPolicy named requirement.
 
concept  uni20::AccessorInDomain
 Accessor policy explicitly valid in one execution domain.
 
concept  uni20::HostAccessibleAccessor
 Accessor policy that may be evaluated directly by host code.
 
concept  uni20::CudaAccessibleAccessor
 Accessor policy that may be evaluated directly by CUDA device code.
 
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::HostAccessibleMdspan
 Mdspan whose accessor may be evaluated directly by host code.
 
concept  uni20::CudaAccessibleMdspan
 Mdspan whose accessor may be evaluated directly by CUDA device code.
 
concept  uni20::HostAccessibleMdspec
 Immediate or descriptor-backed mdspan metadata targeting host access.
 
concept  uni20::CudaAccessibleMdspec
 Immediate or descriptor-backed mdspan metadata targeting CUDA access.
 
concept  uni20::MutableMdspanLike
 MdspanLike types whose accessor supports indexed assignment.
 
concept  uni20::MutableMdspecLike
 MdspecLike types whose eventual storage supports writes.
 
concept  uni20::StridedMdspanLike
 An mdspan-like type whose mapping is always strided and exposes stride observers.
 
concept  uni20::MutableStridedMdspanLike
 Mutable mdspan-like types whose layout reports they are always strided.
 
concept  uni20::StridedMdspecLike
 An mdspec-like type whose mapping exposes multidimensional strides.
 
concept  uni20::MutableStridedMdspecLike
 Mutable mdspec-like type whose mapping is always strided.
 
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::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::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::MutableRankedStridedMdspecLike
 Mutable strided mdspec-like type with a specified static rank.
 
concept  uni20::MutableRankedStridedMdspanLike
 A mutable strided mdspan-like type with a specified static rank.
 

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.
 

Functions

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<AccessorPolicy Acc>
requires (std::is_const_v<typename Acc::element_type> && !is_default_accessor_v<Acc>)
constexpr Acc uni20::const_accessor (Acc const &acc)
 Return an accessor unchanged when its element type is already const.
 
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<MdspanLike Span>
constexpr auto uni20::make_const_mdspan (Span const &span)
 Build a read-only mdspan descriptor over the same storage and mapping.
 
template<StridedMdspecLike S>
auto uni20::strides (S const &s)
 Retrieve the strides associated with a strided mdspec-like type.
 

Variables

template<class Accessor , class Domain >
constexpr bool uni20::enable_accessor_in_domain = false
 Opt-in customization for the execution domains supported by an accessor.
 
template<class Accessor , class Domain >
constexpr bool uni20::enable_accessor_in_domain< const_accessor_adaptor< Accessor >, Domain >
 A const accessor adaptor preserves its wrapped accessor's execution domains.
 
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>.
 

Detailed Description

Mdspan concept and accessor extensions for Uni20.