[enhancement][memory] Central manager for video memory: stay under the card's budget without refusing textures #19

Open
opened 2026-12-03 16:54:28 +00:00 by Jesper-A · 0 comments
Contributor

What you would like

Re-filed from an earlier CodeFloe issue (that repo is gone; nothing was migrated, including its 18 comments).

One owner for the whole card memory budget: one figure for "in use" and one line to keep under, which every part that makes or moves card memory asks. The plan comes in small steps, each its own PR behind its own switch, off by default. Where main already does a step, the step is to test main.

This plan was first filed as an earlier issue ("One owner for the whole card budget") and then re-filed under this title; the text and the switches still call the manager "the owner" (DARNER_CARD_OWNER). Comments copied into the earlier issue are not repeated here.

Status, 2026-12-02. Steps 1a-1d, step 2 and a first version of steps 3 and 4 run on our branch, all off by default. The branch (17189c902) is on main 58a9c07a0 (40 commits; main has moved on since, not pushed as a PR). The played runs below are on this branch; the earlier runs are on earlier bases, named with each result.

  • Does it keep the card under its budget? With the script launcher's switches, where our 8 GB card is over its budget all the time, only the arm that also lowers cold textures (DARNER_CARD_OWNER_COLD=1) did: 0 % of memory lines over in 2 of 2 runs, against 100 % in 2 of 2 with the owner off. The other owner arms stayed at 100 %. (Two runs per arm, branch d5507f55e on main 972388856; provisional.) This did not hold in the first played runs with frame generation (FSR 3 x2, darner play's switches with a few named changes, one run per arm): on the same heavy route the card was over its budget in 41 of 238 readings with the owner off and in 50 of 243 with COLD. No benefit from the owner there (see the "Earlier discussion (ours)" section below).
  • With darner play's switches and with frame generation off, the card was already under its budget with the owner off, so the owner helped nothing there, and shared PC memory was about 0.2-0.5 GB higher on average with it on (10 scored runs). With frame generation on and a heavier route it can go over with the owner off too (the line above).
  • Cost (act = DARNER_CARD_OWNER=read,shadow,act; gate adds the drain gate and the PC-memory owner; COLD also lowers textures from 64 KiB up; details in the "Earlier discussion (ours)" section below). The owner arms ran at lower fps than off, but act and COLD also made 18-25 % more draws a frame on average (gate about 6 % more, and one of its two runs fewer than off), so the fps cost is unresolved. 89 % of the textures COLD lowered in the one run traced grew back. In the played run (one run, with the sampled marks on), with a counter of the reason, 2,241 regrowths were counted against 2,909 lowered, nearly all because a shader had read the texture again, not because of the "used" mark we suspected.
  • PC memory. Parking alone can run a 32 GB PC low: one run on our branch with DARNER_TEX_PARK=1 and the owner off had 631 MB of RAM free at its lowest. So the plan now prefers lowering quality over moving textures to PC memory. Details are in the "Earlier discussion (ours)" section below.

The code facts in this post were checked on b97efa767, after the texture and video-memory rework (merge 415f3d854), and have not been re-checked on today's main (nor against its newer park commits d8a3dec23, "play: DARNER_TEX_PARK_LESS_SETTLE=1 with frame generation on from the start", and 9c6fe0c71, "texture park: 16 GB cards no longer held back twice with frame generation"), so line numbers and limits may have moved. Main has since restarted its history (02c896968). Measurements keep the names they ran under (VICTORY_*, victory play); main's are now DARNER_* and darner play.

Who it affects. We measured on 8 GB cards. Two earlier GitHub reports, now gone, showed 12 GB cards under pressure too: 10.9 of 12 GB in use with heavy stutter (Series X profile, DLSS frame generation), and a crash report titled "exceeding 12GB VRAM" with no figures. Skanzinho's 12 GB card lost the device at about 1.5 minutes with 356 MB of RAM free on a 32 GB PC (DARNER_KEEP_RAM_GB=22 and a 6 GB card limit, v2026.12.01.02), and ran 16 minutes clean without them; one run each, and more than that differed (earlier comments, not copied here). On a 24 GB card the old fixed park target left the card unused instead (an earlier issue on the old host, not re-filed). Ray tracing, frame generation and higher resolutions may reach the budget sooner on any card (not measured).

Goals

  1. Stay under the card's budget on any card, without leaving the card unused.
  2. No refused textures, so no gray, white or black stand-ins (refusals are the likely cause, not proven): degrade instead (park in PC memory, fewer levels).
  3. Fewer memory stalls: fewer refusals, re-asks and readings.
  4. One figure for "in use" that every memory class agrees on, used both to let memory in and to move it out.

Predicted benefits. Each is "measured" (build, date) or "estimate" (why).

  • Under the budget. Measured, 2026-12-01, test build v2026.12.01.01-test, victory play (the park), 28 minutes: over the budget in 0 % of 916 memory lines, always at least 501 MB under. The old main's memory defaults on our fork's build, 31 minutes: over in 10 % of 1,097 lines, by up to 314 MB, from about 3 minutes in. Not like for like (another exe; the test build started with an empty pipeline cache), and both runs are before b97efa767: main itself was not run. The owner's line should also cover the script launcher's path, which went over on an older build ("Two launch paths"): estimate, not measured.
  • Card not left unused. Measured by untried844 in an earlier issue, 2026-12-01, test build, RTX 4090 24 GB (step 1b): at the fixed 9,600 MB target, 12.6 GB was parked and about 10 GB of the card sat unused; at 20,000 MB the card filled (17.4 GB in use) and about 1.9 GB was parked. On main (37ff585), with its nine tenths, untried844 measured on a later save (an earlier comment, not copied here): three runs of 12-23 minutes, no device loss, over the budget in 0 of 704, 445 and 839 memory lines, card use 19.8-20.2 GB, and 1.2-7.1 GB parked at the end. So the card fills, but on a late save several GB can still be parked, not at most 1.9 GB.
  • Fewer refusals. Measured, the same two runs: first-upload refusals fell from 20,346,515 to 45,324, with 1,290 MB parked in PC memory at the end. Card blocks were still refused while under the budget ("What is still missing"). Estimate: one line and one figure should stop that, since separate lines below the budget refused them. Not measured for card blocks. For first uploads the played run with frame generation shows no improvement: the owner refused all of them, and main's own rule would have refused about 90 % of the same asks (see the "Earlier discussion (ours)" section below).
  • Fewer stalls. Not measured; no fps or frame-time gain is claimed. untried844's freezes stayed when the target changed (an earlier issue on the old host, not re-filed). Step 1a's debounce cut DXGI readings in the world from a median of 24 to 15 a second (measured, fork, 2026-12-01), but a reading costs a median 546 ns to 1.1 µs (idle desktop, one run), so that buys consistency, not CPU time.
  • One figure. Measured, 2026-12-01, old main 5fabb46ea with step 1a: the shared estimate was within 1 MB of DXGI in 95 % of 316 lines. That shows only that the estimate tracks DXGI, not that every class agrees. Estimate: one sum for letting in and moving out removes the gap of about 350 MB in step 1d (needed but not enough).

What main already does (read in its code).

  • The texture park (VICTORY_TEX_PARK=1, on in victory play): a texture with no card room is made whole in PC memory instead of waiting behind a gray stand-in (target: step 1b).
  • Off by default: VICTORY_TEX_PARK=2 moves the least-used card copies to PC memory, emptiest block first, and back when there is room; VICTORY_DEMOTE=1 drops two levels from long-unused textures. Both work without the texture-use marks, but then DEMOTE keeps the textures shaders pick by index.

