Add support for growing the memory block sizes#254
Merged
Jasper-Bekkers merged 1 commit intoTraverse-Research:mainfrom Dec 3, 2024
Merged
Add support for growing the memory block sizes#254Jasper-Bekkers merged 1 commit intoTraverse-Research:mainfrom
Jasper-Bekkers merged 1 commit intoTraverse-Research:mainfrom
Conversation
ee4313e to
b68e05e
Compare
Jasper-Bekkers
approved these changes
Dec 2, 2024
Member
|
@nical Please sign the commits so they can be merged. |
And fix the vulkan allocator ignoring the allocation_sizes parameter.
Contributor
Author
|
There you go! |
13 tasks
MarijnS95
reviewed
Jan 31, 2025
Member
MarijnS95
left a comment
There was a problem hiding this comment.
Sorry for the late review, I missed this while not being able to work on Rust projects for a while. Code looks good, thanks! Just found a few typos and broken field references. Would you be able to provide a follow-up or should I?
Comment on lines
-464
to
+466
| let memblock_size = if self | ||
| let is_host = self | ||
| .memory_properties | ||
| .contains(vk::MemoryPropertyFlags::HOST_VISIBLE) | ||
| { | ||
| allocation_sizes.host_memblock_size | ||
| } else { | ||
| allocation_sizes.device_memblock_size | ||
| }; | ||
| .contains(vk::MemoryPropertyFlags::HOST_VISIBLE); |
Member
There was a problem hiding this comment.
Hmm I wonder if is_host is the correct moniker for something that's HOST_VISIBLE but could just as well have DEVICE_LOCAL. That's the original logic though, but then this struct was always default()ed before it seems.
Same in Metal, we probably need to start representing UMA better.
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.
Fixes #235.
This PR extends the AllocationsSizes configuration to define ranges of block sizes. The allocators start by allocating blocks with the minimum size and each new allocation for the same memory type doubles the block size.
This allows applications to scale memory usage more organically based on demand. While it is typically not an optimal choice for most games, it allows other types of apps that don't have well defined memory budgets to strike a good tradeoff. My own motivation comes from Firefox's WebGPU implementation. See #235 for more details.
While writing this I found out that the vulkan allocator was not taking the
allocation_sizeparameter from its descritptor, so I fixed that along the way.I, m not sure about how to expose this in the API. In its current state, this PR only adds to the current API and does not change anything for folks who want to stick with the current behavior (fixed block sizes).
Example:
But it looks a bit quirky. One might prefer to simply spell out the ranges when creating
AllocationSizes. let me know what you prefer.