Repository navigation
Textures under VRAM pressure: texture pool (#1562), batch-buffer pool (#1441), blurry instead of black, far copies shrink - #1759
Closed
crashoverride1995 wants to merge 4 commits into
Conversation
…PRESSURE_LEVELS) A first upload the card has no room for is made without its largest level or two; its levels come back once the card has room. Array views of one-layer textures are moved to the copy's levels too.
A host list kept the scratch buffers of its busiest recording for good (`batch_args` was only pushed to). With about 1,500 lists alive that was 12,719 buffers in eight minutes of play on an RX 7800 XT (16 GB) with VICTORY_INDIRECT_BATCH=1: 3.2 GB of the card by the system's count (256 KiB a buffer), past its budget, and 200 ms a frame on the card from there. No counter saw them, so nothing could let them go. Now a list gives them back when it is reset (every submission of it has run, and its last recording left them in the common state), and the next list to batch takes them, as scratch chunks and preludes already do. 512 are kept; more than that are retired. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KfgN1FfW7f4Zv2hqXUsNr2
… has no room (VICTORY_SHRINK_FAR)
1 task 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.
Includes #1562 (Mikael Järvinen) and #1441 (saltdam36). Their commits are in this branch unchanged, with their authors, and two commits of mine follow on top. Merging this merges all of them; the measurements below are of the whole set.
VICTORY_PRESSURE_LEVELSVICTORY_SHRINK_FARWhat it changes
On a card that is full, a texture the title picks by index that has no host copy yet waits for room, and draws black (or late, as pop-in) until it gets it. While driving on a 12 GB card the texture queue said "no room, new textures wait" in 70 % of its 5-second checks, with tens of thousands of slots held back every 5 seconds: black sign lettering, blank billboards, roads and leaves popping in late.
VICTORY_PRESSURE_LEVELS, default 2, 0 = off). When the card has no room, a first upload is tried without its largest level, then without its two largest: a quarter or a sixteenth of the bytes. The slot shows the texture at once, a little soft, instead of black. The smaller copy is tried first, so the 5-second first-upload window (shared by every slot of the pass) admits about four times as many textures, instead of a few large ones using it all up.want_levelgives the levels back once the card has room again; while it has none, a view of level 0 leaves the small copy as it is instead of sending it back to waiting.from_basenow movesTexture2DArrayviews of one-layer textures to the copy's first level too. Without that, a one-layer texture shown as an array by another slot named levels the copy no longer had, and the device was removed about 70 s into a drive.Hosted::reduced). A first version kept it in one table under one lock; every view looked it up, and that cost the submitting thread about 5 ms a frame.VICTORY_SHRINK_FAR, default on, 0 = off). Copies only ever grew: when the title's streaming moved a far texture's views to a smaller level, the host copy kept the large levels. Now, while the card has no room,want_levelremakes a copy without its larger levels once no slot shows them any more (lowest level over all slots,first_viewed). The room goes to textures near the player, and the copy grows back when a view asks for the levels and the card has room again.A new line every 5 s says how many textures are reduced, how many got their levels back, and how many copies shrank, of how many MB.
How it was tested
mainrun was longer (about 10 minutes) and started at night.cargo test -p victory-gpu --lib: all passed (including a new test: a texture made without its largest levels keeps them out while the card has no room, and gets them back with room).cargo clippyfinds nothing in the changed lines; it does fail on main already invictory-shader(an unused variable and a manual checked division inemit/lower.rs).Checked for overlap
Credits
held_only/want_level/from_base: the existing machinery that copies only the levels views show. This change builds on it.