What is still missing (our reading of main). There is no single owner.

  • About 15 separate lines decide card room: the texture queue (80/86 % of the budget, or budget − max(768 MiB, budget/20)), first uploads (a 512 MiB margin and two more bounds), buffer copies (97 % or the queue's line), card windows (80 %), buffers made ahead (70 %, 95 % in the script launcher), slot eviction (85 %), spare blocks (85 %), the UAV pool (88/95 %), the park target, the render-target reserve and more.
  • Each reads DXGI itself: Host::video_memory (host.rs, 44 call sites in 21 files) asks QueryVideoMemoryInfo twice (card and shared) on every call, with no cache and no budget-change event.
  • They measure "use" differently. The texture queue and slot eviction weigh DXGI use, minus free space in texture blocks, plus the room kept for buffers and render targets; buffer copies, the park's moves and compaction weigh raw DXGI use. So two parts can disagree about whether the card is full, and the park lets textures in on one sum and moves them out on the other.
  • What this cost on the test build (the runs under "Predicted benefits"): card texture blocks stopped at 46 (2,944 MB) three minutes in and stayed there. 79,859 card blocks were refused over 36 park periods, all while the card was under its budget. The texture queue's line (80 % of the budget with frame generation, 5.4-5.6 GB) said "no room" in all 288 of its lines in the world.

Two launch paths on cards with a budget of 8 GiB or less.

  • victory play (the menu launcher): park on, tiled levels off (LEVELS_ON_DEMAND=0), POOL_SMALL=0.
  • scripts/play-nvidia.ps1 (the script launcher): LEVELS_ON_DEMAND=auto (tiled levels on at this budget) and POOL_SMALL=1. Tiled levels switch off the park, SMALL_WHEN_FULL and TEXTURE_QUALITY for those textures. As before the rework, a refused texture waits about 4 s behind a gray stand-in and is asked again. The 512 MiB first-upload margin still refuses there (its log line: "refused by an explicit byte limit").
  • An older build (v2026.11.29.02, before the rework; n=3 against 3, other switches differed too): with tiled levels and POOL_SMALL on, runs uploaded 18.9-21.5 GB and ended at 7.8-8.4 GB card use against a budget of about 7.1 GB; with both off, 2.0-2.4 GB and 6.6-6.7 GB. The script launcher still sets both, so this may still apply; it needs a fresh run on main.

Another 8 GB card. CuteBooty's RTX 3070 8 GB (a whole 28-minute campaign mission, v2026.11.30.01 with mcozcan's compaction, DLSS frame generation x2) stayed under its budget, but the margin fell from 869 MB to 22 MB, render-target copies grew from 1.34 to 1.61 GB, all still held, and texture blocks grew from 2.75 to 3.2 GB while 481-835 MB sat free inside them.

What others do. One count of what is held, and one line under the OS budget. Dawn caps its D3D12 use at 95 % of the OS budget minus its own outside reservation (Dawn source). Unreal's DX12 back end aims at 90 % of it, to allow for fragmentation (Epic forum thread quoting UE 5.6). D3D12MA and VMA cache the budget, count what they make and free, and ask the OS again after 30 allocation or block operations (VMA also each frame, vmaSetCurrentFrameIndex). Over budget, Unreal's texture streamer drops one mip at a time until the plan fits, least recently seen unseen textures first, and DXVK (Vulkan, discrete cards) retries a refused card allocation in system memory. The park is the DXVK answer, DEMOTE the Unreal one.

How to read the data lines. Each "Data" line gives its date and build. All are from our card unless a name is given, and from before the rework unless the build is the test build. "Fork" is our fork's diag build on upstream v2026.11.30.02 with opt-in ports. "Our settings" means our launcher's memory switches, not main's: POOL_SMALL=0, SLOT_EVICT=0, TEXTURE_KEEP_FREE_MB=0, ROOM_BY_BLOCKS=1, CARD_ROOM_FOR_TARGETS_MB=1280. "Old-main defaults" is the same exe with the old main's script-launcher memory switches (POOL_SMALL=1, SLOT_EVICT=1, the rest unset). Single sessions, not repeated.

