Skip to content

Commit

Permalink
handle pool expand size too large
Browse files Browse the repository at this point in the history
  • Loading branch information
pmattione-nvidia committed Feb 25, 2025
1 parent 8fe497e commit 02791f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/rmm/mr/device/pool_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@ class pool_memory_resource final
// limit each time. If it is not set, grow exponentially, e.g. by doubling the pool size each
// time. Upon failure, attempt to back off exponentially, e.g. by half the attempted size,
// until either success or the attempt is less than the requested size.

if (maximum_pool_size_.has_value()) {
auto const max_size = maximum_pool_size_.value();
if (size > max_size) {
auto const msg = std::string("Maximum pool size exceeded (failed to allocate ") +
rmm::detail::format_bytes(size) +
std::string("): Request larger than capacity (") +
rmm::detail::format_bytes(max_size) + std::string(")");
RMM_FAIL(msg.c_str(), rmm::out_of_memory);
}
}

return try_to_expand(size_to_grow(size), size, stream);
}

Expand Down

0 comments on commit 02791f4

Please sign in to comment.