Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
uni20::CudaStorage Struct Reference

Tensor storage policy for device-resident CUDA values. More...

#include <cuda_storage.hpp>

Public Types

using accessor_factory_type = cuda::CudaAccessorFactory
 
using backend_selector_type = linalg::backend_list< linalg::CudaReferenceBackend >
 
using context_type = cuda::DeviceResources
 
template<class ElementType >
using packed_storage_t = cuda::PartitionedCudaBuffer< ElementType >
 
template<class ElementType >
using storage_t = cuda::CudaBuffer< ElementType >
 

Static Public Member Functions

template<class ElementType >
static auto allocation_context (packed_storage_t< ElementType > const &storage) noexcept -> context_type &
 Return the allocation context retained by a packed CUDA buffer.
 
static constexpr auto backend_selector () noexcept -> backend_selector_type
 Return the ordered backend list for CUDA device storage.
 
template<RealOrComplex ElementType>
static void initialize_packed_padding (packed_storage_t< ElementType > &storage, std::span< std::size_t const > offsets, std::span< std::size_t const > block_ends)
 Initialize only the alignment gaps in a packed CUDA allocation.
 
template<class ElementType >
static auto make_data_descriptor (storage_t< ElementType > &storage) noexcept -> cuda::CudaBufferView< ElementType >
 
template<class ElementType >
static auto make_data_descriptor (storage_t< ElementType > const &storage) noexcept -> cuda::CudaBufferView< ElementType const >
 
template<class ElementType >
static auto make_packed_data_descriptor (packed_storage_t< ElementType > &storage, std::size_t ordinal) noexcept -> cuda::CudaBufferView< ElementType >
 
template<class ElementType >
static auto make_packed_data_descriptor (packed_storage_t< ElementType > const &storage, std::size_t ordinal) noexcept -> cuda::CudaBufferView< ElementType const >
 
template<class ElementType >
static auto make_packed_storage (context_type &context, std::size_t size, std::span< std::size_t const > offsets, StorageInitialization initialization=StorageInitialization::Uninitialized) -> packed_storage_t< ElementType >
 
template<class ElementType >
static auto make_packed_storage (cuda::Device device, std::size_t size, std::span< std::size_t const > offsets, StorageInitialization initialization=StorageInitialization::Uninitialized) -> packed_storage_t< ElementType >
 
template<class ElementType >
static auto make_packed_storage (std::size_t size, std::span< std::size_t const > offsets, StorageInitialization initialization=StorageInitialization::Uninitialized) -> packed_storage_t< ElementType >
 
template<class ElementType >
static auto make_packed_storage_like (packed_storage_t< ElementType > const &storage, std::size_t size, std::span< std::size_t const > offsets, StorageInitialization initialization=StorageInitialization::Uninitialized) -> packed_storage_t< ElementType >
 
template<class ElementType >
static auto make_storage (context_type &context, std::size_t size, StorageInitialization initialization=StorageInitialization::Uninitialized) -> storage_t< ElementType >
 
template<class ElementType >
static auto make_storage (cuda::Device device, std::size_t size, StorageInitialization initialization=StorageInitialization::Uninitialized) -> storage_t< ElementType >
 
template<class ElementType >
static auto make_storage (std::size_t size, StorageInitialization initialization=StorageInitialization::Uninitialized) -> storage_t< ElementType >
 
template<class ElementType >
static auto make_storage_like (storage_t< ElementType > const &storage, std::size_t size, StorageInitialization initialization=StorageInitialization::Uninitialized) -> storage_t< ElementType >
 
template<class ElementType >
static bool storage_is_compatible (storage_t< ElementType > const &storage, cuda::Device device)
 

Static Public Attributes

static constexpr std::size_t allocation_alignment = 256
 Byte alignment guaranteed by CUDA runtime device allocations.
 

Detailed Description

Tensor storage policy for device-resident CUDA values.

Ordinary allocation uses the installed CUDA runtime's default device. An explicit cuda::DeviceResources selects another enrolled device or an isolated resource set used by tests. The policy selects CUDA backends and exposes deferred CudaBufferView descriptors with eventual pointer accessors. Stream and provider-resource admission remains operation-local. Direct Tensor operations may block during admission. Async<Tensor> operations use coroutine-aware dispatch when a backend provides it, while retaining the same storage and mdspec representation. Elements must be trivially copyable; owning MPFR/MPC scalars require host storage. This representation requirement does not imply that a CUDA kernel supports arithmetic on the type.

Member Typedef Documentation

◆ accessor_factory_type

using uni20::CudaStorage::accessor_factory_type = cuda::CudaAccessorFactory

◆ backend_selector_type

◆ context_type

◆ packed_storage_t