Proposed steps. A ticked item is on main and was checked in its code; each item says where.

  • Step 0. Count first.
    • cardledger.rs on main, from Remorce's ledger PR, applied as e2675de0d: card bytes by kind, frees counted, a 5 s summary by default (DARNER_CARD_LEDGER=0 turns it off; our test report was an earlier comment, not copied here). It "only counts and logs; nothing is decided from it"; step 1 would make it the owner's ledger.
    • Our per-block census: our fork only, a diagnostic for measuring here (38 ms a pass, so not for upstream).
  • Step 1. One owner that works with the park, not instead of it. It gives the park, DEMOTE and slot eviction one figure and one line.
    • 1a. One shared reading. Our change, behind a new switch VICTORY_CARD_OWNER=read (off): DXGI is asked at most once a frame and never twice within 16 ms; the budget-change event wakes a reading, debounced, and budget moves under 128 MiB are ignored; between readings, use is estimated from texture blocks and committed textures made or freed, as D3D12MA and VMA do; a card owner: line once a second logs the reading, the estimate and its error. It folds in andrewpozdnakov7-jpg's race fix and follow-up commit, under his name. Our GitHub PR (branch up-card-read) was closed with a request to rewrite it on the new main. The rewrite is implemented on our branch (as DARNER_CARD_OWNER=read), not yet a PR. The host.rs size question (an earlier issue) is settled: main lists the file as an exception (55722bd9b).
      • Data, 2026-12-01, fork (79 sessions): DXGI moved the budget every 2-30 s after loading, 95 % of the moves under 100 MB. The 128 MiB band comes from that.
      • Data, 2026-12-01, fork with the reader, two sessions of ~25-28 minutes, FSR 3 frame generation: without the debounce, the budget-change event forced 157,490 readings (in the world a median of 24 a second, p95 153, max 496; worst one-second estimate error 337 MB). With it: 113,686 wake-ups for 19 budget moves past the band; in the world a median of 15 readings a second (p95 17), estimate error at most 31 MB at a reading and 271 MB in any period. The loading screen (260-1,324 fps) still reached 1,491 readings a second, hence the 16 ms floor.
      • Data, 2026-12-01, old main 5fabb46ea + our 1a PR, read, no frame generation, an 81 s load then ~7 minutes standing: at most 63 readings a second on the loading screen for up to 2,349 asks a second; in the world a median of 17.6 a second at 18.3 fps, so one a frame. Estimate within 1 MB in 95 % of 316 card owner: lines, at most 67 MB; the largest drift, 219 MB, came in the second the budget fell from 7,221 to 6,671 MB. 6,267 event wake-ups for 2 budget moves. No panic or device removal; four shots looked normal. Not run with the switch off.
      • Data, 2026-12-01, kraiy404 on our 1a PR (RTX 4060 Ti 8 GB, Series S and Series X, DLSS frame generation): 91,430-261,928 event wake-ups for 2 budget moves per run.
      • Data, probe on an idle desktop (no game, one run): QueryVideoMemoryInfo takes a median 546 ns for one memory group, 1,102 ns for both.
    • 1b. One line from the card's own budget. Main's park target does this since b97efa767 (data below). The owner's line should be that same figure, not a second one. Our earlier line (budget − max(512 MiB, budget/16), about 93 % on 8 GB) gives way to it.
      • Data, 2026-12-01, v2026.12.01.01-test, untried844 in an earlier issue (RTX 4090 24 GB, Series X, 1440p, DLSS Balanced, ray tracing off): the fixed 9,600 MB target (budget 23,370 MB) parked 12.6 GB of textures in PC memory and left about 10 GB of the card unused. At 20,000 MB, set by hand, the card filled and about 1.9 GB was parked, but the freezes and a purple fringe around characters stayed. Main b97efa767 now uses nine tenths of the budget, or of the player's limit where that is lower.
      • Data, 2026-12-02, untried844, same card, a later save, DLSS Quality (earlier comments, not copied here: the test build and main 37ff585): the test build at 20,000 MB filled the card and still parked 8.7 GB, and lost the device in both sessions; main at its nine tenths (19,798-20,351 MB) ran three sessions without a device loss and parked 1.2-7.1 GB.
    • 1c. Fresh readings. Mostly done on main: the texture pass reads DXGI again every 32 MiB uploaded, and the park takes 64 MiB off its headroom per card block made between readings. What is left is counting frees, which the ledger already does.
    • 1d. Every class asks the owner, and the owner moves memory out on the same figure it lets memory in on: the sum the texture queue and slot eviction already weigh (see "What is still missing"), not raw DXGI use as the park's moves do today. Our own owner on the old main had the same split: it refused textures about 350 MB under its line, because letting in counted the kept room and moving out didn't. Implemented on our branch (DARNER_CARD_OWNER=read,shadow,act), not yet a PR; later results in the "Earlier discussion (ours)" section below, first results in an earlier comment, not copied here.
      • Data, 2026-12-01, fork, old source, a same-sum drain: refusals began at 18:45:54Z; the drain switched on and off, and from 18:47:10Z (6,127 MB against a line of 6,123 MB) stayed on to the end of the log. In the next 41 s, slot eviction (with SAMPLED_EVICT=pressure) let go 677 more textures, but only 49 MB, and card use stayed at 5,840-5,873 MB. No idle render-target copy was free to go: about 100 were idle (280-400 MB), all held by a list or a slot. Textures stayed refused (118,000-187,000 refused asks per line at first, 9,000-94,000 in the last three), and so did the white stand-ins.
      • So one line and a same-sum drain are needed but not enough: the owner also needs a drain that moves whole textures, including ones shaders pick by index, without the use marks.
    • The owner drains through what main has: it sets the line and drives the park's moves (TEX_PARK=2) and DEMOTE. The use marks cost about 10 ms a frame on an RTX 3090 at 1440p (main's play.rs: 62.8 against 52.1 ms), so victory play has them off (SAMPLED_MARKS=0).
  • Step 2. Render-target copies under the same line. On main, render targets are still made with no room test; the texture queue keeps room for them instead (targets_room_kept, up to 2.5 GiB at a budget of 8 GiB or less).
    • nidea1's dead render-target reclaim (merged on GitHub before the move) is on: every 5 s, not tied to the budget.
      • Data, 2026-12-01, fork (which has it), two sessions: "render targets and written textures" still grew from about 1.3 GB at ~5 minutes to 1.5-1.6 GB by ~35 minutes, peak 1.65 GB at ~42 minutes.
    • Its slot-pinned path still frees nothing (a fix, letting the copy go after the lists finish, is implemented on our branch, not yet a PR). The slot is made null through retire_resource, which keeps a COM reference until running lists finish, and the same call then demands references(&host.texture) == 1 (resource.rs:5027; descriptor/host.rs:5248). That was bug 1 in nidea1's follow-up fix PR on GitHub (closed for a rewrite); a smallest version on main is bug 1 plus the slot path's unmapped check. Two of its other fixes are partly on main.
    • Shared render targets (ALIAS_TARGETS=2, about 0.8 GB) were on in the test build and are off again on main after testers saw streaks and halos (c7f736c06). This class has no other lever on main.
    • Idle copies a command list or slot still holds: the open part (347 MB of 1,523 MB on old-main defaults).
      • Data, 2026-12-01, fork, our settings, ~28 minutes: of 1,628 MB of copies at the end, 590 MB in use, 555 MB idle but held by a list or slot, 0 MB idle and held by nothing, 482 MB kept whole (depth, MSAA, twins, aliased, tiled). On CuteBooty's 3070 the unheld class was 0 too. On old-main defaults, copies a newer target took over were 48 MB, against 385 MB of idle copies nobody took over. So letting go unheld or taken-over copies has little to act on here.
      • Data, probe on an idle desktop (no game, one run): Evict() of 8 heaps of 64 MiB cut DXGI's card use by 512 MB at once, even over budget, and MakeResident() restored it at once. A heap at MINIMUM residency priority still counted in full, so priority only orders what Windows moves out. A GPU read of an evicted heap removes the device, so Evict() suits only objects nothing references. Not shown: the cost of MakeResident() after a real page-out.
  • Steps 3 and 4. Release and pack by block. DXGI charges whole heaps, so letting textures go helps only when it empties a block. A first version (cold and warm blocks under the owner, DARNER_CARD_BLOCKS=1) is implemented on our branch, not yet a PR; its first run found a bug (an earlier comment, not copied here).
    • The first part of mcozcan's compaction PR is on main and on by default (VICTORY_COMPACT_SPARSE, merge 8dd9dad2a (8dd9dad2a)). It acts only when DXGI use is over the budget or PC commit is short. Our 8 GB run with the park never went over the budget, so it never fired; it may need the owner's line as its trigger.
      • Data, 2026-12-01, fork with the PR ported, our settings (slot eviction off): in 35 minutes it let 4,299 idle textures (557 MB) go and freed no block; texture blocks stayed at 3,968 MB with up to 1.7 GB free inside. In a 24-minute session it let 6,776 textures (721 MB) go and emptied 0 blocks; almost no new pieces were cut into nearly empty blocks, so refilling was not the cause. In a third, each of 13 passes let go 0-18 MB while free space in blocks rose from 845 to 1,472 MB.
    • The same PR's whole-block rule (COMPACT_WHOLE) is not on main. TEX_PARK=2 already picks the emptiest block first.
      • Data, 2026-12-01, fork: with our settings, 4 or more blocks would have emptied if the cold index-picked textures went in 0 of 45 lines; blocks grew from 50 to 62, 1 emptied. On old-main defaults (31 minutes) it was 45 of 60 lines; blocks went from 54 to 41, 16 emptied and 13 were let go. So how small textures are placed decides whether release can empty blocks.
      • Data, probe: destroying 8 heaps of 64 MiB lowered DXGI's use by 512 MB at once, also over budget, so an emptied block pays off at once.
    • Release cold textures that shaders pick by index. mcozcan's pressure mode for slot eviction (a GitHub PR, closed for a rewrite) did that, but it needs SAMPLED_MARKS=1, which victory play sets to 0, so as written it would do nothing there. A new version needs a reason to turn the marks on, or a trigger without them. Whether to rewrite either of mcozcan's PRs on the new main is mcozcan's call.
      • Data, 2026-12-01, old-main defaults, 31 minutes: slot eviction let go 5 textures (1 MB), all in the first 6 s. At its last look 15,297 of 16,234 idle-looking textures were in slots shaders pick by index, which main leaves to SAMPLED_EVICT (off). 530 MB of them had no shader read within their idle time at the end (1.4 GB at 1 minute).
    • Ignore periods with no draws, such as menus.
      • Data, 2026-12-01, fork, our settings: in menus no shader reads, so hot slot bytes fell to 33-59 MB and 40-53 blocks (2.5-3.4 GB) looked releasable. Releasing them would only remake it all on resume.
    • Reuse a released piece only after the last submission that used it has finished (a GitHub PR by nidea1, closed for a rewrite). Main rests a piece 2.5 s instead (pool.rs:308-311), and upload-ahead takes any texture made in a block in the last second, new or reused place alike (texture/ahead.rs:248). Not tested whether the hazard shows.
  • Step 5. Degrade, never refuse. Done in victory play by the park. Still open on the script launcher's tiled path on 8 GB (see "Two launch paths").
    • Data, 2026-12-01, fork, our settings, 52 minutes with VICTORY_TEXTURE_BUDGET_MB=2500: the cap is compared with all host textures on the card (4,631 MB at the end), so once they passed it, first uploads were refused (154,114 in the last log window). White and black textures were seen (refusals the likely cause, not proven), and use was still 8,638 MB against a 7,080 MB budget: a cap that refuses is not a degrade.
  • Step 6. Fewer levels for cold textures. VICTORY_DEMOTE=1 exists (off): test it before building anything. TEXTURE_QUALITY is not this step: it cuts levels from large textures for the whole run, used or not, and does nothing under tiled levels.

