fix(vulkan): Make error_if_would_oom_on_resource_allocation more accurate - #9643
Merged
Conversation
6 tasks
teoxoy
approved these changes
Jun 10, 2026
teoxoy
left a comment
Member
There was a problem hiding this comment.
Looks good, I imagined the logic would have been even more involved but it's not too bad. I also think it's unlikely to change and in the future we can still replace the allocator with our own custom implementation and have control over the logic.
This was referenced Jun 25, 2026
This was referenced Jul 6, 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.
Connections
Alternative to #9359.
Fixes #8479.
Fixes #9206.
May fix some Firefox bugs that manifest as a dubious OOM error.
Description
Similar to #9359, but instead of checking all matching heaps, tries to replicate the logic that
gpu-allocatoruses to decide which heap to use for the allocation.This is fragile when
gpu-allocatorchanges. Some other strategies we could pursue:gpu-allocatoralong the lines of this PR, to reduce the risk of drift.Since allocations are made locally by
gpu-allocatorfrom memory blocks provided by the device, it's possible that (1) rejecting an allocation based on our OOM detection logic may not actually change the amount of memory available to other users of the GPU, (2) an allocation that our logic says will not produce an OOM causes a new memory block to be allocated, consuming more memory than the nominal amount of the allocation, resulting in OOM.CC @jimblandy since we talked about this earlier.
Testing
Fixes various CTS failures on GPUs with multiple heaps. (Resolving some failures requires additionally setting
MemoryHints::MemoryUsage, which I haven't done in this change.)Squash or Rebase? Squash
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.