Resource that adapts an upstream resource to allocate memory with a specified alignment. More...
#include <aligned_resource_adaptor.hpp>


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. | |
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.
|
explicit |
Construct an aligned resource adaptor using upstream to satisfy allocation requests.
| rmm::logic_error | if alignment is not a power of 2 |
| upstream | The resource used for allocating/deallocating device memory. |
| alignment | The size used for allocation alignment (raised to CUDA_ALLOCATION_ALIGNMENT if smaller). |
| alignment_threshold | Only allocations >= this size are aligned to alignment. |
|
noexcept |
rmm::device_async_resource_ref to the upstream resource
|
staticconstexpr |
The default alignment threshold used by the adaptor (0 = always align).