Our 8 GB port (warpGTAIV's VIctory-8GB policy, on our fork) is mostly not on main: 64 MiB texture blocks only, no 1 GiB card windows below an 8,192 MiB budget, no budget/3 texture line, no buffers-first rule. Its textures-outside-blocks mode works against the park, and upstream's loading-crash fix (console_insn.rs) supersedes its own. Anything from it would come as fresh single PRs.

Related work and credit. The steps build on what is merged: the 512 MiB first-upload margin, slot eviction, nidea1's render-target reclaim, the park, Remorce's ledger (step 0), Lyrnc's commit floor (merge b0335dff8: a lower texture line while PC commit is under 4,096 MB, VICTORY_TEXTURE_COMMIT_FLOOR_MB) and an earlier version of the first commit of nidea1's host-written-records PR (merge ae5d78f38). The GitHub PRs below are gone; I'll link any that is re-filed here.

  • Closed on GitHub with a request to rewrite on the new main: our step 1a PR, nidea1's reclaim fixes and piece reuse, and mcozcan's two PRs (all in the steps above), plus six more by nidea1 (three), Trillazill, 1mosce and AirKyzzZ, listed in an earlier comment, not copied here, with what each still means.
  • Open on GitHub at the takedown: an idle-sweep and dynamic-reserve PR, two texture block-size PRs, a PR keeping the shown texture (KEEP_SHOWN=2 is on in victory play), and nidea1's early-Z with sampled marks.
  • Also: Remorce's tested collection of memory PRs and switches (a GitHub discussion), the maintainer's feedback thread for the test build, and data from CuteBooty, eipastel, guyansong24, kraiy404 and others in the GitHub thread and from untried844 here (an earlier issue on the old host, not re-filed).

Spec dependence

  • Likely general: one figure and one line for every class, and the same sum for letting memory in and moving it out; the budget-change event waking far more often than the budget moves; cold and hot textures sharing blocks.
  • May depend on our specs: every number above is ours unless named, from one RTX 2070 SUPER 8 GB (Turing), driver 621.40, Resizable BAR off, Ryzen 7 5800X, 32 GB RAM, Windows 11, Series S, DLSS Performance, FSR 3 frame generation. The GPU clock state was not the same across these runs (locked at 1890 MHz on some days, unlocked on others), so no fps claim is made across runs.
  • Measured by others: Skanzinho's RTX 4070 SUPER 12 GB on v2026.12.01.02 (Series S, DLSS Performance, DLSS frame generation x2); CuteBooty's RTX 3070 8 GB and kraiy404's RTX 4060 Ti 8 GB (Series S and X), both with DLSS frame generation, on GitHub; untried844's RTX 4090 24 GB at Series X, on the test build (an earlier issue on the old host, not re-filed) and on main 37ff585 (earlier comments, not copied here).
  • Untested: AMD, 16 GB cards, the owner on any card but ours, the owner with DLSS frame generation (FSR 3 x2: one played run), Series X on our card, ray tracing.

Earlier discussion (ours). Our own comments from the earlier issue that are saved locally, summarised. Other people's comments are not copied; where this post names one of them, it is by name.

Correction, 2026-12-02: three played runs with frame generation show no benefit from the owner. Build: our branch 17189c902 (40 commits on main 58a9c07a0), diag build. Played by hand by one person, the same save, 6 minutes in the world each, one run per arm, in this order: (1) owner off, lighter route; (2) COLD (DARNER_CARD_OWNER=read,shadow,act + DARNER_CARD_OWNER_COLD=1), heavy route; (3) owner off again over run 2's heavy route (same route by the player's words). All three: Series S, DLSS Performance, FSR 3 frame generation x2, mouse and keyboard, darner play's switches set through the script launcher with DARNER_SAMPLED_MARKS=1, DARNER_AMBIENT_SPECULAR=1, DARNER_SLOT_FLIPS=1 and DARNER_PC_OWNER=read. The switch lists differ only in the two owner switches; the player also changed two F1 settings (DARNER_SHARPEN, DARNER_PANEL) during the series.

  • Not run: COLD with moves to PC memory (RAM_TIGHT), COLD with the stricter mark, every repeat. No settle run: four tries were each ended by our free-RAM guard (about a minute in; free RAM 628, 577, 640 and, for the fourth after a rule change to "10 seconds in a row under 700 MB, or at once under 300 MB", a lowest of 422 MB). That rule then held for every run of the series, the same for both arms, set before any scored run. A 942-second preload stands in for the settle run; we have not checked that it is equal. A first played try (owner off, 209 MB free 11 seconds into the world) was stopped and not scored.
