Repository navigation
Upload staging shrinks back when it sits idle on iOS: the three slots no longer keep 192 MB of private GPU memory through steady play - #1491
Open
aksmith-git wants to merge 1 commit into
Conversation
… no longer keep 192 MB of private GPU memory through steady play Each upload slot kept its primary and overflow staging blocks for reuse, sized by its largest batch since the start (a scene load), so up to 192 MB stayed allocated for the rest of the run; the iPad's GPU out-of-memory report for Ocarina of Time listed them as private buffers, 224 MB. up_idle_release, at each submission's start: a slot no batch used for DM_NVN_UPLOAD_IDLE_MS gives both blocks back, an overflow block unused that long goes, and a primary block larger than the window's largest batch goes, so the next batch makes the smaller one. Default 2000 ms on iOS, 0 (never) on the Mac. A line every 30 s says what the slots hold. Ocarina of Time on an M4 Pro Mac, 5 minutes: 192 MB held at every 30-s line with 0, 0 MB in play with 2000 (36 releases, 46 blocks made against 19), GPU time the same. t_upload_idle checks both cases; t_upload_slots and t_upload_budget pass.
john62036203-ops
added a commit
to john62036203-ops/NXNativeWindows
that referenced
this pull request
Nov 6, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013SzykpcKm2eZPvPjGPKx1C
ivan-leschinsky
pushed a commit
to ivan-leschinsky/nxnative
that referenced
this pull request
Nov 9, 2026
… no longer keep 192 MB of private GPU memory through steady play Ported from seedds#1491 (open upstream) onto this branch: its own changes from its merge base with main, conflicts resolved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U35V38c6UYLbzyyPx6Up7P
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Each of the three upload slots keeps a primary and an overflow staging block for reuse, sized by the slot's largest batch since the start. That is usually a scene load, so up to 192 MB of private GPU memory stays allocated for the rest of the run. Ocarina of Time's GPU out-of-memory report on an iPad Pro (M5, Metal's working set 8,192 MB) lists them as
private buffers 8, 224 MB.up_idle_release(nvn_mtl.m) runs at each submission's start on the submit thread, which owns the slots. Per slot:DM_NVN_UPLOAD_IDLE_MS: both blocks go, and the next batch makes them again;A slot whose batch is still running is left alone, and
defer_obj_releasekeeps a block until the GPU is done with it. The default is 2000 ms on iOS and 0 (never) on the Mac, so the Mac is unchanged. A line every 30 s says what the slots hold.#1391's guard also lets go of the slots' staging, from 80% of the working set. This change is time-based instead and applies on iOS whatever the level. The two do not depend on each other.
Reference entry:
docs/reference/memory.md, "Upload staging keeps its largest blocks for the whole run", with its line in the symptom index and Ocarina of Time's note;DM_NVN_UPLOAD_IDLE_MSindocs/env_switches.tsv.Checked
check_t_upload_idle(new: three idle slots give their 32 MB blocks back at the next submission; slots that keep running small batches shrink their primary to 4 MB; every upload lands; Metal validation on),check_t_upload_slots(also withDM_NVN_UPLOAD_IDLE_MS=2000),check_t_upload_budget,test_docs.py,test_env_switches.py.make -C dm/host GAME=0400486024DEC000 dmhostbuilds on main 0f510fd;dm/ios/tools/compile_check.py(261 files, 0 failed).0400486024DEC000v131072), 5 minutes from a Kokiri Forest save in handheld mode on an M4 Pro Mac, on our stack (main 6121fd7 with other changes):DM_NVN_UPLOAD_IDLE_MSSubmit and present time in the last minute was 15-16 ms with 2000 against 10 ms with 0. A run with neither change also reached 13-15 ms there, so I can't tell a cost from the noise. Watch it on a device.
regress.pynot run: the Mac default is unchanged.Docs
docs/reference/memory.md, andpython3 dm/tools/docs_symptoms.pywas run