Skip to content

docs(agc): say that a refused device allocation falls back to host memory before throwing - #8419

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
thuanquang:docs/debt-agc-allocation-host-fallback
Oct 24, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
thuanquang:docs/debt-agc-allocation-host-fallback

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

The AGC buffer allocations entry in docs/dev/debt/libSceAgcDriver.md ends with "allocation failure still throws when reclaim cannot satisfy the request". BufferPool::AllocateMemory now tries one more step before it throws: after the pool-trim retry and the texture-cache release, VK_ERROR_OUT_OF_DEVICE_MEMORY with a host memory type other than the refused one allocates in that host type and returns it (BufferPool.cpp:86-99 on main), before Check(result, details) at line 119. Only device buffers (Resources.cpp:183) and images (BufferPool.cpp:589, through TakeImageMemory) pass that host type; buffer slab blocks (BufferPool.cpp:268) and host buffers (Resources.cpp:98) do not, so they still throw. The "Host placement after a device-memory refusal" entry, two entries down since #8672 added "Storage-cache pressure and idle device buffers" in between, describes the placement. The clause now reads "allocation failure still throws when reclaim cannot satisfy the request, except for the device buffers and images that the "Host placement after a device-memory refusal" entry places in host memory". @harisibrar1 pointed out in review that the first version read as if every allocation could be placed in host memory.

Tested

Docs only; nothing was built or run. Checked on main by reading core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp:56-116 (main 02b5a8e55); the callers named above were read on main 865166414. Rebased onto main 11d6efa06c for the conflict with #8672 (merged) in docs/dev/debt/libSceAgcDriver.md: main's text is kept, and the clause now names the host placement entry instead of "the next entry", which #8672's new entry no longer is; the line numbers above were rechecked on that commit.

  • python tools/check_conventions.py --base origin/main with this title and body passes.
  • Not tested: behaviour on any machine; this changes text only.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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
PR 10472 docs/dev/debt/libSceAgcDriver.md L108

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7446 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7618 docs/dev/debt/libSceAgcDriver.md
PR 7642 docs/dev/debt/libSceAgcDriver.md
PR 7844 docs/dev/debt/libSceAgcDriver.md
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8223 docs/dev/debt/libSceAgcDriver.md
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8365 docs/dev/debt/libSceAgcDriver.md
PR 8542 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 8639 docs/dev/debt/libSceAgcDriver.md
PR 9348 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9393 docs/dev/debt/libSceAgcDriver.md
PR 9431 docs/dev/debt/libSceAgcDriver.md
PR 9432 docs/dev/debt/libSceAgcDriver.md
PR 9508 docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9672 docs/dev/debt/libSceAgcDriver.md
PR 9673 docs/dev/debt/libSceAgcDriver.md
PR 9674 docs/dev/debt/libSceAgcDriver.md
PR 9675 docs/dev/debt/libSceAgcDriver.md
PR 9676 docs/dev/debt/libSceAgcDriver.md
PR 9748 docs/dev/debt/libSceAgcDriver.md
PR 9842 docs/dev/debt/libSceAgcDriver.md
PR 9891 docs/dev/debt/libSceAgcDriver.md
PR 9892 docs/dev/debt/libSceAgcDriver.md
PR 9893 docs/dev/debt/libSceAgcDriver.md
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9898 docs/dev/debt/libSceAgcDriver.md
PR 9904 docs/dev/debt/libSceAgcDriver.md
PR 9905 docs/dev/debt/libSceAgcDriver.md
PR 9906 docs/dev/debt/libSceAgcDriver.md
PR 10193 docs/dev/debt/libSceAgcDriver.md
PR 10420 docs/dev/debt/libSceAgcDriver.md

@github-actions github-actions Bot added the docs label Oct 20, 2026

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against main:

  • BufferPool.cpp:86: the host fallback runs only for VK_ERROR_OUT_OF_DEVICE_MEMORY when a hostType was passed; host OOM and TOO_MANY_OBJECTS still go to Check(result, details) as before.
  • A hostType is passed only for device buffers (Resources.cpp:183) and images (BufferPool.cpp:171, via RefusedDeviceMemoryFallback). Buffer slab blocks (BufferPool.cpp:266) and host buffers (Resources.cpp:98) call AllocateMemory without one, so "throws when neither reclaim nor host placement helps" reads as if every allocation in this entry could be placed in host memory.
  • The next entry, "Host placement after a device-memory refusal", already gives the scope and limits. Suggest pointing to it with the scope, e.g. "...allocation failure throws after the reclaim retry, except that a device-local refusal of a device buffer or image is placed in host memory (next entry)", or dropping the change as redundant.
  • tools/check_conventions.py --base main --head pr-8419 passes.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@thuanquang

Copy link
Copy Markdown
Contributor Author

@harisibrar1 thanks, agreed. I pushed 0423fcd14: the clause now keeps the old "still throws when reclaim cannot satisfy the request" and adds "except for the device buffers and images that the next entry places in host memory", so slab blocks and host buffers read as throwing, as they do (BufferPool.cpp:266, Resources.cpp:98).

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked 0423fcd against main:

  • "still throws when reclaim cannot satisfy the request, except for the device buffers and images that the next entry places in host memory" matches the code: only device buffers (Resources.cpp:183) and images (BufferPool.cpp:171) pass a host type to AllocateMemory, while slab blocks (BufferPool.cpp:266) and host buffers (Resources.cpp:98) still throw after the reclaim retry.
  • tools/check_conventions.py --base main passes on this head.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
thuanquang and others added 2 commits October 24, 2026 07:59
…mory before throwing

Co-Authored-By: Claude <noreply@anthropic.com>
…mages

Co-Authored-By: Claude <noreply@anthropic.com>
@thuanquang
thuanquang force-pushed the docs/debt-agc-allocation-host-fallback branch from 0423fcd to c687e7e Compare October 24, 2026 01:02
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@adriadam10 adriadam10 self-assigned this Oct 24, 2026
@adriadam10
adriadam10 merged commit ca9543e into boykopovar:main Oct 24, 2026
10 of 11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the new clause against BufferPool.cpp (host fallback only for VK_ERROR_OUT_OF_DEVICE_MEMORY with a host type; slab blocks and host buffers still throw) and the "Host placement after a device-memory refusal" entry it points to; Conventions passes; merged.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants