10 #include <rapidsmpf/memory/buffer.hpp>
11 #include <rapidsmpf/memory/memory_type.hpp>
61 std::ranges::input_range Range =
62 std::initializer_list<std::pair<MemoryType, std::size_t>>>
63 requires std::convertible_to<
64 std::ranges::range_value_t<Range>,
65 std::pair<MemoryType, std::size_t>>
68 content_sizes_.fill(0);
69 for (
auto&& [mem_type, size] : sizes) {
70 auto idx =
static_cast<std::size_t
>(mem_type);
71 if (idx < content_sizes_.size()) {
72 content_sizes_[idx] = size;
95 return content_sizes_[
static_cast<std::size_t
>(mem_type)];
105 return content_sizes_[
static_cast<std::size_t
>(mem_type)];
142 return std::accumulate(
143 content_sizes_.begin(), content_sizes_.end(), std::size_t{0}
148 [[nodiscard]] constexpr
bool spillable() const noexcept {
161 return spillable_ == other.spillable_ && content_sizes_ == other.content_sizes_;
167 std::array<std::size_t,
MEMORY_TYPES.size()> content_sizes_ = {};
172 std::is_trivially_copyable_v<ContentDescription>,
173 "ContentDescription must be trivially copyable"
Description of an object's content.
Spillable
Indicates whether the content is spillable.
constexpr ContentDescription(Spillable spillable=Spillable::NO)
Construct a description with all sizes zero and a given spillability.
requires constexpr std::convertible_to< std::ranges::range_value_t< Range >, std::pair< MemoryType, std::size_t > > ContentDescription(Range &&sizes, Spillable spillable)
Construct a content description from a range of (MemoryType, size) pairs.
constexpr std::size_t content_size(MemoryType mem_type) const noexcept
Get the size for a specific memory type.
constexpr MemoryType principal_memory_type() const noexcept
Returns the principal memory type of the content.
constexpr std::size_t & content_size(MemoryType mem_type) noexcept
Access (read/write) the size for a specific memory type.
constexpr std::size_t content_size() const noexcept
Get the total content size across all memory types.
constexpr bool operator==(ContentDescription const &other) const noexcept
Equality comparison.
constexpr bool spillable() const noexcept
RAPIDS Multi-Processor interfaces.
@ YES
Overbooking is allowed.
@ NO
Overbooking is not allowed.
constexpr std::array< MemoryType, 3 > MEMORY_TYPES
All memory types sorted in decreasing order of preference.
MemoryType
Enum representing the type of memory sorted in decreasing order of preference.