-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] arena_memory_resource allows creation with a maximum allocation size smaller than its minimum superblock size #919
Comments
This issue has been labeled |
Added a check and corresponding test. |
Currently the arena allocator divides GPU memory into a global arena and per-thread arenas. For smaller allocations, a per-thread arena allocates large chunks of memory (superblocks) from the global arena and divides them up for individual allocations. However, when deallocating from another arena (producer/consumer pattern), or when we run out of memory and return everything to the global arena, the superblock boundaries are broken. Overtime, this could cause the memory to get more and more fragmented. This PR makes superblocks concrete objects, not just virtual boundaries, and the only units of exchange between the global arena and per-thread arenas. This should make the allocator more resistant to memory fragmentation, especially for long running processes under constant memory pressure. Other notable changes: * The allocator now allocates a fixed but configurable amount of memory from CUDA. This introduces less fragmentation comparing to growing the pool size gradually. * Switched to C++17 `std::shared_mutex`. * Added a bunch of unit tests. fixes #919 fixes #906 Authors: - Rong Ou (https://github.com/rongou) Approvers: - Jake Hemstad (https://github.com/jrhemstad) - Mark Harris (https://github.com/harrism) URL: #916
Describe the bug
Creating an
arena_memory_resource
with a value of the constructor parametermaximum_size
smaller than its internal minimum superblock size will cause any allocation to fail.Also, the default values of the parameters
initial_size
andmaximum_size
are defined in the detail namespace. Since there is another defaulted parameter (dump_log_on_failure
) after these two parameters, this makes it difficult to construct an instance of this MR using the defaults for the sizes but a non-default value fordump_log_on_failure
.Steps/Code to reproduce bug
Expected behavior
An exception should be thrown by the constructor if invalid parameters are passed.
The text was updated successfully, but these errors were encountered: