Conversation
ErichDonGubler
left a comment
There was a problem hiding this comment.
I've reviewed everything here, and the code itself looks good. So long as the design is what we want, then I think we're good to merge. I wanted to confirm with folks who knew more (CC @teoxoy and @jimblandy): Is this design right? It makes sense to me that, if there are multiple heaps, and we multiplex between them to avoid OOMs anyway, then we should ensure that no heaps could accept an allocation before declaring an OOM.
|
I'd also like @teoxoy to take a look. If checking for space on any heap is an empirical improvement, then maybe it's better, but it seems like what we really need here is something that is smarter about figuring out which heap is actually needed, since they may not be interchangeable. Or a different approach would be to try and guess which heap is the "primary" heap, and which allocations are "normal" allocations, and only apply the OOM-prevention to those rather than to everything. #9206 I think could be duped to #8479, and https://bugzilla.mozilla.org/show_bug.cgi?id=2028252 is another issue that may be relevant. |
That makes sense. I think the current behavior is wrong, but it also feels brittle to hard code which heaps If you want a different strategy I can try to rework my PR. |
|
One of the deleted comments indicates that the reason a definitive OOM diagnosis wasn't possible was because |
|
The problem with this approach is that an OOM situation might not be reported if multiple memory types with compatible flags exist because Also, I think the |
|
I also don't see how this PR would fix @ErichDonGubler what is the error you encounter locally for that test? Could you leave a comment in #8479 with it? |
I don't encounter an error on my M1 MacBook Pro, before and after the patch. Should I try on another platform? |
|
Responding to two items simultaneously:
I can understand if the intention is to detect the system has already reached an OOM condition by checking if the current condition of any heap exceeds an OOM threshold. But I don't see why every heap must be able to accommodate the new allocation? For #9206 (which is not specifically about the Another idea I just had is that possibly we want to set |
The test was marked as failing in #8454 but it's not marked as failing in Firefox CI. Can you try to repro it locally on Linux/do you have a link with the failure in wgpu's CI (I can't find a previous workflow run in #8454)? |
|
Connections
Fixes #8479
Description
I investigated the issue above and found a few issues with the Vulkan OOM validation:
check_if_oomanderror_if_would_oom_on_resource_allocation, and both of them have the issue above. On top of thaterror_if_would_oom_on_resource_allocationwould ignore heaps withvk::MemoryPropertyFlags::LAZILY_ALLOCATED | vk::MemoryPropertyFlags::PROTECTEDwhilecheck_if_oomwould not which seems wrong? I'm not sure.To fix I moved the shared logic into a helper function and fixed the issue there. I also simplified the code a bit.
Testing
The cts tests pass now, at least on my machine.
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.