Description of an object's content. More...
#include <content_description.hpp>
Public Types | |
| enum class | Spillable : bool { NO , YES } |
| Indicates whether the content is spillable. | |
Public Member Functions | |
| template<std::ranges::input_range Range = std::initializer_list<std::pair<MemoryType, std::size_t>>> | |
| 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. More... | |
| constexpr | ContentDescription (Spillable spillable=Spillable::NO) |
| Construct a description with all sizes zero and a given spillability. More... | |
| constexpr std::size_t & | content_size (MemoryType mem_type) noexcept |
| Access (read/write) the size for a specific memory type. More... | |
| constexpr std::size_t | content_size (MemoryType mem_type) const noexcept |
| Get the size for a specific memory type. More... | |
| constexpr MemoryType | principal_memory_type () const noexcept |
| Returns the principal memory type of the content. More... | |
| constexpr std::size_t | content_size () const noexcept |
| Get the total content size across all memory types. More... | |
| constexpr bool | spillable () const noexcept |
| constexpr bool | operator== (ContentDescription const &other) const noexcept |
| Equality comparison. More... | |
Description of an object's content.
A ContentDescription encapsulates resource-related information about an object's content such as memory sizes, memory types, and spillability.
In RapidsMPF, an object's content refers to the actual data associated with the object, not its metadata or auxiliary information. Typically, this content is represented by one or more Buffer instances that may reside in different memory spaces (e.g., host or device). It is also this content that is subject to spilling and that typically accounts for the majority of an object's overall memory footprint.
The spillability state of an object is treated as an all-or-nothing property. While one could imagine an object with a mix of spillable and non-spillable content, this distinction is intentionally simplified in RapidsMPF.
Definition at line 32 of file content_description.hpp.
|
inlineexplicitconstexpr |
Construct a content description from a range of (MemoryType, size) pairs.
Memory types omitted from the input are initialized to zero.
| Range | A range whose value type is convertible to std::pair<MemoryType, std::size_t>. |
| sizes | Range of (MemoryType, size) pairs representing content sizes. |
| spillable | Whether the content is spillable to slower memory tiers. |
Definition at line 66 of file content_description.hpp.
|
inlineconstexpr |
Construct a description with all sizes zero and a given spillability.
Useful when you need a zero-sized content description or when building a content description iteratively.
| spillable | Whether the content are spillable. |
Definition at line 85 of file content_description.hpp.
|
inlineconstexprnoexcept |
Get the total content size across all memory types.
Computes the sum of all per-memory-type content sizes. This represents the total size (in bytes) of the object's content across host, device, and any other memory types.
Definition at line 141 of file content_description.hpp.
|
inlineconstexprnoexcept |
Get the size for a specific memory type.
| mem_type | The memory type entry to access. |
Definition at line 104 of file content_description.hpp.
|
inlineconstexprnoexcept |
Access (read/write) the size for a specific memory type.
| mem_type | The memory type entry to access. |
Definition at line 94 of file content_description.hpp.
|
inlineconstexprnoexcept |
Equality comparison.
| other | The content description to compare against. |
true if both descriptions are equal; otherwise false. Definition at line 158 of file content_description.hpp.
|
inlineconstexprnoexcept |
Returns the principal memory type of the content.
The principal memory type is the first memory type with non-zero content, evaluated in the preference order defined by MEMORY_TYPES.
If all content sizes are zero, the method returns MemoryType::DEVICE. Zero-sized content usually means the Message contains only metadata, or that the content size is unknown or irrelevant. In such cases the choice of memory type has no practical effect. We default to MemoryType::DEVICE because, when spillable() == false, it is the only memory type that meaningfully applies.
MemoryType::DEVICE if none contain content. Definition at line 123 of file content_description.hpp.
|
inlineconstexprnoexcept |
Definition at line 148 of file content_description.hpp.