12 #include <rapidsmpf/pausable_thread_loop.hpp>
13 #include <rapidsmpf/utils.hpp>
50 BufferResource* br, std::optional<Duration> periodic_spill_check = std::nullopt
95 std::size_t
spill(std::size_t amount);
116 mutable std::mutex mutex_;
118 std::size_t spill_function_id_counter_{0};
119 std::map<SpillFunctionID, SpillFunction> spill_functions_;
120 std::multimap<int, SpillFunctionID, std::greater<>> spill_function_priorities_;
121 std::optional<detail::PausableThreadLoop> periodic_spill_thread_;
Class managing buffer resources.
Manages memory spilling to free up device memory when needed.
std::size_t SpillFunctionID
Represents a unique identifier for a registered spill function.
std::size_t spill_to_make_headroom(std::int64_t headroom=0)
Attempts to free up memory by spilling data until the requested headroom is available.
~SpillManager()
Destructor for SpillManager.
SpillManager(BufferResource *br, std::optional< Duration > periodic_spill_check=std::nullopt)
Constructs a SpillManager instance.
SpillFunctionID add_spill_function(SpillFunction spill_function, int priority)
Adds a spill function with a given priority to the spill manager.
std::function< std::size_t(std::size_t)> SpillFunction
Spill function type.
std::size_t spill(std::size_t amount)
Initiates spilling to free up a specified amount of memory.
void remove_spill_function(SpillFunctionID fid)
Removes a spill function from the spill manager.