Skip to content

DM_POOL_BUDGET_MB makes textures up front against the residency set - #1498

Open
akshay4 wants to merge 1 commit into
seedds:mainfrom
akshay4:pool-budget-residency
Open

akshay4 wants to merge 1 commit into
seedds:mainfrom
akshay4:pool-budget-residency

Conversation

@akshay4

@akshay4 akshay4 commented Nov 6, 2026

Copy link
Copy Markdown

What and why

The pool walk makes the smallest textures up front while currentAllocatedSize is under a twentieth of the working set. That counter counts each no-copy buffer in full (50 over one 64 MB region add 3,200 MB, see #1482), so in Ocarina of Time it is over budget from the first load and nothing gets made up front. Those IDs read the dummy until a shader's read is noticed, which can show as textures filling in late.

DM_POOL_BUDGET_MB=<MB> compares against the residency set instead. Off by default, so nothing changes without it.

Entry added under the pool walk in docs/reference/memory.md.

Checked

  • Tests: check_t_pool_chunks, check_t_cpu_tex, test_docs.py, test_env_switches.py
  • Games run: Ocarina of Time 0400486024DEC000 v131072, same save and inputs, about 2 minutes each:
Default DM_POOL_BUDGET_MB=6000
IDs left out 3,274 698
Residency set 3,081 MB 3,285 MB
Frame time p50 14.1 ms 14.3 ms
GPU errors 0 0

Docs

  • Entry in docs/reference/memory.md, docs_symptoms.py run, row in docs/env_switches.tsv
  • No game files, keys or data extracted from a game

@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) docs Documentation labels Nov 6, 2026
The pool walk makes the smallest textures up front while currentAllocatedSize is under a twentieth of the working set. That counter counts each no-copy buffer in full, so in a game with many pools it is past the budget from the first load and nothing is made up front: those IDs read the dummy until a shader's read is noticed.

With the switch set, the walk compares against the residency set instead. It is off by default.

Checked: t_pool_chunks and t_cpu_tex. Ocarina of Time v131072 on an M6 Mac with 24 GB, same save and inputs, DM_POOL_BUDGET_MB=6000 against the default: IDs left out 3,274 to 698, 3,081 to 3,285 MB in the set, frame time p50 14.1 to 14.3 ms, no GPU errors. That run read the set's size at its last commit, on main 75c1a8c with other open PRs; this version reads it directly and has not been run in a game. Not tried on a smaller Mac or other games.
@akshay4
akshay4 force-pushed the pool-budget-residency branch from 490fbfa to 66cde28 Compare November 7, 2026 07:13
@akshay4

akshay4 commented Nov 7, 2026

Copy link
Copy Markdown
Author

Rebased on main, where pool_walk_limit became pool_room, so pool_have() is used there now. Re-ran t_pool_chunks, t_cpu_tex, test_docs.py and test_env_switches.py; still not run in a game. clang-tidy fails on main too, with the same findings.

cfryerdev pushed a commit to cfryerdev/nxnative that referenced this pull request Nov 8, 2026
…eedds#1498)

The pool walk makes the smallest textures up front while
currentAllocatedSize is under a twentieth of the working set, and that
counter counts each no-copy buffer in full, so in Ocarina of Time it is
over budget from the first load and nothing is made up front. The switch
compares against the residency set instead. Off by default.

Measured on Ocarina of Time v131072: IDs left out 3,274 -> 698, frame
time p50 14.1 -> 14.3 ms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants