Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
uni20::cuda::CudaBufferView< ElementType > Class Template Reference

Non-owning opaque view into one logical CUDA buffer. More...

#include <cuda_storage.hpp>

Public Types

using buffer_reference = std::conditional_t< std::is_const_v< element_type >, buffer_type const &, buffer_type & >
 
using buffer_type = CudaBuffer< value_type >
 
using element_type = ElementType
 
using value_type = std::remove_const_t< element_type >
 

Public Member Functions

auto buffer () const -> buffer_reference
 Return the CUDA buffer whose completion ledger governs access.
 
constexpr CudaBufferView () noexcept=default
 
constexpr CudaBufferView (buffer_reference buffer) noexcept
 Construct a view at the beginning of a CUDA buffer.
 
template<class OtherElement >
requires (std::is_const_v<element_type> && !std::is_const_v<OtherElement> && std::same_as<std::remove_const_t<OtherElement>, value_type>)
constexpr CudaBufferView (CudaBufferView< OtherElement > other) noexcept
 Convert a mutable view into a read-only view.
 
constexpr std::size_t element_offset () const noexcept
 Return this view's element offset from the logical buffer start.
 
constexpr CudaBufferView offset_by (std::size_t offset) const noexcept
 Return a view advanced by an element offset.
 
constexpr operator bool () const noexcept
 Return whether this view identifies a CUDA buffer.
 

Friends

template<class >
class CudaBufferView
 
constexpr bool operator== (CudaBufferView const &, CudaBufferView const &)=default
 

Detailed Description

template<class ElementType>
class uni20::cuda::CudaBufferView< ElementType >

Non-owning opaque view into one logical CUDA buffer.

The view carries completion-domain identity and an element offset, but deliberately exposes no raw device pointer or host-side value conversion. CUDA lowering must first acquire synchronized access to buffer() on an operation stream.

Member Typedef Documentation

◆ buffer_reference

template<class ElementType >
using uni20::cuda::CudaBufferView< ElementType >::buffer_reference = std::conditional_t<std::is_const_v<element_type>, buffer_type const&, buffer_type&>

◆ buffer_type

template<class ElementType >
using uni20::cuda::CudaBufferView< ElementType >::buffer_type = CudaBuffer<value_type>

◆ element_type

template<class ElementType >
using uni20::cuda::CudaBufferView< ElementType >::element_type = ElementType

◆ value_type

template<class ElementType >
using uni20::cuda::CudaBufferView< ElementType >::value_type = std::remove_const_t<element_type>

Constructor & Destructor Documentation

◆ CudaBufferView() [1/3]

template<class ElementType >
constexpr uni20::cuda::CudaBufferView< ElementType >::CudaBufferView ( )
constexprdefaultnoexcept

◆ CudaBufferView() [2/3]

template<class ElementType >
constexpr uni20::cuda::CudaBufferView< ElementType >::CudaBufferView ( buffer_reference  buffer)
inlineexplicitconstexprnoexcept

Construct a view at the beginning of a CUDA buffer.

◆ CudaBufferView() [3/3]

template<class ElementType >
template<class OtherElement >
requires (std::is_const_v<element_type> && !std::is_const_v<OtherElement> && std::same_as<std::remove_const_t<OtherElement>, value_type>)
constexpr uni20::cuda::CudaBufferView< ElementType >::CudaBufferView ( CudaBufferView< OtherElement >  other)
inlineconstexprnoexcept

Convert a mutable view into a read-only view.

Member Function Documentation

◆ buffer()

template<class ElementType >
auto uni20::cuda::CudaBufferView< ElementType >::buffer ( ) const -> buffer_reference
inline

Return the CUDA buffer whose completion ledger governs access.

◆ element_offset()

template<class ElementType >
constexpr std::size_t uni20::cuda::CudaBufferView< ElementType >::element_offset ( ) const
inlineconstexprnoexcept

Return this view's element offset from the logical buffer start.

◆ offset_by()

template<class ElementType >
constexpr CudaBufferView uni20::cuda::CudaBufferView< ElementType >::offset_by ( std::size_t  offset) const
inlineconstexprnoexcept

Return a view advanced by an element offset.

Precondition
The resulting element offset is representable by std::size_t.

◆ operator bool()

template<class ElementType >
constexpr uni20::cuda::CudaBufferView< ElementType >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Return whether this view identifies a CUDA buffer.

Friends And Related Symbol Documentation

◆ CudaBufferView

template<class ElementType >
template<class >
friend class CudaBufferView
friend

◆ operator==

template<class ElementType >
constexpr bool operator== ( CudaBufferView< ElementType > const &  ,
CudaBufferView< ElementType > const &   
)
friend

The documentation for this class was generated from the following file: