Allocates memory from upstream resources associated with bin sizes. More...
#include <binning_memory_resource.hpp>


Public Member Functions | |
| binning_memory_resource (cuda::mr::any_resource< cuda::mr::device_accessible > upstream) | |
| Construct a new binning memory resource object. More... | |
| binning_memory_resource (cuda::mr::any_resource< cuda::mr::device_accessible > upstream, int8_t min_size_exponent, int8_t max_size_exponent) | |
| Construct a new binning memory resource object with a range of initial bins. More... | |
| device_async_resource_ref | get_upstream_resource () const noexcept |
| device_async_resource_ref to the upstream resource More... | |
| void | add_bin (std::size_t allocation_size, std::optional< device_async_resource_ref > bin_resource=std::nullopt) |
| Add a bin allocator to this resource. More... | |
Friends | |
| void | get_property (binning_memory_resource const &, cuda::mr::device_accessible) noexcept |
Enables the cuda::mr::device_accessible property. More... | |
Allocates memory from upstream resources associated with bin sizes.
This class is copyable and shares ownership of its internal state, allowing multiple instances to safely reference the same underlying bins.
|
explicit |
Construct a new binning memory resource object.
Initially has no bins, so simply uses the upstream resource until bin resources are added with add_bin.
| upstream | The resource used to allocate bin pools. |
| rmm::mr::binning_memory_resource::binning_memory_resource | ( | cuda::mr::any_resource< cuda::mr::device_accessible > | upstream, |
| int8_t | min_size_exponent, | ||
| int8_t | max_size_exponent | ||
| ) |
Construct a new binning memory resource object with a range of initial bins.
Constructs a new binning memory resource and adds bins backed by fixed_size_memory_resource in the range [2^min_size_exponent, 2^max_size_exponent]. For example if min_size_exponent==18 and max_size_exponent==22, creates bins of sizes 256KiB, 512KiB, 1024KiB, 2048KiB and 4096KiB.
| upstream | The resource used to allocate bin pools. |
| min_size_exponent | The minimum base-2 exponent bin size. |
| max_size_exponent | The maximum base-2 exponent bin size. |
| void rmm::mr::binning_memory_resource::add_bin | ( | std::size_t | allocation_size, |
| std::optional< device_async_resource_ref > | bin_resource = std::nullopt |
||
| ) |
Add a bin allocator to this resource.
Adds bin_resource if provided; otherwise constructs and adds a fixed_size_memory_resource.
This bin will be used for any allocation smaller than allocation_size that is larger than the next smaller bin's allocation size.
If there is already a bin of the specified size nothing is changed.
This function is not thread safe.
| allocation_size | The maximum size that this bin allocates |
| bin_resource | The memory resource for the bin |
|
noexcept |
device_async_resource_ref to the upstream resource
|
friend |
Enables the cuda::mr::device_accessible property.
This property declares that a binning_memory_resource provides device accessible memory