|
Uni20
Asynchronous tensor and runtime library.
|
Move-only logical CUDA buffer and completion state. More...
#include <buffer.hpp>
Public Types | |
| using | blocking_read_access_type = BlockingReadAccess< T > |
| using | blocking_write_access_type = BlockingWriteAccess< T > |
| using | element_type = T |
| using | read_access_type = ReadAccess< T > |
| using | write_access_type = WriteAccess< T > |
Public Member Functions | |
| std::size_t | allocation_offset () const noexcept |
| Return this logical buffer's offset in its physical allocation. | |
| BlockingReadAccess< T > | blocking_read_access () const |
| Acquire read-only access after host-waiting for prior CUDA work. | |
| BlockingWriteAccess< T > | blocking_write_access () |
| Acquire read/write access after host-waiting for prior CUDA work. | |
| CudaBuffer (CudaBuffer &&other) noexcept | |
| CudaBuffer (CudaBuffer const &)=delete | |
| CudaBuffer (DeviceResources &resources, std::size_t size) | |
Allocate size elements from one CUDA device's resources. | |
| CudaBuffer (std::size_t size) | |
Allocate size elements on the installed runtime's default CUDA device. | |
| Device | device () const |
| Return the allocation's CUDA device. | |
| bool | empty () const noexcept |
| Return whether this is a zero-sized or moved-from allocation. | |
| OwningReadAccess< T > | into_blocking_read_access () && |
| Move this buffer into an owning host-synchronized read access. | |
| OwningReadAccess< T > | into_read_synchronized_with (Stream const &stream) && |
| Move this buffer into an owning stream-ordered read access. | |
| CudaBuffer & | operator= (CudaBuffer &&other) noexcept |
| CudaBuffer & | operator= (CudaBuffer const &)=delete |
| auto | partition (std::span< CudaBufferRange const > ranges) &&-> std::vector< CudaBuffer > |
| Consume this buffer into statically disjoint logical child buffers. | |
| ReadAccess< T > | read_synchronized_with (Stream const &stream) const |
Acquire scoped read-only access synchronized with stream. | |
| DeviceResources & | resources () const |
| Return the device resources borrowed by this buffer. | |
| bool | shares_allocation_with (CudaBuffer const &other) const noexcept |
| Return whether another logical buffer shares this physical allocation. | |
| std::size_t | size () const noexcept |
| Return the number of typed elements in the allocation. | |
| std::size_t | size_bytes () const noexcept |
| Return the allocation size in bytes. | |
| void | synchronize () const |
| Wait for every submitted operation currently involving this buffer. | |
| WriteAccess< T > | write_synchronized_with (Stream const &stream) |
Acquire scoped read/write access synchronized with stream. | |
| ~CudaBuffer () | |
Friends | |
| template<typename > | |
| class | BlockingReadAccess |
| template<typename > | |
| class | BlockingWriteAccess |
| template<typename > | |
| class | OwningReadAccess |
| template<typename > | |
| class | PartitionedReadAccess |
| template<typename > | |
| class | PartitionedWriteAccess |
| template<typename > | |
| class | ReadAccess |
| template<typename > | |
| class | WriteAccess |
Move-only logical CUDA buffer and completion state.
A buffer may own an entire CUDA allocation or one statically disjoint region of a shared allocation. Each logical buffer has an independent access ledger. Raw device pointers are exposed only through scoped access objects. Elements must be trivially copyable: allocations and bytewise transfers do not manage host-side owners.
| using uni20::cuda::CudaBuffer< T >::blocking_read_access_type = BlockingReadAccess<T> |
| using uni20::cuda::CudaBuffer< T >::blocking_write_access_type = BlockingWriteAccess<T> |
| using uni20::cuda::CudaBuffer< T >::element_type = T |
| using uni20::cuda::CudaBuffer< T >::read_access_type = ReadAccess<T> |
| using uni20::cuda::CudaBuffer< T >::write_access_type = WriteAccess<T> |
|
inlineexplicit |
Allocate size elements on the installed runtime's default CUDA device.
|
inline |
Allocate size elements from one CUDA device's resources.
|
delete |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
Return this logical buffer's offset in its physical allocation.
|
inline |
Acquire read-only access after host-waiting for prior CUDA work.
|
inline |
Acquire read/write access after host-waiting for prior CUDA work.
|
inline |
Return the allocation's CUDA device.
|
inlinenoexcept |
Return whether this is a zero-sized or moved-from allocation.
| OwningReadAccess< T > uni20::cuda::CudaBuffer< T >::into_blocking_read_access | ( | ) | && |
Move this buffer into an owning host-synchronized read access.
| OwningReadAccess< T > uni20::cuda::CudaBuffer< T >::into_read_synchronized_with | ( | Stream const & | stream | ) | && |
Move this buffer into an owning stream-ordered read access.
|
inlinenoexcept |
|
delete |
|
inline |
Consume this buffer into statically disjoint logical child buffers.
Every range is relative to this logical buffer. Ranges must be sorted, non-overlapping, and contained within the buffer. The source becomes moved-from and cannot bypass the child ledgers.
|
inline |
Acquire scoped read-only access synchronized with stream.
|
inline |
Return the device resources borrowed by this buffer.
|
inlinenoexcept |
Return whether another logical buffer shares this physical allocation.
|
inlinenoexcept |
Return the number of typed elements in the allocation.
|
inlinenoexcept |
Return the allocation size in bytes.
|
inline |
Wait for every submitted operation currently involving this buffer.
|
inline |
Acquire scoped read/write access synchronized with stream.