template<class ElementType >
using uni20::CudaStorage::packed_storage_t = cuda::PartitionedCudaBuffer<ElementType>

◆ storage_t

template<class ElementType >
using uni20::CudaStorage::storage_t = cuda::CudaBuffer<ElementType>

Member Function Documentation

◆ allocation_context()

template<class ElementType >
static auto uni20::CudaStorage::allocation_context ( packed_storage_t< ElementType > const &  storage) -> context_type&
inlinestaticnoexcept

Return the allocation context retained by a packed CUDA buffer.

◆ backend_selector()

static constexpr auto uni20::CudaStorage::backend_selector ( ) -> backend_selector_type
inlinestaticconstexprnoexcept

Return the ordered backend list for CUDA device storage.

◆ initialize_packed_padding()

template<RealOrComplex ElementType>
static void uni20::CudaStorage::initialize_packed_padding ( packed_storage_t< ElementType > &  storage,
std::span< std::size_t const >  offsets,
std::span< std::size_t const >  block_ends 
)
inlinestatic

Initialize only the alignment gaps in a packed CUDA allocation.

Uni20's real and complex scalar zeros have an all-zero CUDA object representation. Block payloads remain uninitialized.

◆ make_data_descriptor() [1/2]

template<class ElementType >
static auto uni20::CudaStorage::make_data_descriptor ( storage_t< ElementType > &  storage) -> cuda::CudaBufferView<ElementType>
inlinestaticnoexcept

◆ make_data_descriptor() [2/2]

template<class ElementType >
static auto uni20::CudaStorage::make_data_descriptor ( storage_t< ElementType > const &  storage) -> cuda::CudaBufferView<ElementType const>
inlinestaticnoexcept

◆ make_packed_data_descriptor() [1/2]

template<class ElementType >
static auto uni20::CudaStorage::make_packed_data_descriptor ( packed_storage_t< ElementType > &  storage,
std::size_t  ordinal 
) -> cuda::CudaBufferView<ElementType>
inlinestaticnoexcept

◆ make_packed_data_descriptor() [2/2]

template<class ElementType >
static auto uni20::CudaStorage::make_packed_data_descriptor ( packed_storage_t< ElementType > const &  storage,
std::size_t  ordinal 
) -> cuda::CudaBufferView<ElementType const>
inlinestaticnoexcept

◆ make_packed_storage() [1/3]

template<class ElementType >
static auto uni20::CudaStorage::make_packed_storage ( context_type &  context,
std::size_t  size,
std::span< std::size_t const >  offsets,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> packed_storage_t<ElementType>
inlinestatic

◆ make_packed_storage() [2/3]

template<class ElementType >
static auto uni20::CudaStorage::make_packed_storage ( cuda::Device  device,
std::size_t  size,
std::span< std::size_t const >  offsets,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> packed_storage_t<ElementType>
inlinestatic

◆ make_packed_storage() [3/3]

template<class ElementType >
static auto uni20::CudaStorage::make_packed_storage ( std::size_t  size,
std::span< std::size_t const >  offsets,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> packed_storage_t<ElementType>
inlinestatic

◆ make_packed_storage_like()

template<class ElementType >
static auto uni20::CudaStorage::make_packed_storage_like ( packed_storage_t< ElementType > const &  storage,
std::size_t  size,
std::span< std::size_t const >  offsets,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> packed_storage_t<ElementType>
inlinestatic

◆ make_storage() [1/3]

template<class ElementType >
static auto uni20::CudaStorage::make_storage ( context_type &  context,
std::size_t  size,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> storage_t<ElementType>
inlinestatic

◆ make_storage() [2/3]

template<class ElementType >
static auto uni20::CudaStorage::make_storage ( cuda::Device  device,
std::size_t  size,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> storage_t<ElementType>
inlinestatic

◆ make_storage() [3/3]

template<class ElementType >
static auto uni20::CudaStorage::make_storage ( std::size_t  size,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> storage_t<ElementType>
inlinestatic

◆ make_storage_like()

template<class ElementType >
static auto uni20::CudaStorage::make_storage_like ( storage_t< ElementType > const &  storage,
std::size_t  size,
StorageInitialization  initialization = StorageInitialization::Uninitialized 
) -> storage_t<ElementType>
inlinestatic

◆ storage_is_compatible()

template<class ElementType >
static bool uni20::CudaStorage::storage_is_compatible ( storage_t< ElementType > const &  storage,
cuda::Device  device 
)
inlinestatic

Member Data Documentation

◆ allocation_alignment

constexpr std::size_t uni20::CudaStorage::allocation_alignment = 256
staticconstexpr

Byte alignment guaranteed by CUDA runtime device allocations.


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