Skip to content

fix(agc): reclaim idle buffers on allocation OOM - #2828

Closed
Sanjaysrinivas wants to merge 1 commit into
boykopovar:mainfrom
Sanjaysrinivas:fix/agc-buffer-memory-recovery
Closed

Sanjaysrinivas wants to merge 1 commit into
boykopovar:mainfrom
Sanjaysrinivas:fix/agc-buffer-memory-recovery

Conversation

@Sanjaysrinivas

@Sanjaysrinivas Sanjaysrinivas commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What

AGC buffer allocations can report Vulkan out-of-memory while the pool still holds idle buffers or empty slab blocks. Release that idle memory and retry the allocation once, only when actual VkDeviceMemory was freed.

Dedicated host buffers, device buffers and new host slab blocks share this recovery path. Live allocations remain retained. Other Vulkan errors, persistent OOM and failures with no reclaimable memory still throw. Failed allocation output handles are discarded. No new dependencies; the remaining memory limits are recorded in docs/dev/TechnicalDebt.md.

Rebased onto main 1e8fff68c8f6d3b67e38be584e15706a70c9d8bf. Refreshed the upstream implementation and searched existing PRs before publishing: no equivalent idle-buffer allocation recovery was found. Related buffer sizing/accounting work (#2233 and #2283) changes nearby code without implementing this policy. Depends on: none.

Tested

Windows, MinGW GCC 15.2, Release, BUILD_TESTING=ON. Vulkan execution used the RTX 4070 Laptop GPU with Khronos core validation enabled and Vulkan required.

  • The extended pool regression fails with "idle memory did not permit recovery" using main's production allocation files at 1e8fff68c8f6d3b67e38be584e15706a70c9d8bf; it passes after restoring and rebuilding this PR.
  • Coverage includes host/device OOM, dedicated allocations, new and empty slabs, partially live slabs with mapped data preserved, persistent failure, no reclaimable memory, device loss, first-attempt success and invalid failed-allocation handles.
  • Final selected CTest run: 26/29 passed (29.03 seconds). No selected checks skipped; no Vulkan validation errors were reported.
  • The three failures are agc_driver_prepared_shaders, _indirect and _uncached, each reporting "shader failure capture was incomplete". Rebuilt main's production allocation files in the same build/environment: all three fail identically. The recovery regression also fails on that baseline, while test registration passes. Restored this PR's files byte for byte, rebuilt, and repeated the selected checks.
  • Fresh native build, tools/check_conventions.py --base origin/main and git diff --check origin/main...HEAD pass. Linux was not tested locally.

The private game integration, runtime binaries and title assets were not changed by this publication. This generic fix does not establish gameplay, stable FPS or a bound on live images and other retained resources.

Checklist

  • Based on current main; no other open PR implements the same recovery policy
  • One topic per PR; follow-ups go in a new PR
  • No new comments in code
  • Unimplemented paths throw; allocation errors still throw when recovery fails
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@github-actions github-actions Bot added the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant