fix(agc): allocate oversized descriptor sets from a dedicated pool #1266

Merged
Celegans12 merged 1 commit from upstream-pr/1266 into main 2026-10-08 10:10:00 +00:00
Celegans12 commented 2026-10-07 20:30:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T20:30:47Z.


What

DescriptorCache::Allocate returns no set when a set needs more descriptors of one type than a chain pool holds (4,096 storage buffers, 1,024 sampled or storage images, 512 samplers). A build's own set falls back to a pool of its own, but PrepareDrawBindings has none and throws draw snapshot descriptor allocation failed, so the draw is skipped.

  • Such a set now gets a pool sized to it (maxSets 1, no FREE_DESCRIPTOR_SET_BIT), which Free destroys; the cache destroys any left at teardown. A build's set and each of its draw snapshots get their own.
  • Each type's count is first checked against the device's per-set limit for it (maxDescriptorSetSampledImages and so on); other types throw. Per-stage limits stay checked where ShaderResources plans bindings.
  • The [descriptors] profile line counts the dedicated pools.
  • PPSA26344 v1.008: with #757's image tables, the DRAW_INDIRECT with color target 0x5063bf0000 (over 16,000 sampled images) is skipped on every attempt, 36 times in 2,700 s.
  • Overlaps: #1184 also serves oversized sets in DescriptorCache::Allocate, by growing a new chain pool's count to the next power of two, and conflicts in that loop. #1201 and #1202 recycle draw-snapshot sets and fall back to vkFreeDescriptorSets, which a dedicated pool (no FREE_DESCRIPTOR_SET_BIT) must not take; they conflict next to dedicated, and #1199 next to this test's call. #1065 pads the chain pools against a RADV overrun in pools with FREE_DESCRIPTOR_SET_BIT; the dedicated pools are linear, which RADV bounds. #757-#759 and #920 add a DescriptorCache::Layout parameter and merge cleanly.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main c5e10184: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 396/396 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 395/395 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • New agc_driver_oversized_descriptor_sets (GPU): two 4,097-buffer sets get a pool each and a dispatch reads through one. Fails on main.
  • agc_driver_graphics: dedicated pool sizes, flags and Free, chain-sized sets, limit and type checks. Fails on main.
  • PPSA26344 v1.008: a 2,700 s run with this change has no draw snapshot descriptor allocation failed skips (409 without it); it made 628 dedicated pools, and the DRAW_INDIRECT into 0x5063bf0000 bound 16,386 sampled images and was recorded.
  • Not tested: Linux (CI), console behaviour.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4778113812 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1266). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T20:30:47Z. --- ### What `DescriptorCache::Allocate` returns no set when a set needs more descriptors of one type than a chain pool holds (4,096 storage buffers, 1,024 sampled or storage images, 512 samplers). A build's own set falls back to a pool of its own, but `PrepareDrawBindings` has none and throws `draw snapshot descriptor allocation failed`, so the draw is skipped. - Such a set now gets a pool sized to it (`maxSets` 1, no `FREE_DESCRIPTOR_SET_BIT`), which `Free` destroys; the cache destroys any left at teardown. A build's set and each of its draw snapshots get their own. - Each type's count is first checked against the device's per-set limit for it (`maxDescriptorSetSampledImages` and so on); other types throw. Per-stage limits stay checked where `ShaderResources` plans bindings. - The `[descriptors]` profile line counts the dedicated pools. - PPSA26344 v1.008: with #757's image tables, the `DRAW_INDIRECT` with color target 0x5063bf0000 (over 16,000 sampled images) is skipped on every attempt, 36 times in 2,700 s. - Overlaps: #1184 also serves oversized sets in `DescriptorCache::Allocate`, by growing a new chain pool's count to the next power of two, and conflicts in that loop. #1201 and #1202 recycle draw-snapshot sets and fall back to `vkFreeDescriptorSets`, which a dedicated pool (no `FREE_DESCRIPTOR_SET_BIT`) must not take; they conflict next to `dedicated`, and #1199 next to this test's call. #1065 pads the chain pools against a RADV overrun in pools with `FREE_DESCRIPTOR_SET_BIT`; the dedicated pools are linear, which RADV bounds. #757-#759 and #920 add a `DescriptorCache::Layout` parameter and merge cleanly. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` c5e10184: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 396/396 tests pass (`ctest --output-on-failure`) - Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, `VK_DRIVER_FILES`): 395/395 pass; `agc_driver_flat_store` is left out there because it takes several minutes on Windows llvmpipe - New `agc_driver_oversized_descriptor_sets` (GPU): two 4,097-buffer sets get a pool each and a dispatch reads through one. Fails on `main`. - `agc_driver_graphics`: dedicated pool sizes, flags and `Free`, chain-sized sets, limit and type checks. Fails on `main`. - PPSA26344 v1.008: a 2,700 s run with this change has no `draw snapshot descriptor allocation failed` skips (409 without it); it made 628 dedicated pools, and the `DRAW_INDIRECT` into 0x5063bf0000 bound 16,386 sampled images and was recorded. - Not tested: Linux (CI), console behaviour. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-07 20:40:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T20:40:03Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1315 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L1123, L1220, L2473-2474
#1318 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L1123, L1220, L2473-2474
#1364 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp L1189
#1366 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp L1189
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6046431642 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1266#issuecomment-6046431642). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T20:40:03Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1315 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L1123](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L1123), [L1220](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L1220), [L2473-2474](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L2473-L2474) | | | | #1318 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L1123](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L1123), [L1220](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L1220), [L2473-2474](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L2473-L2474) | | | | #1364 | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` [L1189](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L1189) | | | | #1366 | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` [L1189](https://github.com/boykopovar/AnyPS5/blob/915e3b753fe1975dd977e2a0108aa10a98afe1b9/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L1189) | | |
adriadam10 commented 2026-10-08 10:09:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T10:09:56Z.


Checked on the merge with current main: build + ctest 434/434, agc_driver_graphics and agc_driver_oversized_descriptor_sets pass (the latter ran for real on RADV, not skipped), both fail without the change, CI green on the head, no conflicts. Dedicated pool sizing/flags/Free, the per-set limit check and the unsupported-type throw are pinned by the tests. Merging.

The PPSA26344 numbers are the author's and not reproduced here. #1184, #1201 and #1202 touch the same Allocate code and will need a rebase on top of this.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6057571837 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1266#issuecomment-6057571837). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T10:09:56Z. --- Checked on the merge with current `main`: build + ctest 434/434, `agc_driver_graphics` and `agc_driver_oversized_descriptor_sets` pass (the latter ran for real on RADV, not skipped), both fail without the change, CI green on the head, no conflicts. Dedicated pool sizing/flags/`Free`, the per-set limit check and the unsupported-type throw are pinned by the tests. Merging. The PPSA26344 numbers are the author's and not reproduced here. #1184, #1201 and #1202 touch the same `Allocate` code and will need a rebase on top of this.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1266
No description provided.