Repository navigation
feat: Give the allocator limit of each device in EXLA.Client.get_memory_statistics/1 - #1904
Merged
Merged
Conversation
…ry_statistics/1 EXLA.Client.get_memory_statistics/1 now has a :limit key: a map of device ID to the bytes that the allocator of the device can use. It reads PjRtDevice::GetAllocatorStats().bytes_limit for each addressable device. A device whose allocator gives no limit is not in the map, so the host client gives an empty map. On CUDA, the limit is that of the BFC allocator, which :memory_fraction sets. A library can then size its buffers to the device before it allocates them.
josevalim
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EXLA.Client.get_memory_statistics/1 now has a
:limitkey: a map of device ID to the bytes that the allocator of the device can use. It readsPjRtDevice::GetAllocatorStats().bytes_limitfor each addressable device. A device whose allocator gives no limit is not in the map, so the host client gives an empty map.Why: a library that keeps buffers on the device, such as the KV cache of a text generation server, must know how much memory the device has before it allocates them. Today EXLA gives the allocated and peak bytes, but not the limit. On CUDA, the limit is that of the BFC allocator, which
:memory_fractionsets. On an RTX 3060 with the default fraction, it gives 11291066368 bytes.