Public Types | Public Member Functions | List of all members
rapidsmpf::ContentDescription Class Reference

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 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...
 

Detailed Description

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 31 of file content_description.hpp.

Constructor & Destructor Documentation

◆ ContentDescription() [1/2]

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> > rapidsmpf::ContentDescription::ContentDescription ( Range &&  sizes,
Spillable  spillable 
)
inlineexplicitconstexpr

Construct a content description from a range of (MemoryType, size) pairs.

Memory types omitted from the input are initialized to zero.

Template Parameters
RangeA range whose value type is convertible to std::pair<MemoryType, std::size_t>.
Parameters
sizesRange of (MemoryType, size) pairs representing content sizes.
spillableWhether the content is spillable to slower memory tiers.
std::array{
std::pair{MemoryType::HOST, 1024UL},
std::pair{MemoryType::DEVICE, 2048UL}
},
ContentDescription::Spillable::YES
};
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.

Definition at line 65 of file content_description.hpp.

◆ ContentDescription() [2/2]

constexpr rapidsmpf::ContentDescription::ContentDescription ( Spillable  spillable = Spillable::NO)
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.

Parameters
spillableWhether the content are spillable.

Definition at line 84 of file content_description.hpp.

Member Function Documentation

◆ content_size() [1/3]

constexpr std::size_t rapidsmpf::ContentDescription::content_size ( ) const
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.

Returns
Total size (in bytes) across all memory types.

Definition at line 116 of file content_description.hpp.

◆ content_size() [2/3]

constexpr std::size_t rapidsmpf::ContentDescription::content_size ( MemoryType  mem_type) const
inlineconstexprnoexcept

Get the size for a specific memory type.

Parameters
mem_typeThe memory type entry to access.
Returns
Size (in bytes) for the given memory type.

Definition at line 103 of file content_description.hpp.

◆ content_size() [3/3]

constexpr std::size_t& rapidsmpf::ContentDescription::content_size ( MemoryType  mem_type)
inlineconstexprnoexcept

Access (read/write) the size for a specific memory type.

Parameters
mem_typeThe memory type entry to access.
Returns
Reference to the size (in bytes) for the given memory type.

Definition at line 93 of file content_description.hpp.

◆ operator==()

constexpr bool rapidsmpf::ContentDescription::operator== ( ContentDescription const &  other) const
inlineconstexprnoexcept

Equality comparison.

Parameters
otherThe content description to compare against.
Returns
true if both descriptions are equal; otherwise false.

Definition at line 133 of file content_description.hpp.

◆ spillable()

constexpr bool rapidsmpf::ContentDescription::spillable ( ) const
inlineconstexprnoexcept
Returns
Whether the content can be spilled.

Definition at line 123 of file content_description.hpp.


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