1: off, lighter route 2: COLD, heavy route 3: off, heavy route
readings over the budget 0 of 244 50 of 243 (36 by more than 50 MB, at most 159) 41 of 238 (none by more than 31 MB)
card use, highest 6,855 MB 7,148 7,020
shared PC memory, highest 5,754 MB 6,928 6,573
committed, highest 22,896 MB 24,508 23,804
lowest free RAM 1,158 MB (after the window was closed) 1,669 MB 771 MB (after the window was closed)
fps, average (rendered) 14.8 13.4 17.3
draws a frame, median 6,132 8,223 6,897
  • No benefit from the owner here: it did not keep the card under its budget (the highest card use of the three is the owner's run). Run 1 was never over, so it says nothing either way. No fps verdict: runs 2 and 3 differ by 19 % in draws a frame, and it is one run each. Free RAM was never under 700 MB. No crash, device loss or guard stop.
  • Picture (the player's notes): white trees and rainbow road markings in runs 2 and 3, "about the same"; rainbow road markings also in run 1; less stutter with the owner off. White trees came with the owner off too, so we don't blame them on the owner.
  • A fault in the owner with frame generation, read in the code and seen in one log. The launcher sets DARNER_TEXTURE_ROOM_PERCENT=80 with frame generation, and the owner's target is the smaller of its own line and 80 % of the budget (5,591 MB of 6,989 here). But its drain may run only once DXGI's own reading is within about 64 MB of the budget. So the owner's sum was over its line in all 241 readings from 20:09:49Z on (5.8-7.4 GB against 5.5-5.8 GB) and it refused every first upload (0 allowed, 495,028 asks refused), while the drain was held back until 20:13:14Z. After that it ran in 78 of 243 readings, gave up 9 times, and lowering freed 661 MB in the whole run. This does not make all 495,028 refusals the owner's doing: main's own rule, worked out beside it, would have refused 444,752 of the same asks. In run 3, with the owner off, main's rule refused 278,306 and allowed 9,925; the routes differ, so the totals are not a comparison.
  • Why textures grow back. In run 2 COLD lowered 2,909 textures (659 MB in the ten-second lines) and 2,241 regrowths were counted (77 %, not necessarily different textures). The reason counter says a shader had read the texture again 2,139 times, the "used" mark 120 times (a texture can count under both). So the stricter mark would change little on that run.
  • What comes first now: test the small-card headroom by DonatelloCANNCAN (aa2bd4b6a, on main; it applies only when the budget is under 7.5 GiB and DARNER_VRAM_BUDGET_MB is not set) with the owner off, on against =0, on the heavy route; whether the owner is still needed on 8 GB after it is open. Every number here is one played run per arm, no settle run, one 8 GB card; GPU clock state not recorded for these runs.

Related: #1 (open, same reporter as the small-card change: RTX 4050 Laptop 6 GB, frame generation leaves textures 1.4 GB). Same area as the TEXTURE_ROOM_PERCENT=80 frame-generation line above; not a duplicate.

Are you working on a fix?

Yes, I'm on it, on our 8 GB card. DARNER_CARD_OWNER and DARNER_CARD_BLOCKS are off by default; with act the owner also turns on DEMOTE unless DARNER_DEMOTE=0. First: test the small-card headroom by DonatelloCANNCAN (aa2bd4b6a on main, now in main 4a92569fb; it applies only when the budget is under 7.5 GiB and DARNER_VRAM_BUDGET_MB is not set; 512 MB, DARNER_SMALL_CARD_HEADROOM_MB) on our card with the owner off, on against =0. It aims at the same thing on 8 GB, so it may decide what of this plan is still needed there. Then:

  1. Find out why lowered textures grow back: a counter of the reason, and a stricter "used" mark (DARNER_USED_STRICT). Committed (17189c902) and built. The counter has run in one game run (above); the stricter mark has not been switched on in any.
  2. Stop the owner from moving more to PC memory while RAM is short (DARNER_RAM_TIGHT). Committed (17189c902) and in the build the played runs used, but not switched on in any run. With it on, buffers the owner refuses ask the PC-memory owner first (so far they go to PC memory with no RAM check; untested). One known gap is left: the PC-side line does not count a working-set minimum (DARNER_KEEP_RAM_GB).
  3. A run series with parking on was planned as owner off, COLD only, COLD with moves to PC memory, and COLD with the stricter mark, two runs each. Run so far, played by hand: off, COLD only, off again. The other arms and the repeats were not run. First the owner's line with frame generation has to be made to agree with when its drain may run (see the "Earlier discussion (ours)" section below).
  4. Draft PRs here, one step at a time, once a step has shown it helps.

If you are already on one of the steps, please say so here so we don't duplicate it. Runs on other cards are very welcome.

Drafted with AI assistance (Claude Code).

### What you would like Re-filed from an earlier CodeFloe issue (that repo is gone; nothing was migrated, including its 18 comments). One owner for the whole card memory budget: one figure for "in use" and one line to keep under, which every part that makes or moves card memory asks. The plan comes in small steps, each its own PR behind its own switch, off by default. Where main already does a step, the step is to test main. **This plan was first filed as an earlier issue ("One owner for the whole card budget") and then re-filed under this title; the text and the switches still call the manager "the owner" (`DARNER_CARD_OWNER`).** Comments copied into the earlier issue are not repeated here. **Status, 2026-12-02.** Steps 1a-1d, step 2 and a first version of steps 3 and 4 run on our branch, all off by default. The branch (17189c902) is on main 58a9c07a0 (40 commits; main has moved on since, not pushed as a PR). The played runs below are on this branch; the earlier runs are on earlier bases, named with each result. - **Does it keep the card under its budget?** With the script launcher's switches, where our 8 GB card is over its budget all the time, only the arm that also lowers cold textures (`DARNER_CARD_OWNER_COLD=1`) did: 0 % of memory lines over in 2 of 2 runs, against 100 % in 2 of 2 with the owner off. The other owner arms stayed at 100 %. (Two runs per arm, branch d5507f55e on main 972388856; provisional.) **This did not hold in the first played runs with frame generation** (FSR 3 x2, `darner play`'s switches with a few named changes, one run per arm): on the same heavy route the card was over its budget in 41 of 238 readings with the owner off and in 50 of 243 with `COLD`. No benefit from the owner there (see the "Earlier discussion (ours)" section below). - **With `darner play`'s switches** and with frame generation off, the card was already under its budget with the owner off, so the owner helped nothing there, and shared PC memory was about 0.2-0.5 GB higher on average with it on (10 scored runs). With frame generation on and a heavier route it can go over with the owner off too (the line above). - **Cost** (`act` = `DARNER_CARD_OWNER=read,shadow,act`; `gate` adds the drain gate and the PC-memory owner; `COLD` also lowers textures from 64 KiB up; details in the "Earlier discussion (ours)" section below). The owner arms ran at lower fps than off, but `act` and `COLD` also made 18-25 % more draws a frame on average (`gate` about 6 % more, and one of its two runs fewer than off), so the fps cost is unresolved. 89 % of the textures `COLD` lowered in the one run traced grew back. In the played run (one run, with the sampled marks on), with a counter of the reason, 2,241 regrowths were counted against 2,909 lowered, nearly all because a shader had read the texture again, not because of the "used" mark we suspected. - **PC memory.** Parking alone can run a 32 GB PC low: one run on our branch with `DARNER_TEX_PARK=1` and the owner off had 631 MB of RAM free at its lowest. So the plan now prefers lowering quality over moving textures to PC memory. Details are in the "Earlier discussion (ours)" section below. The code facts in this post were checked on b97efa767, after the texture and video-memory rework (merge 415f3d854), and have **not** been re-checked on today's main (nor against its newer park commits d8a3dec23, "play: DARNER_TEX_PARK_LESS_SETTLE=1 with frame generation on from the start", and 9c6fe0c71, "texture park: 16 GB cards no longer held back twice with frame generation"), so line numbers and limits may have moved. Main has since restarted its history (02c896968). Measurements keep the names they ran under (`VICTORY_*`, `victory play`); main's are now `DARNER_*` and `darner play`. **Who it affects.** We measured on 8 GB cards. Two earlier GitHub reports, now gone, showed 12 GB cards under pressure too: 10.9 of 12 GB in use with heavy stutter (Series X profile, DLSS frame generation), and a crash report titled "exceeding 12GB VRAM" with no figures. Skanzinho's 12 GB card lost the device at about 1.5 minutes with 356 MB of RAM free on a 32 GB PC (`DARNER_KEEP_RAM_GB=22` and a 6 GB card limit, v2026.12.01.02), and ran 16 minutes clean without them; one run each, and more than that differed (earlier comments, not copied here). On a 24 GB card the old fixed park target left the card unused instead (an earlier issue on the old host, not re-filed). Ray tracing, frame generation and higher resolutions may reach the budget sooner on any card (not measured). **Goals** 1. Stay under the card's budget on any card, without leaving the card unused. 2. No refused textures, so no gray, white or black stand-ins (refusals are the likely cause, not proven): degrade instead (park in PC memory, fewer levels). 3. Fewer memory stalls: fewer refusals, re-asks and readings. 4. One figure for "in use" that every memory class agrees on, used both to let memory in and to move it out. **Predicted benefits.** Each is "measured" (build, date) or "estimate" (why). - **Under the budget.** Measured, 2026-12-01, test build v2026.12.01.01-test, `victory play` (the park), 28 minutes: over the budget in 0 % of 916 memory lines, always at least 501 MB under. The old main's memory defaults on our fork's build, 31 minutes: over in 10 % of 1,097 lines, by up to 314 MB, from about 3 minutes in. Not like for like (another exe; the test build started with an empty pipeline cache), and both runs are before b97efa767: main itself was not run. The owner's line should also cover the script launcher's path, which went over on an older build ("Two launch paths"): estimate, not measured. - **Card not left unused.** Measured by untried844 in an earlier issue, 2026-12-01, test build, RTX 4090 24 GB (step 1b): at the fixed 9,600 MB target, 12.6 GB was parked and about 10 GB of the card sat unused; at 20,000 MB the card filled (17.4 GB in use) and about 1.9 GB was parked. On main (37ff585), with its nine tenths, untried844 measured on a later save (an earlier comment, not copied here): three runs of 12-23 minutes, no device loss, over the budget in 0 of 704, 445 and 839 memory lines, card use 19.8-20.2 GB, and 1.2-7.1 GB parked at the end. So the card fills, but on a late save several GB can still be parked, not at most 1.9 GB. - **Fewer refusals.** Measured, the same two runs: first-upload refusals fell from 20,346,515 to 45,324, with 1,290 MB parked in PC memory at the end. Card blocks were still refused while under the budget ("What is still missing"). Estimate: one line and one figure should stop that, since separate lines below the budget refused them. Not measured for card blocks. For first uploads the played run with frame generation shows no improvement: the owner refused all of them, and main's own rule would have refused about 90 % of the same asks (see the "Earlier discussion (ours)" section below). - **Fewer stalls.** Not measured; no fps or frame-time gain is claimed. untried844's freezes stayed when the target changed (an earlier issue on the old host, not re-filed). Step 1a's debounce cut DXGI readings in the world from a median of 24 to 15 a second (measured, fork, 2026-12-01), but a reading costs a median 546 ns to 1.1 µs (idle desktop, one run), so that buys consistency, not CPU time. - **One figure.** Measured, 2026-12-01, old main 5fabb46ea with step 1a: the shared estimate was within 1 MB of DXGI in 95 % of 316 lines. That shows only that the estimate tracks DXGI, not that every class agrees. Estimate: one sum for letting in and moving out removes the gap of about 350 MB in step 1d (needed but not enough). **What main already does (read in its code).** - The texture park (`VICTORY_TEX_PARK=1`, on in `victory play`): a texture with no card room is made whole in PC memory instead of waiting behind a gray stand-in (target: step 1b). - Off by default: `VICTORY_TEX_PARK=2` moves the least-used card copies to PC memory, emptiest block first, and back when there is room; `VICTORY_DEMOTE=1` drops two levels from long-unused textures. Both work without the texture-use marks, but then `DEMOTE` keeps the textures shaders pick by index. **What is still missing (our reading of main).** There is no single owner. - About 15 separate lines decide card room: the texture queue (80/86 % of the budget, or budget − max(768 MiB, budget/20)), first uploads (a 512 MiB margin and two more bounds), buffer copies (97 % or the queue's line), card windows (80 %), buffers made ahead (70 %, 95 % in the script launcher), slot eviction (85 %), spare blocks (85 %), the UAV pool (88/95 %), the park target, the render-target reserve and more. - Each reads DXGI itself: `Host::video_memory` (host.rs, 44 call sites in 21 files) asks `QueryVideoMemoryInfo` twice (card and shared) on every call, with no cache and no budget-change event. - They measure "use" differently. The texture queue and slot eviction weigh DXGI use, minus free space in texture blocks, plus the room kept for buffers and render targets; buffer copies, the park's moves and compaction weigh raw DXGI use. So two parts can disagree about whether the card is full, and the park lets textures in on one sum and moves them out on the other. - What this cost on the test build (the runs under "Predicted benefits"): card texture blocks stopped at 46 (2,944 MB) three minutes in and stayed there. 79,859 card blocks were refused over 36 park periods, all while the card was under its budget. The texture queue's line (80 % of the budget with frame generation, 5.4-5.6 GB) said "no room" in all 288 of its lines in the world. **Two launch paths on cards with a budget of 8 GiB or less.** - `victory play` (the menu launcher): park on, tiled levels off (`LEVELS_ON_DEMAND=0`), `POOL_SMALL=0`. - `scripts/play-nvidia.ps1` (the script launcher): `LEVELS_ON_DEMAND=auto` (tiled levels on at this budget) and `POOL_SMALL=1`. Tiled levels switch off the park, `SMALL_WHEN_FULL` and `TEXTURE_QUALITY` for those textures. As before the rework, a refused texture waits about 4 s behind a gray stand-in and is asked again. The 512 MiB first-upload margin still refuses there (its log line: "refused by an explicit byte limit"). - An older build (v2026.11.29.02, before the rework; n=3 against 3, other switches differed too): with tiled levels and `POOL_SMALL` on, runs uploaded 18.9-21.5 GB and ended at 7.8-8.4 GB card use against a budget of about 7.1 GB; with both off, 2.0-2.4 GB and 6.6-6.7 GB. The script launcher still sets both, so this may still apply; it needs a fresh run on main. **Another 8 GB card.** CuteBooty's RTX 3070 8 GB (a whole 28-minute campaign mission, v2026.11.30.01 with mcozcan's compaction, DLSS frame generation x2) stayed under its budget, but the margin fell from 869 MB to 22 MB, render-target copies grew from 1.34 to 1.61 GB, all still held, and texture blocks grew from 2.75 to 3.2 GB while 481-835 MB sat free inside them. **What others do.** One count of what is held, and one line under the OS budget. Dawn caps its D3D12 use at 95 % of the OS budget minus its own outside reservation ([Dawn source](https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp)). Unreal's DX12 back end aims at 90 % of it, to allow for fragmentation ([Epic forum thread quoting UE 5.6](https://forums.unrealengine.com/t/dx12-vram-budget/2616586)). [D3D12MA](https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator/blob/master/src/D3D12MemAlloc.cpp) and [VMA](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/blob/master/include/vk_mem_alloc.h) cache the budget, count what they make and free, and ask the OS again after 30 allocation or block operations (VMA also each frame, `vmaSetCurrentFrameIndex`). Over budget, Unreal's texture streamer [drops one mip at a time until the plan fits, least recently seen unseen textures first](https://dev.epicgames.com/documentation/en-us/unreal-engine/texture-streaming-overview-for-unreal-engine), and DXVK (Vulkan, discrete cards) [retries a refused card allocation in system memory](https://github.com/doitsujin/dxvk/blob/master/src/dxvk/dxvk_memory.cpp). The park is the DXVK answer, `DEMOTE` the Unreal one. **How to read the data lines.** Each "Data" line gives its date and build. All are from our card unless a name is given, and from before the rework unless the build is the test build. "Fork" is our fork's diag build on upstream v2026.11.30.02 with opt-in ports. "Our settings" means our launcher's memory switches, not main's: `POOL_SMALL=0`, `SLOT_EVICT=0`, `TEXTURE_KEEP_FREE_MB=0`, `ROOM_BY_BLOCKS=1`, `CARD_ROOM_FOR_TARGETS_MB=1280`. "Old-main defaults" is the same exe with the old main's script-launcher memory switches (`POOL_SMALL=1`, `SLOT_EVICT=1`, the rest unset). Single sessions, not repeated. **Proposed steps.** A ticked item is on main and was checked in its code; each item says where. - **Step 0. Count first.** - [x] `cardledger.rs` on main, from Remorce's ledger PR, applied as e2675de0d: card bytes by kind, frees counted, a 5 s summary by default (`DARNER_CARD_LEDGER=0` turns it off; our test report was an earlier comment, not copied here). It "only counts and logs; nothing is decided from it"; step 1 would make it the owner's ledger. - [x] Our per-block census: our fork only, a diagnostic for measuring here (38 ms a pass, so not for upstream). - **Step 1. One owner that works with the park, not instead of it.** It gives the park, `DEMOTE` and slot eviction one figure and one line. - [ ] **1a. One shared reading.** Our change, behind a new switch `VICTORY_CARD_OWNER=read` (off): DXGI is asked at most once a frame and never twice within 16 ms; the budget-change event wakes a reading, debounced, and budget moves under 128 MiB are ignored; between readings, use is estimated from texture blocks and committed textures made or freed, as D3D12MA and VMA do; a `card owner:` line once a second logs the reading, the estimate and its error. It folds in andrewpozdnakov7-jpg's race fix and follow-up commit, under his name. Our GitHub PR (branch `up-card-read`) was closed with a request to rewrite it on the new main. The rewrite is implemented on our branch (as `DARNER_CARD_OWNER=read`), not yet a PR. The `host.rs` size question (an earlier issue) is settled: main lists the file as an exception (55722bd9b). - Data, 2026-12-01, fork (79 sessions): DXGI moved the budget every 2-30 s after loading, 95 % of the moves under 100 MB. The 128 MiB band comes from that. - Data, 2026-12-01, fork with the reader, two sessions of ~25-28 minutes, FSR 3 frame generation: without the debounce, the budget-change event forced 157,490 readings (in the world a median of 24 a second, p95 153, max 496; worst one-second estimate error 337 MB). With it: 113,686 wake-ups for 19 budget moves past the band; in the world a median of 15 readings a second (p95 17), estimate error at most 31 MB at a reading and 271 MB in any period. The loading screen (260-1,324 fps) still reached 1,491 readings a second, hence the 16 ms floor. - Data, 2026-12-01, old main 5fabb46ea + our 1a PR, `read`, no frame generation, an 81 s load then ~7 minutes standing: at most 63 readings a second on the loading screen for up to 2,349 asks a second; in the world a median of 17.6 a second at 18.3 fps, so one a frame. Estimate within 1 MB in 95 % of 316 `card owner:` lines, at most 67 MB; the largest drift, 219 MB, came in the second the budget fell from 7,221 to 6,671 MB. 6,267 event wake-ups for 2 budget moves. No panic or device removal; four shots looked normal. Not run with the switch off. - Data, 2026-12-01, kraiy404 on our 1a PR (RTX 4060 Ti 8 GB, Series S and Series X, DLSS frame generation): 91,430-261,928 event wake-ups for 2 budget moves per run. - Data, probe on an idle desktop (no game, one run): `QueryVideoMemoryInfo` takes a median 546 ns for one memory group, 1,102 ns for both. - [ ] **1b. One line from the card's own budget.** Main's park target does this since b97efa767 (data below). The owner's line should be that same figure, not a second one. Our earlier line (budget − max(512 MiB, budget/16), about 93 % on 8 GB) gives way to it. - Data, 2026-12-01, v2026.12.01.01-test, untried844 in an earlier issue (RTX 4090 24 GB, Series X, 1440p, DLSS Balanced, ray tracing off): the fixed 9,600 MB target (budget 23,370 MB) parked 12.6 GB of textures in PC memory and left about 10 GB of the card unused. At 20,000 MB, set by hand, the card filled and about 1.9 GB was parked, but the freezes and a purple fringe around characters stayed. Main b97efa767 now uses nine tenths of the budget, or of the player's limit where that is lower. - Data, 2026-12-02, untried844, same card, a later save, DLSS Quality (earlier comments, not copied here: the test build and main 37ff585): the test build at 20,000 MB filled the card and still parked 8.7 GB, and lost the device in both sessions; main at its nine tenths (19,798-20,351 MB) ran three sessions without a device loss and parked 1.2-7.1 GB. - [ ] **1c. Fresh readings.** Mostly done on main: the texture pass reads DXGI again every 32 MiB uploaded, and the park takes 64 MiB off its headroom per card block made between readings. What is left is counting frees, which the ledger already does. - [ ] **1d. Every class asks the owner, and the owner moves memory out on the same figure it lets memory in on:** the sum the texture queue and slot eviction already weigh (see "What is still missing"), not raw DXGI use as the park's moves do today. Our own owner on the old main had the same split: it refused textures about 350 MB under its line, because letting in counted the kept room and moving out didn't. Implemented on our branch (`DARNER_CARD_OWNER=read,shadow,act`), not yet a PR; later results in the "Earlier discussion (ours)" section below, first results in an earlier comment, not copied here. - Data, 2026-12-01, fork, old source, a same-sum drain: refusals began at 18:45:54Z; the drain switched on and off, and from 18:47:10Z (6,127 MB against a line of 6,123 MB) stayed on to the end of the log. In the next 41 s, slot eviction (with `SAMPLED_EVICT=pressure`) let go 677 more textures, but only 49 MB, and card use stayed at 5,840-5,873 MB. No idle render-target copy was free to go: about 100 were idle (280-400 MB), all held by a list or a slot. Textures stayed refused (118,000-187,000 refused asks per line at first, 9,000-94,000 in the last three), and so did the white stand-ins. - So one line and a same-sum drain are needed but not enough: the owner also needs a drain that moves whole textures, including ones shaders pick by index, without the use marks. - [ ] The owner drains through what main has: it sets the line and drives the park's moves (`TEX_PARK=2`) and `DEMOTE`. The use marks cost about 10 ms a frame on an RTX 3090 at 1440p (main's play.rs: 62.8 against 52.1 ms), so `victory play` has them off (`SAMPLED_MARKS=0`). - **Step 2. Render-target copies under the same line.** On main, render targets are still made with no room test; the texture queue keeps room for them instead (`targets_room_kept`, up to 2.5 GiB at a budget of 8 GiB or less). - [x] nidea1's dead render-target reclaim (merged on GitHub before the move) is on: every 5 s, not tied to the budget. - Data, 2026-12-01, fork (which has it), two sessions: "render targets and written textures" still grew from about 1.3 GB at ~5 minutes to 1.5-1.6 GB by ~35 minutes, peak 1.65 GB at ~42 minutes. - [ ] Its slot-pinned path still frees nothing (a fix, letting the copy go after the lists finish, is implemented on our branch, not yet a PR). The slot is made null through `retire_resource`, which keeps a COM reference until running lists finish, and the same call then demands `references(&host.texture) == 1` (resource.rs:5027; descriptor/host.rs:5248). That was bug 1 in nidea1's follow-up fix PR on GitHub (closed for a rewrite); a smallest version on main is bug 1 plus the slot path's unmapped check. Two of its other fixes are partly on main. - [ ] Shared render targets (`ALIAS_TARGETS=2`, about 0.8 GB) were on in the test build and are off again on main after testers saw streaks and halos (c7f736c06). This class has no other lever on main. - [ ] Idle copies a command list or slot still holds: the open part (347 MB of 1,523 MB on old-main defaults). - Data, 2026-12-01, fork, our settings, ~28 minutes: of 1,628 MB of copies at the end, 590 MB in use, 555 MB idle but held by a list or slot, 0 MB idle and held by nothing, 482 MB kept whole (depth, MSAA, twins, aliased, tiled). On CuteBooty's 3070 the unheld class was 0 too. On old-main defaults, copies a newer target took over were 48 MB, against 385 MB of idle copies nobody took over. So letting go unheld or taken-over copies has little to act on here. - Data, probe on an idle desktop (no game, one run): `Evict()` of 8 heaps of 64 MiB cut DXGI's card use by 512 MB at once, even over budget, and `MakeResident()` restored it at once. A heap at `MINIMUM` residency priority still counted in full, so priority only orders what Windows moves out. A GPU read of an evicted heap removes the device, so `Evict()` suits only objects nothing references. Not shown: the cost of `MakeResident()` after a real page-out. - **Steps 3 and 4. Release and pack by block.** DXGI charges whole heaps, so letting textures go helps only when it empties a block. A first version (cold and warm blocks under the owner, `DARNER_CARD_BLOCKS=1`) is implemented on our branch, not yet a PR; its first run found a bug (an earlier comment, not copied here). - [x] The first part of mcozcan's compaction PR is on main and on by default (`VICTORY_COMPACT_SPARSE`, merge 8dd9dad2a (8dd9dad2a)). It acts only when DXGI use is over the budget or PC commit is short. Our 8 GB run with the park never went over the budget, so it never fired; it may need the owner's line as its trigger. - Data, 2026-12-01, fork with the PR ported, our settings (slot eviction off): in 35 minutes it let 4,299 idle textures (557 MB) go and freed no block; texture blocks stayed at 3,968 MB with up to 1.7 GB free inside. In a 24-minute session it let 6,776 textures (721 MB) go and emptied 0 blocks; almost no new pieces were cut into nearly empty blocks, so refilling was not the cause. In a third, each of 13 passes let go 0-18 MB while free space in blocks rose from 845 to 1,472 MB. - [ ] The same PR's whole-block rule (`COMPACT_WHOLE`) is not on main. `TEX_PARK=2` already picks the emptiest block first. - Data, 2026-12-01, fork: with our settings, 4 or more blocks would have emptied if the cold index-picked textures went in 0 of 45 lines; blocks grew from 50 to 62, 1 emptied. On old-main defaults (31 minutes) it was 45 of 60 lines; blocks went from 54 to 41, 16 emptied and 13 were let go. So how small textures are placed decides whether release can empty blocks. - Data, probe: destroying 8 heaps of 64 MiB lowered DXGI's use by 512 MB at once, also over budget, so an emptied block pays off at once. - [ ] Release cold textures that shaders pick by index. mcozcan's pressure mode for slot eviction (a GitHub PR, closed for a rewrite) did that, but it needs `SAMPLED_MARKS=1`, which `victory play` sets to 0, so as written it would do nothing there. A new version needs a reason to turn the marks on, or a trigger without them. Whether to rewrite either of mcozcan's PRs on the new main is mcozcan's call. - Data, 2026-12-01, old-main defaults, 31 minutes: slot eviction let go 5 textures (1 MB), all in the first 6 s. At its last look 15,297 of 16,234 idle-looking textures were in slots shaders pick by index, which main leaves to `SAMPLED_EVICT` (off). 530 MB of them had no shader read within their idle time at the end (1.4 GB at 1 minute). - [ ] Ignore periods with no draws, such as menus. - Data, 2026-12-01, fork, our settings: in menus no shader reads, so hot slot bytes fell to 33-59 MB and 40-53 blocks (2.5-3.4 GB) looked releasable. Releasing them would only remake it all on resume. - [ ] Reuse a released piece only after the last submission that used it has finished (a GitHub PR by nidea1, closed for a rewrite). Main rests a piece 2.5 s instead (pool.rs:308-311), and upload-ahead takes any texture made in a block in the last second, new or reused place alike (texture/ahead.rs:248). Not tested whether the hazard shows. - **Step 5. Degrade, never refuse.** Done in `victory play` by the park. Still open on the script launcher's tiled path on 8 GB (see "Two launch paths"). - Data, 2026-12-01, fork, our settings, 52 minutes with `VICTORY_TEXTURE_BUDGET_MB=2500`: the cap is compared with all host textures on the card (4,631 MB at the end), so once they passed it, first uploads were refused (154,114 in the last log window). White and black textures were seen (refusals the likely cause, not proven), and use was still 8,638 MB against a 7,080 MB budget: a cap that refuses is not a degrade. - **Step 6. Fewer levels for cold textures.** `VICTORY_DEMOTE=1` exists (off): test it before building anything. `TEXTURE_QUALITY` is not this step: it cuts levels from large textures for the whole run, used or not, and does nothing under tiled levels. **Our 8 GB port** (warpGTAIV's VIctory-8GB policy, on our fork) is mostly not on main: 64 MiB texture blocks only, no 1 GiB card windows below an 8,192 MiB budget, no budget/3 texture line, no buffers-first rule. Its textures-outside-blocks mode works against the park, and upstream's loading-crash fix (console_insn.rs) supersedes its own. Anything from it would come as fresh single PRs. **Related work and credit.** The steps build on what is merged: the 512 MiB first-upload margin, slot eviction, nidea1's render-target reclaim, the park, Remorce's ledger (step 0), Lyrnc's commit floor (merge b0335dff8: a lower texture line while PC commit is under 4,096 MB, `VICTORY_TEXTURE_COMMIT_FLOOR_MB`) and an earlier version of the first commit of nidea1's host-written-records PR (merge ae5d78f38). The GitHub PRs below are gone; I'll link any that is re-filed here. - Closed on GitHub with a request to rewrite on the new main: our step 1a PR, nidea1's reclaim fixes and piece reuse, and mcozcan's two PRs (all in the steps above), plus six more by nidea1 (three), Trillazill, 1mosce and AirKyzzZ, listed in an earlier comment, not copied here, with what each still means. - Open on GitHub at the takedown: an idle-sweep and dynamic-reserve PR, two texture block-size PRs, a PR keeping the shown texture (`KEEP_SHOWN=2` is on in `victory play`), and nidea1's early-Z with sampled marks. - Also: Remorce's tested collection of memory PRs and switches (a GitHub discussion), the maintainer's feedback thread for the test build, and data from CuteBooty, eipastel, guyansong24, kraiy404 and others in the GitHub thread and from untried844 here (an earlier issue on the old host, not re-filed). **Spec dependence** - Likely general: one figure and one line for every class, and the same sum for letting memory in and moving it out; the budget-change event waking far more often than the budget moves; cold and hot textures sharing blocks. - May depend on our specs: every number above is ours unless named, from one RTX 2070 SUPER 8 GB (Turing), driver 621.40, Resizable BAR off, Ryzen 7 5800X, 32 GB RAM, Windows 11, Series S, DLSS Performance, FSR 3 frame generation. The GPU clock state was not the same across these runs (locked at 1890 MHz on some days, unlocked on others), so no fps claim is made across runs. - Measured by others: Skanzinho's RTX 4070 SUPER 12 GB on v2026.12.01.02 (Series S, DLSS Performance, DLSS frame generation x2); CuteBooty's RTX 3070 8 GB and kraiy404's RTX 4060 Ti 8 GB (Series S and X), both with DLSS frame generation, on GitHub; untried844's RTX 4090 24 GB at Series X, on the test build (an earlier issue on the old host, not re-filed) and on main 37ff585 (earlier comments, not copied here). - Untested: AMD, 16 GB cards, the owner on any card but ours, the owner with DLSS frame generation (FSR 3 x2: one played run), Series X on our card, ray tracing. **Earlier discussion (ours).** Our own comments from the earlier issue that are saved locally, summarised. Other people's comments are not copied; where this post names one of them, it is by name. *Correction, 2026-12-02: three played runs with frame generation show no benefit from the owner.* Build: our branch 17189c902 (40 commits on main 58a9c07a0), diag build. Played by hand by one person, the same save, 6 minutes in the world each, one run per arm, in this order: (1) owner off, lighter route; (2) `COLD` (`DARNER_CARD_OWNER=read,shadow,act` + `DARNER_CARD_OWNER_COLD=1`), heavy route; (3) owner off again over run 2's heavy route (same route by the player's words). All three: Series S, DLSS Performance, FSR 3 frame generation x2, mouse and keyboard, `darner play`'s switches set through the script launcher with `DARNER_SAMPLED_MARKS=1`, `DARNER_AMBIENT_SPECULAR=1`, `DARNER_SLOT_FLIPS=1` and `DARNER_PC_OWNER=read`. The switch lists differ only in the two owner switches; the player also changed two F1 settings (`DARNER_SHARPEN`, `DARNER_PANEL`) during the series. - Not run: `COLD` with moves to PC memory (`RAM_TIGHT`), `COLD` with the stricter mark, every repeat. No settle run: four tries were each ended by our free-RAM guard (about a minute in; free RAM 628, 577, 640 and, for the fourth after a rule change to "10 seconds in a row under 700 MB, or at once under 300 MB", a lowest of 422 MB). That rule then held for every run of the series, the same for both arms, set before any scored run. A 942-second preload stands in for the settle run; we have not checked that it is equal. A first played try (owner off, 209 MB free 11 seconds into the world) was stopped and not scored. | | 1: off, lighter route | 2: `COLD`, heavy route | 3: off, heavy route | |---|---|---|---| | readings over the budget | 0 of 244 | 50 of 243 (36 by more than 50 MB, at most 159) | 41 of 238 (none by more than 31 MB) | | card use, highest | 6,855 MB | 7,148 | 7,020 | | shared PC memory, highest | 5,754 MB | 6,928 | 6,573 | | committed, highest | 22,896 MB | 24,508 | 23,804 | | lowest free RAM | 1,158 MB (after the window was closed) | 1,669 MB | 771 MB (after the window was closed) | | fps, average (rendered) | 14.8 | 13.4 | 17.3 | | draws a frame, median | 6,132 | 8,223 | 6,897 | - No benefit from the owner here: it did not keep the card under its budget (the highest card use of the three is the owner's run). Run 1 was never over, so it says nothing either way. No fps verdict: runs 2 and 3 differ by 19 % in draws a frame, and it is one run each. Free RAM was never under 700 MB. No crash, device loss or guard stop. - Picture (the player's notes): white trees and rainbow road markings in runs 2 and 3, "about the same"; rainbow road markings also in run 1; less stutter with the owner off. White trees came with the owner off too, so we don't blame them on the owner. - **A fault in the owner with frame generation, read in the code and seen in one log.** The launcher sets `DARNER_TEXTURE_ROOM_PERCENT=80` with frame generation, and the owner's target is the smaller of its own line and 80 % of the budget (5,591 MB of 6,989 here). But its drain may run only once DXGI's own reading is within about 64 MB of the budget. So the owner's sum was over its line in all 241 readings from 20:09:49Z on (5.8-7.4 GB against 5.5-5.8 GB) and it refused every first upload (0 allowed, 495,028 asks refused), while the drain was held back until 20:13:14Z. After that it ran in 78 of 243 readings, gave up 9 times, and lowering freed 661 MB in the whole run. This does not make all 495,028 refusals the owner's doing: main's own rule, worked out beside it, would have refused 444,752 of the same asks. In run 3, with the owner off, main's rule refused 278,306 and allowed 9,925; the routes differ, so the totals are not a comparison. - **Why textures grow back.** In run 2 `COLD` lowered 2,909 textures (659 MB in the ten-second lines) and 2,241 regrowths were counted (77 %, not necessarily different textures). The reason counter says a shader had read the texture again 2,139 times, the "used" mark 120 times (a texture can count under both). So the stricter mark would change little on that run. - What comes first now: test the small-card headroom by DonatelloCANNCAN (aa2bd4b6a, on main; it applies only when the budget is under 7.5 GiB and `DARNER_VRAM_BUDGET_MB` is not set) with the owner off, on against `=0`, on the heavy route; whether the owner is still needed on 8 GB after it is open. Every number here is one played run per arm, no settle run, one 8 GB card; GPU clock state not recorded for these runs. **Related:** [#1](https://git.gtahub.st/trustno1/Darner/issues/1) (open, same reporter as the small-card change: RTX 4050 Laptop 6 GB, frame generation leaves textures 1.4 GB). Same area as the `TEXTURE_ROOM_PERCENT=80` frame-generation line above; not a duplicate. ### Are you working on a fix? Yes, I'm on it, on our 8 GB card. `DARNER_CARD_OWNER` and `DARNER_CARD_BLOCKS` are off by default; with `act` the owner also turns on `DEMOTE` unless `DARNER_DEMOTE=0`. First: test the small-card headroom by DonatelloCANNCAN (aa2bd4b6a on main, now in main 4a92569fb; it applies only when the budget is under 7.5 GiB and `DARNER_VRAM_BUDGET_MB` is not set; 512 MB, `DARNER_SMALL_CARD_HEADROOM_MB`) on our card with the owner off, on against `=0`. It aims at the same thing on 8 GB, so it may decide what of this plan is still needed there. Then: 1. Find out why lowered textures grow back: a counter of the reason, and a stricter "used" mark (`DARNER_USED_STRICT`). Committed (17189c902) and built. The counter has run in one game run (above); the stricter mark has not been switched on in any. 2. Stop the owner from moving more to PC memory while RAM is short (`DARNER_RAM_TIGHT`). Committed (17189c902) and in the build the played runs used, but not switched on in any run. With it on, buffers the owner refuses ask the PC-memory owner first (so far they go to PC memory with no RAM check; untested). One known gap is left: the PC-side line does not count a working-set minimum (`DARNER_KEEP_RAM_GB`). 3. A run series with parking on was planned as owner off, `COLD` only, `COLD` with moves to PC memory, and `COLD` with the stricter mark, two runs each. Run so far, played by hand: off, `COLD` only, off again. The other arms and the repeats were not run. First the owner's line with frame generation has to be made to agree with when its drain may run (see the "Earlier discussion (ours)" section below). 4. Draft PRs here, one step at a time, once a step has shown it helps. If you are already on one of the steps, please say so here so we don't duplicate it. Runs on other cards are very welcome. Drafted with AI assistance (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner#19
No description provided.