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

One CUDA allocation partitioned into independent logical buffers. More...

#include <buffer.hpp>

Public Types

using buffer_type = CudaBuffer< T >
 
using element_type = T
 

Public Member Functions

CudaBuffer< T > & buffer (std::size_t ordinal)
 Return one mutable logical child buffer.
 
CudaBuffer< T > const & buffer (std::size_t ordinal) const
 Return one read-only logical child buffer.
 
std::size_t buffer_count () const noexcept
 Return the number of logical child buffers.
 
Device device () const
 Return the CUDA device containing the physical allocation.
 
PartitionedCudaBuffer & operator= (PartitionedCudaBuffer &&other) noexcept
 
PartitionedCudaBuffer & operator= (PartitionedCudaBuffer const &)=delete
 
 PartitionedCudaBuffer (DeviceResources &resources, std::size_t size, std::span< CudaBufferRange const > ranges)
 
 PartitionedCudaBuffer (PartitionedCudaBuffer &&other) noexcept
 
 PartitionedCudaBuffer (PartitionedCudaBuffer const &)=delete
 
auto read_synchronized_with (Stream const &stream) const -> PartitionedReadAccess< T >
 Acquire read access to the complete contiguous allocation.
 
DeviceResources & resources () const
 Return the device resources shared by every child buffer.
 
std::size_t size () const noexcept
 Return the total physical allocation size in elements.
 
auto write_synchronized_with (Stream const &stream) -> PartitionedWriteAccess< T >
 Acquire write access to the complete contiguous allocation.
 

Friends

template<typename >
class PartitionedReadAccess
 
template<typename >
class PartitionedWriteAccess
 

Detailed Description

template<typename T>
requires std::is_trivially_copyable_v<T>
class uni20::cuda::PartitionedCudaBuffer< T >

One CUDA allocation partitioned into independent logical buffers.

Construction validates the disjoint ranges once. Each child owns an independent completion ledger while sharing the physical allocation and device resources with its siblings.

Member Typedef Documentation

◆ buffer_type

template<typename T >
using uni20::cuda::PartitionedCudaBuffer< T >::buffer_type = CudaBuffer<T>

◆ element_type

template<typename T >
using uni20::cuda::PartitionedCudaBuffer< T >::element_type = T

Constructor & Destructor Documentation

◆ PartitionedCudaBuffer() [1/3]

template<typename T >
uni20::cuda::PartitionedCudaBuffer< T >::PartitionedCudaBuffer ( DeviceResources &  resources,
std::size_t  size,
std::span< CudaBufferRange const >  ranges 
)
inline

◆ PartitionedCudaBuffer() [2/3]

template<typename T >
uni20::cuda::PartitionedCudaBuffer< T >::PartitionedCudaBuffer ( PartitionedCudaBuffer< T > const &  )
delete

◆ PartitionedCudaBuffer() [3/3]

template<typename T >
uni20::cuda::PartitionedCudaBuffer< T >::PartitionedCudaBuffer ( PartitionedCudaBuffer< T > &&  other)
inlinenoexcept

Member Function Documentation

◆ buffer() [1/2]

template<typename T >
CudaBuffer< T > & uni20::cuda::PartitionedCudaBuffer< T >::buffer ( std::size_t  ordinal)
inline

Return one mutable logical child buffer.

◆ buffer() [2/2]

template<typename T >
CudaBuffer< T > const & uni20::cuda::PartitionedCudaBuffer< T >::buffer ( std::size_t  ordinal) const
inline

Return one read-only logical child buffer.

◆ buffer_count()

template<typename T >
std::size_t uni20::cuda::PartitionedCudaBuffer< T >::buffer_count ( ) const
inlinenoexcept

Return the number of logical child buffers.

◆ device()

template<typename T >
Device uni20::cuda::PartitionedCudaBuffer< T >::device ( ) const
inline

Return the CUDA device containing the physical allocation.

◆ operator=() [1/2]

template<typename T >
PartitionedCudaBuffer & uni20::cuda::PartitionedCudaBuffer< T >::operator= ( PartitionedCudaBuffer< T > &&  other)
inlinenoexcept

◆ operator=() [2/2]

template<typename T >
PartitionedCudaBuffer & uni20::cuda::PartitionedCudaBuffer< T >::operator= ( PartitionedCudaBuffer< T > const &  )
delete

◆ read_synchronized_with()

template<typename T >
requires std::is_trivially_copyable_v<T>
auto uni20::cuda::PartitionedCudaBuffer< T >::read_synchronized_with ( Stream const &  stream) const -> PartitionedReadAccess<T>

Acquire read access to the complete contiguous allocation.

The access waits on every child ledger and publishes one shared completion to all children on release.

◆ resources()

template<typename T >
DeviceResources & uni20::cuda::PartitionedCudaBuffer< T >::resources ( ) const
inline

Return the device resources shared by every child buffer.

◆ size()

template<typename T >
std::size_t uni20::cuda::PartitionedCudaBuffer< T >::size ( ) const
inlinenoexcept

Return the total physical allocation size in elements.

◆ write_synchronized_with()

template<typename T >
requires std::is_trivially_copyable_v<T>
auto uni20::cuda::PartitionedCudaBuffer< T >::write_synchronized_with ( Stream const &  stream) -> PartitionedWriteAccess<T>

Acquire write access to the complete contiguous allocation.

The access waits on every child ledger and publishes one shared completion to all children on release.

Friends And Related Symbol Documentation

◆ PartitionedReadAccess

template<typename T >
template<typename >
friend class PartitionedReadAccess
friend

◆ PartitionedWriteAccess

template<typename T >
template<typename >
friend class PartitionedWriteAccess
friend

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