Public Member Functions | Static Public Attributes | Friends | List of all members
rmm::mr::aligned_resource_adaptor Class Reference

Resource that adapts an upstream resource to allocate memory with a specified alignment. More...

#include <aligned_resource_adaptor.hpp>

Inheritance diagram for rmm::mr::aligned_resource_adaptor:
Inheritance graph
[legend]
Collaboration diagram for rmm::mr::aligned_resource_adaptor:
Collaboration graph
[legend]

Public Member Functions

 aligned_resource_adaptor (cuda::mr::any_resource< cuda::mr::device_accessible > upstream, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT, std::size_t alignment_threshold=default_alignment_threshold)
 Construct an aligned resource adaptor using upstream to satisfy allocation requests. More...
 
device_async_resource_ref get_upstream_resource () const noexcept
 rmm::device_async_resource_ref to the upstream resource More...
 

Static Public Attributes

static constexpr std::size_t default_alignment_threshold
 The default alignment threshold used by the adaptor (0 = always align). More...
 

Friends

void get_property (aligned_resource_adaptor const &, cuda::mr::device_accessible) noexcept
 Enables the cuda::mr::device_accessible property.
 

Detailed Description

Resource that adapts an upstream resource to allocate memory with a specified alignment.

If the requested alignment is smaller than CUDA_ALLOCATION_ALIGNMENT (256 bytes) it is increased to CUDA_ALLOCATION_ALIGNMENT. An optional threshold controls the minimum size above which the custom alignment is applied.

This class is copyable and shares ownership of its internal state via cuda::mr::shared_resource.

Constructor & Destructor Documentation

◆ aligned_resource_adaptor()

rmm::mr::aligned_resource_adaptor::aligned_resource_adaptor ( cuda::mr::any_resource< cuda::mr::device_accessible >  upstream,
std::size_t  alignment = rmm::CUDA_ALLOCATION_ALIGNMENT,
std::size_t  alignment_threshold = default_alignment_threshold 
)
explicit

Construct an aligned resource adaptor using upstream to satisfy allocation requests.

Exceptions
rmm::logic_errorif alignment is not a power of 2
Parameters
upstreamThe resource used for allocating/deallocating device memory.
alignmentThe size used for allocation alignment (raised to CUDA_ALLOCATION_ALIGNMENT if smaller).
alignment_thresholdOnly allocations >= this size are aligned to alignment.

Member Function Documentation

◆ get_upstream_resource()

device_async_resource_ref rmm::mr::aligned_resource_adaptor::get_upstream_resource ( ) const
noexcept

rmm::device_async_resource_ref to the upstream resource

Returns
rmm::device_async_resource_ref to the upstream resource

Member Data Documentation

◆ default_alignment_threshold

constexpr std::size_t rmm::mr::aligned_resource_adaptor::default_alignment_threshold
staticconstexpr
Initial value:
=
detail::aligned_resource_adaptor_impl::default_alignment_threshold

The default alignment threshold used by the adaptor (0 = always align).


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