[pr-performance][memory][NVIDIA] Small textures at 4 KiB steps by default with a discrete NVIDIA card (DARNER_POOL_SMALL=auto) #151
Loading…
Reference in a new issue
No description provided.
Delete branch "Cyber-Croissant/Darner:pool-small-nvidia"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #19. See also #135, #1 and #68.
What it changes
DARNER_POOL_SMALLgets a third value,auto, which both launchers now set (play mode andscripts/play-nvidia.ps1, kept equal for the launcher table test). Withauto, small textures (most detailed level of 64 KiB or less; with its other levels a texture can be larger) are placed at 4 KiB steps, in blocks of their own (DARNER_POOL_SMALL_APART, already on by default), when the host's card is a discrete NVIDIA one (Host::discrete_nvidia, the checkDARNER_SCRATCH_CARDalready uses). Other cards keep 64 KiB steps until someone tests them. That side ofautois a safety: the 64 KiB default came from two device losses on an AMD card (the note abovesmall_placement), and we have no AMD or Intel numbers.1still turns it on with any card and0off. TheDARNER_HOT_ABfile reads the value the same way. A run without the variable followsautotoo (before, it was on with every card).small textures at 4 KiB steps: on (DARNER_POOL_SMALL=auto).DARNER_HOT_ABfile share one decoding of the value, with a test for both card cases, and corrects the wording about which textures are small.Why it was off: play mode turned it off on 2026-11-28 because trees flashed in and out. Small textures got blocks of their own the same evening (walls came out black when they shared blocks with large textures). The tree flashing is there with it off too: #135 reports every tree's leaves vanishing for one frame on v2026.12.03.01 with play's defaults, and we saw trees flash in our runs without the switch.
How it was tested
DARNER_POOL_SMALL=1, plus local bench scripts and a pad-replay patch used only to start the autodrive (not part of this PR). This branch (aab9c4f6, onmain57dea7f2) was built (normal and diagnostics) and passedcargo test -p darner --bin darner the_powershell_launcher_sets_no_play_default_differentlyandcargo test -p darner-gpu --lib pool::tests(59 passed). On a discrete NVIDIA cardautoselects the placement that1gave in the runs.DARNER_POOL_STATS=1andDARNER_FLICKER_DETECT=1. Noise: the spread of the two A runs. Card memory: nvidia-smi's window mean, and the card ledger's DXGI local use. "Made on the card": the ledger's "made ... since the start", over the time in the world. Bench: one fixed save, 30 s warm-up, then 180 s standing still; "light" and "heavy" are the median frame time of the frame lines with 4,500-7,000 and 7,000+ draws. Drives: the game's own autodrive from the same save, started by a recorded pad replay, 11.5 minutes through the city each; figures over minutes 4 to 7 after the world appears (the city).1. Bench, native, Darner
4db98e01Card memory -2.38 and -2.65 GB (spread of the A runs: 0.11 GB). The pool's own line in A said as much: "47415 of them could lie at multiples of 4 KiB and would hold 629 MB where they hold 3070 MB".
2. Drives, native, Darner
4db98e01While driving, the room it frees keeps about twice as many textures on the card, with less made on the card and less shared memory. City captures were sharper with it (median B/A 1.34 over 20 s slots, a rough gradient measure).
3. Bench, native, Darner
fc3642e04. Bench under an 8 GB card's budget (
DARNER_VRAM_BUDGET_MB=7040), Darnerfc3642e0No device loss and no freeze in the 16 runs.
About #19
#19 measured this switch only together with tiled levels, on an older build (v2026.11.29.02, other switches different too): an 8 GB card went over its budget and uploaded about ten times more. Tiled levels are off by default now. With this switch alone under an 8 GB budget, the card stayed further under it (peak 77 % of the budget against 98 %), kept 40 to 55 % more textures and made 17 to 31 % less on the card. It does not compete with #19's central manager: it changes how textures are packed, not who decides how much card memory may be used, and the pool's free space is already counted over both texture pools. Runs for #19 that set
DARNER_POOL_SMALL=0stay comparable with earlier series.Weaknesses
Why NVIDIA only, and a call for AMD and Intel testers
Every run with it on that we know of is on NVIDIA: this RTX 5070, Darner's RTX 2060 note, and the RTX 5070 Ti in
play-nvidia.ps1's comment. The 64 KiB default came from two device losses on an AMD card (2026-11-25), on textures at 4 KiB but not 64 KiB offsets, before small textures had blocks of their own; the cause was never found. Intel: no data. Soautoleaves AMD and Intel cards as they are.If you have an AMD or Intel card, please try
DARNER_POOL_SMALL=1and report here: device losses, black or missing textures, flicker, and the card memory with and without it (DARNER_POOL_STATS=1logs the pool's line). If it holds,autocan include your vendor.Checklist
main. It is based onmain(57dea7f2); besides the change, a second commit only shortens two comments of #199 (ours). I can move that commit to a PR of its own if you prefer.docs/asset-policy.md.Checked for overlap
play.rs,pool.rsandplay-nvidia.ps1on other lines; the two fit together. No open PR changesDARNER_POOL_SMALL.This changes the default for AMD and Intel too: a run without the variable used to pack small textures at 4 KiB on every card, and with
autothose cards go back to 64 KiB steps. Do you have numbers on an AMD or Intel card for that part (VRAM and fps, with and without)? Without them, couldautoleave non-NVIDIA cards as they were (on), so only NVIDIA's decision changes?Correction to the above: 4 KiB placement came from a port whose AMD source defaults to 64 KiB, after two device losses in small textures at 4 KiB offsets (see the note above
small_placementin pool.rs). If the AMD/Intel side ofautois meant as that safety, please say so in the PR text. Numbers from an AMD card would still settle it: the memory saved against any device losses.No AMD or Intel numbers: we only have this NVIDIA card. Yes, the non-NVIDIA side of
autois meant as that safety; I have added it to the PR text. With both launchers, AMD and Intel players hadDARNER_POOL_SMALL=0until now, andautokeeps them at 64 KiB steps, so nothing changes for them. The one case that does change is a run with the variable unset, outside the launchers: it was on with every card and now followsauto. If you would rather keep that case as it was, I can make an unset variable mean on, as before, so that only the launchers'autodecides by card. Numbers from an AMD or Intel card would settle it; the call for testers stands.One place where the AMD/Intel
autopolicy still differs at47ce3bf5: the liveDARNER_HOT_ABbranch returnsv != "0". PuttingDARNER_POOL_SMALL=autoin the benchmark file therefore enables 4 KiB placement for new textures on AMD/Intel, while the same value at startup selects 64 KiB. Could the environment and hot file share the0/auto/on decoding, with a small test for both vendor cases? TheDARNER_ABboolean override can stay a forced on/off toggle. This is from source review. Both pathsOne detail for the PR description’s “textures of 64 KiB and less”: the top mip can qualify even when the full allocation exceeds 64 KiB. I queried an RTX 4070 Ti SUPER on driver 617.14 with GetResourceAllocationInfo, comparing the default alignment with a 4 KiB request.
Both full chains saved 40 KiB in the driver’s reported requirement. All 22 queries (11 descriptors) matched across three process launches. These are size queries only. In-game residency, flicker, FPS and the AMD/Intel stability question remain open. D3D12 alignment rules
I checked the live setting on both revisions with a temporary hot file and the real environment and timed A/B readers. The previous head,
47ce3bf5, passed 26 of 30 cases. With the non-NVIDIA flag, an empty value, auto, and whitespace-padded auto in the hot file each enabled 4 KiB placement. Changing 1 to auto while the process was running also left it on. The updated head,aab9c4f6, passed all 30 cases. Both revisions passed all 15 discrete-NVIDIA cases.A hot-file 0 overrode the timed on phase. Removing the line restored the phase value, or the startup setting when timed A/B was disabled. The author’s parser unit test also passed.
I compiled the placement functions from both Git revisions with their hot.rs and ab.rs modules. The harness supplied the card flag and called the present callbacks, with logging and frame counters stubbed. This verifies setting selection. AMD/Intel device stability, VRAM and FPS still need real hardware.
In-game numbers on a discrete NVIDIA card that runs out of VRAM: about 1.5 GB less on the card and no DLSS VRAM warning, same frame rate, no trees flashing in the run watched.
Setup. RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 31 GB RAM, Series X profile, 1440p, DLAA, frame generation 2x,
DARNER_HW_RT=1. Without the switch the card is at its limit in this scene (VRAM peak about 15.7 GB of 16, DLSS VRAM warning in every run). Route: gta-bench-kitcam-city60(65 s of city camera).What ran. One exe,
main57dea7f(release,--features bench-remote), withDARNER_POOL_SMALL=0(the launcher's value onmain) againstDARNER_POOL_SMALL=1. On a discrete NVIDIA card that is what this PR'sautopicks (small_wanted("auto", true)is on ataab9c4f6), so the placement is the same; the PR build itself did not run.Bench (median of runs, spread max−min in brackets; the off runs are all of tonight's runs of that exe, the on runs were interleaved with one of them: on, off, on):
The VRAM and the warning are clear. Frame rate and the texture queue are within the off runs' spread.
Texture queue from the game logs (the interleaved batch, first 60 s of each log skipped):
The 1.5 GB freed did not make the texture pass faster here: the card's room did not turn into more uploads, and the oldest due texture waited longer in both on runs than in the off run between them (one off run only, so not settled).
By eye (the second on run only; the first was not watched): no trees flashing in and out, the reason
main's launcher turned this off on 2026-11-28. That run looked worse than the earlier runs, with more visual glitches, but nothing flashing. No device loss in either on run (no device-removed line in the logs).Follow-up after the merge: answers to the review comments, corrections to the PR text, and what ran on the merged commits. Each line says how it was checked: a run in the game, a unit test, the source, or not checked.
Read this first: this default may be a regression. Nyutt saw a worse-looking run and a longer texture wait with it on a card at its VRAM limit, a case our card does not cover. Our numbers below do not rule that out. If other users see a regression, the setting will most likely have to be off by default again, whatever VRAM it saves. Details in the last section.
Answers
DARNER_HOT_ABpath readautoas on): fixed inaab9c4f6. The environment and the hot file share one decoding (small_wanted), with a unit test for both card cases. Thank you.Corrections to the PR text
It was merged before I had corrected these.
main. Checked withgit merge-tree: #59's head (eefe0191) merges cleanly with this PR's base but conflicts withmain(a361afed) inscripts/play-nvidia.ps1, in the comment lines above the settings line both touch. It resolves by keeping #59's four comment lines and itsDARNER_WINDOW_GROW...line, thenmain's two comment lines and itsDARNER_POOL_SMALL = 'auto'line. Not built or run.docs/ab-testing.mdit does not count. One A run is left (29.9 fps) against B's 30.5 and 30.8: no frame-rate claim stands on that series. Its card memory is not affected (9,886 MB against 7,489 and 7,390).cargo checkand the two unit tests had run on the branch. The build and the run in the game came later, below.DARNER_FLICKER_DETECT=1), not a judgement by eye of the picture.What ran on the merged commits
Exe:
main57dea7f2plus this PR's three commits (headaab9c4f6) plus local bench scripts, diagnostics build. RTX 5070 12 GB, driver 621.47, Series S, DLSS Quality, frame generation off, ray tracing off.auto), one run: the log sayssmall textures at 4 KiB steps: on (DARNER_POOL_SMALL=auto); card memory 7,620 MB (four runs of the same base without the switch the same night, another sitting: 9,854 to 10,011 MB); 29.4 fps, 1 % low 19.6 (those four runs: 28.5 to 31.2 and 18.7 to 20.8); no device-removed line.DARNER_ADAPTER=Radeon), one launch: the log saysadapter=AMD Radeon(TM) Graphicsandsmall textures at 4 KiB steps: off (DARNER_POOL_SMALL=auto). The game then stopped with an access violation in the AMD driver (amdxc64.dll) while loading, with the switch off. So: the decision is the intended one on an AMD adapter; nothing is learnt about 4 KiB placement on AMD.aab9c4f6(--locked --offline):cargo clippy --workspace --all-targets -- -D warningspassed, and so did the same with--all-features.cargo test --workspacewas stopped after more than 20 minutes in darner-shader's tests (debug build): 18 test binaries had finished, all ok (3,281 tests); darner-shader had not finished and showed two failures (emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders,emit::wave64_tests::lds_shared_atomic_add_producer_executes_wave32_on_hardware). This PR changes no file incrates/darner-shader; whether they fail on the base too is not checked.Texture lag with the switch (Nyutt's reserve)
The 5 s queue line cannot tell a texture waiting on the layer from one waiting on the title's memory, so this uses the per-frame record (
DARNER_BENCH_CSV). Hypothesis written before the runs: with 4 KiB placement the layer serves textures later. Same exe,DARNER_POOL_SMALL=0againstauto; each log says the decision of its arm; no row lost.Standing, A B B A, 30 to 210 s after the world's first frame (5,443 to 5,624 draws a frame); noise is the larger spread inside an arm:
tex_due_layer_late, mediantex_due_layer_late, meantex_oldest_due_framesover 600tex_due_title_late, medianDrives, one run an arm (the game's autodrive from the same save, 690 s; each checked by a capture and by its moves; no rescue needed; 6 % fewer draws a frame in the on run). With one run an arm there is no noise figure: this only says whether the on run was later.
tex_due_layer_late, mediantex_oldest_due_framesover 600tex_due_layer_late, mediantex_oldest_due_framesover 600No device-removed line in any of the six runs.
Result: on this card the hypothesis does not hold. Standing there is no difference in texture lag beyond the noise, and in the drives the on run was not later on any of the three measures. By eye: from what I saw while the various tests ran, no visual degradation caught my attention; any further report is welcome. What this does not cover: the card is not at its VRAM limit (about 10 of 12 GB without the switch). Nyutt's card was at its limit, with ray tracing and frame generation on, and that is where the longer wait and the worse-looking run were seen. That reserve stays open for a card at its limit.
This default may be a regression
We want to be clear about it: turning this on by default may be a regression for some players, above all on a card at its VRAM limit: the one run watched in that situation (Nyutt's) looked worse than his earlier runs. We are aware that if other users see a regression with this setting on, it will most likely have to be off by default again, whatever VRAM it saves, and the subject would then be looked at again. Please report in the issue #209 what you see with it, good or bad.
To run without it meanwhile:
darner play ... --set DARNER_POOL_SMALL=0(how the off arm above ran), orscripts\play-nvidia.ps1 ... -More @{DARNER_POOL_SMALL='0'}(from the script's source, not run). ADARNER_POOL_SMALLset in the window beforehand is cleared by both launchers (from the source). The default itself is theautovalue in play.rs's table and inscripts/play-nvidia.ps1; setting both back to0is a small change (the two launcher lines and the README row) that I can send as a PR if you want it, withautoand1kept for testers.