descriptors: allocate heap sets one at a time #1758
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1758
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1758/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Arda501 on GitHub · 2026-10-20 13:06 UTC · original
Arda501:pr/descriptor-heap-alloc→main· +21 −22 · 1 files · 1 commits · closed without mergingGame and problem
SAROS (PPSA07631, v01.00), Linux (CachyOS), RX 9070 XT, Mesa RADV. Drawing with pipelines whose descriptor set holds a large sampled-image array (about 1,190 to 1,430 images plus a few buffers and samplers) exits with:
The failure is in
DescriptorHeap::Commit: the allocation from a newly created or reset pool fails, even for a single set.Cause
DescriptorHeap::Allocateasks forDescriptorSetBatch(32) sets in onevkAllocateDescriptorSetscall. OnVK_ERROR_OUT_OF_POOL_MEMORYit halves the count and retries in the same pool. With RADV, a multi-set allocation that runs out of memory partway keeps the pool memory of the sets it made before failing (the pool has noFREE_DESCRIPTOR_SETflag, so the pool is a linear allocator). After the 32-set attempt fails, the pool is already exhausted, so 16, 8, ... and finally 1 set fail as well, and the fresh-pool path exits.A standalone Vulkan test with the same layout (bindings 7/7/7/2/2/0/7, 2+1+2+1190+62 sampled images + samplers) shows it on RADV GFX1201:
VK_ERROR_OUT_OF_POOL_MEMORYin that same, otherwise empty pool.Change
Allocateallocates one set per call, up to the batch size, and stops at the first out-of-memory result. A failed single-set call does not consume pool memory, so a fresh pool always gets at least the sets that fit.One file,
descriptorHeap.cpp.Testing
main1a053f9ealone, SAROS exits earlier, at gameplay start, for an unrelated reason fixed in #1760, so this exit cannot be reached there yet.main1a053f9e. Not built or tested on Windows.AI use
Claude Code found the failing call, wrote the standalone reproduction and the change, and built it.
I reviewed all changes and did the game testing.
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-10-20 13:09 UTC · original · edited 2026-10-20 13:42 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
7ecd6d92-8cb2-4b03-a35f-da37cd946428📥 Commits
Reviewing files that changed from the base of the PR and between
1a053f9e13and287b03bd84.📒 Files selected for processing: 1
src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Descriptor pool capacities increase for storage buffers, sampled images, storage images, and samplers.
DescriptorHeap::Allocatenow requests descriptor sets one at a time. It stops when the batch is filled or allocation fails. For pool exhaustion or fragmentation, it reports whether it allocated at least one set. The previous retry behavior that halved the requested allocation size is removed.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
287b0The change allocates descriptor sets one at a time and raises pool capacities, which addresses the reported RADV retry failure. No concrete merge-blocking risk was identified.
Pre-merge checks:
4 ·
1
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@Nawid3333 on GitHub · 2026-11-02 00:57 UTC · original
Windows data for this PR: Ghost of Yōtei (PPSA26344) hits the same exit, and this change fixes it there.
893b03552+ #1967 (RX 9070 XT, AMD Windows driver 26.10.1, Windows 11): the game exits withcondition (!Allocate(layout, fresh_batch)) is trueatdescriptorHeap.cpp:57. The failing layout has 5 storage buffers, 2390 sampled images and 3 samplers in 7 bindings. #1967 is needed to get this far; it removes an earlier stack overflow in this game.VK_ERROR_OUT_OF_POOL_MEMORY. The same happens for sets of 1024 to 8192 sampled images. ViniciusDean measured the same on an RX 9070 XT in #829. TheCruZ's GTA V fork avoids it differently: TheCruZ/KytyPS5-GTA@6a15afa counts the room left in the pool and asks only for the sets that fit.287b03bd8) merged into the same build: the game no longer exits inDescriptorHeap::Commitand keeps loading. It then stays on a black screen while it keeps compiling pipelines. That is a separate problem.DescriptorHeapLargeSetand the test below pass with this PR'sdescriptorHeap.cpp.A harness test for this path, if you want it in the PR. On the RX 9070 XT:
descriptorHeap.cpp:57on main and passes with this PR.Allocate, so it covers the one-set-per-call change itself, not only the bigger pools.DescriptorHeapSampledImageSet (tests/ShaderRecompilerComputeTests.cpp)
It is called after
CheckDescriptorHeapLargeSet()in the--descriptor-heap-onlyselector and in the full run.@Nawid3333 on GitHub · 2026-11-15 14:49 UTC · original
Another game: A Plague Tale: Requiem (PPSA05366), tested by @Crispy81 in #1995 on Windows 11 with an RX 9070 XT and a Ryzen 7 7700X.
bc934ef: the game reaches the main menu, starts a new game and stops right after it has loaded, withcondition (!Allocate(layout, fresh_batch)) is trueatdescriptorHeap.cpp:55.bc934ef+ this PR (fork build, a merge of287b03bd8intobc934ef03and nothing else): the game gets past that point and into gameplay (comment, with screenshots).Pull request closed