WIP: [pr-performance][memory] play: refreshes known to copy nothing are left out as they are queued (DARNER_REFRESH_ADD_SIFT=1 by default) #476
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!476
Loading…
Reference in a new issue
No description provided.
Delete branch "Yorivel/Darner:pr/refresh-add-sift"
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 #287
Contributor role (optional)
What it changes
darner playnow setsDARNER_REFRESH_ADD_SIFT=1by default (one line inplay.rs's defaults, and the switch's doc says so). The switch already exists: a refresh the write journal already says copies nothing is left out as it is put among a submission's pending refreshes (Batch::add), instead of being carried to the flush and looked at there among thousands. Its doc inhost.rsgives why that is the same answer as at the flush (light refreshes on, the submission's one asking standing). It stays off where its own conditions do not hold (watch::light()off orshadow::new_batch()), andDARNER_REFRESH_ADD_SIFT=0in the settings turns it off.How it was found: the submitting thread was the frame's limit in the world. The title's threads waited 18.3 ms a frame at presents for it, and it spent 6.6 ms a frame in refreshes, about 10,000 a frame, roughly 90 % of them known to copy nothing.
How it was tested
Tested revision: a local PGO build of
mainf3840d7with #310, #274, #283 and #341 merged. Both runs use that same exe; B only addsDARNER_REFRESH_ADD_SIFT=1to the settings. The gates are on this branch (190f957, onmaind91d8e4).Changes a default: yes,
DARNER_REFRESH_ADD_SIFTfrom off to on indarner play.A/B result: RTX 4090, i9-14900K, Series X profile, 1440p, DLSS Quality, DLSS frame generation 2x, hardware RT. The same save and route; the first 5 minutes after the world was first drawn in each run:
B's median frame is 30 fps exactly, so the frame rate may be held there now. The saving on the submitting thread (15 ms) is larger than the refreshes' own time (2.6 ms), so most of it comes from what a pending refresh costs later, not from the drop itself.
Gates run on
190f957: the asset policy (564 files ok) and gates 1 and 2 (both clippy runs) pass. Gate 3 with--no-fail-fast: every crate passes exceptdarner-shader'semit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders(DXIL validation: "Not all elements of output SV_Depth were written"). It fails ond91d8e4without this change too, and #227 fixes it. Two earlier full runs each had one differentdarner-gputest fail (host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started, thengpu_owned::tests::concurrent_faults_on_same_block_serialize_single_readback); both pass alone, anddarner-gpu's library tests passed in full on the third run (1,793 passed, 81 ignored). This change touches only a doc comment indarner-gpu.Gameplay: the tester saw nothing wrong in B. Textures streaming in late when driving fast happens on every build and was the same.
Hardware dependence: the cost is on the CPU's submitting thread; any PC where that thread is the limit should gain. Other PCs untested.
Coverage gaps: one run each, 5 minutes in the world; both with #310's leave list, #274 and #341.
Checklist
main.docs/asset-policy.md.Checked for overlap
play.rs(other defaults and settings; none touches the refresh switches). No open or closed PR or issue mentionsDARNER_REFRESH_ADD_SIFT.🤖 Generated with Claude Code
Tested on a different GPU: RTX 5080 16 GB, Ryzen 7 9800X3D, driver 32.0.16.2140, Windows 11. A/B of
DARNER_REFRESH_ADD_SIFT(0 vs 1) on one build (main47d21cd, release), so the two arms differ only in the switch; the PR changes the play default.Method, following docs/ab-testing.md: 4 runs in the order A B B A (A = sift 0, B = sift 1), same save, standing still at one spot, ray tracing off,
-NoMenu. Each run ended itself 120 s after the world first drew (DARNER_EXIT_AFTER_WORLD_S=120) and wrote per-frameDARNER_BENCH_CSV. Only the world rows were counted (draws >= 500); the draws/frame medians are within 4% within each condition. Done twice: frame generation off, then on (the description's numbers are with it on).Average fps over each 120 s window:
Both differences are inside the within-arm spread: no change we could measure on this machine, with 4 runs and a 120 s window per arm. The 1% low and prep_ms overlap too (frame gen off: p99 A 43.9/36.6 ms, B 37.3/35.7; frame gen on: A 38.8/39.2, B 41.2/39.0; prep_ms median 15.0-17.0 in all runs).
The switch was active in the B runs (the log's "refreshes known to copy nothing left out as they are put among the pending" line). The flush still counted about 87-90% of its refreshes as known to copy nothing in both arms, so most of what reaches the flush is not what the sift rules out.
Not tested: the RTX 4090 numbers in the description, moving scenes (standing only), other GPUs, and more runs - a ~5% effect needs more than 4 runs at this noise.
Drafted with AI assistance (OpenCode).
Test report from a 24-thread CPU: no change here, because the switch finds almost nothing to leave out on this setup.
PC: i7-13700K (8P + 8E, 24 logical processors), RTX 4080 16 GB (driver 621.40), 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, hardware ray tracing on,
DARNER_D3D12_BACKGROUND=0,DARNER_ALIAS_SHARE=1.Build: main
47d21cd+ #334, #337, #457, #274, #397, #312, #304, #303. A = as is, B = the same exe withDARNER_REFRESH_ADD_SIFT=1in the settings file (what this PR makes the default).Method: the opening scene of one save, entered the same way every run (no input after the start screen); medians of per-second values from the host log in three 45-second windows from the moment the world appears; warm pipelines; runs in the order A, B (Reflex boost), B, A (Reflex off), A (Reflex boost).
Why nothing moves, from B's log: the askline counter says 12 refreshes a frame were looked at as they were put among the pending, 2 of them left out. At the flushes the same run still had 9,600 refreshes a frame, 8,412 of them known to copy nothing (A: 9,588 and 8,439). So on this build nearly all refreshes reach the pending list by a path that does not pass the sift; the 15 ms the PR measured may depend on what else was merged in its build (#310, #283, #341) or on the scene.
Not tested: the PR's own build, other scenes, frame generation on.
Test report from an 8-core PC, with the switch set by hand on main
d91d8e4(the PR only changes the default). Short version: no change I can measure while standing still. The first minutes in the world, where the description's numbers come from, I did not test.System. Ryzen 7 5800X3D (8 cores, 16 threads), RTX 5080 16 GB (driver 621.47), 32 GB, Windows 11 26300, 2560x1440.
Build. One exe, main
d91d8e4,cargo build --release --locked -p darner. B addsDARNER_REFRESH_ADD_SIFT=1; its line "refreshes known to copy nothing left out as they are put among the pending" is in both B logs.Start and scene.
scripts\play-nvidia.ps1 -NoMenu -Build release -Dlss balanced -Fps 1000(Series X profile, DLSS balanced, no ray tracing, no frame generation), plusDARNER_DATA_DIR(a save copied fresh for every run),DARNER_SKIP_BINK=1,DARNER_BENCH_CSV. This launcher does not set the switch itself. Standing still in the open world on a daytime save, 30 s to settle and 180 s counted per run; the numbers are from the per-frame CSV over those 180 s. Order A B B A. Other programs used 0.11 to 0.13 of a logical processor during the runs.The scene is CPU-limited here (about 13.3 of 16 logical processors busy), and its draw count cycles between about 6,700 and 14,600 a frame over a minute. So besides the plain numbers I give the frame time at equal draws: one-second means of frame time fitted against draws within each run, read at 10,700 draws.
Four more A runs of the same exe and settings the same morning: 43.64 to 45.11 ms at 10,700 draws, 21.9 to 22.9 fps.
What I see.
preparing per framelines is the same in both (about 30 to 37 ms, refreshes 6 to 7 ms of it).asklinelines say 10 refreshes a frame were looked at as they were put among the pending and 0 of them left out. The flushes still count about 10,100 refreshes a frame, about 9,100 of them known to copy nothing, the same as on A. So in this scene on this build the switch finds nothing to leave out, which is what MesoPlz reports above from another PC.The run set aside. The first A run was slow from its first second in the world to its last: 14.9 fps,
refreshes 38.7 ms in 23 flushesa frame against about 7 in every other run, with the same count of refreshes and the same draws. Same exe and settings as A 2, and the PC was idle. I compared its log with A 2's and found no line that explains it. It was one run in 26 this morning (20 counted, 6 warm-ups); I mention it in case someone has seen the same.Not measured. The first five minutes in the world and moving through it, which is what the description measured. Series X profile only, one PC.
The per-frame CSVs and logs are kept; say so if you want them.
Tested merged on
c8258f9across two 30,000+ frame Series X sessions (RTX 5070 Ti 16 GB, Core Ultra 7 265KF, 64 GB DDR5-6400) withDARNER_REFRESH_ADD_SIFT=1:Refreshes looked at as they were put among the pending (DARNER_REFRESH_ADD_SIFT on): 10–14, 2 of them left out, 0.00 ms looking. Zero visual glitches or missing refreshes; submission lock wait remained0.2 msand submitting thread prep13.3 ms.cargo xtask policy,clippy --all-targets -- -D warnings(default &--all-features), and unit tests all pass cleanly.Thank you @m3m3dub5, @MesoPlz, @iridiumlotus and @MasterWolf, these are better tests than mine.
You are right, and the description claims more than my test can carry. Where my A/B differs from yours:
f3840d7with #310's leave list, #274, #283 and #341, and my own settings file, notmainwithdarner play's defaults.asklineline, so I cannot show how many refreshes the switch left out in my B run. Your logs show it: onmainabout 10-12 refreshes a frame pass it, 0-2 left out, while the flush still sees about 9,600, 8,400 of them known to copy nothing. Leaving out 2 a frame cannot save 15 ms. So my difference most likely came from run-to-run spread or from that other tree, not from this switch.What I will do before asking for anything here: ABBA, 4 runs, on current
main(c8258f9) withdarner play's defaults, both standing still and on the same drive, with theasklineand flush counts from each log. If the switch still shows nothing, I close this PR. The PR is marked WIP until then.(Where the refresh time does go, from a census on the same PC: about 65 % of it is asking the write watch, and in texture memory most pages found written come from streaming's file reads through another view of the same physical pages, which no write at the texture's own address shows. That is where I am looking now; it will be its own PR if it holds.)
[pr-performance][memory] play: refreshes known to copy nothing are left out as they are queued (DARNER_REFRESH_ADD_SIFT=1 by default)to WIP: [pr-performance][memory] play: refreshes known to copy nothing are left out as they are queued (DARNER_REFRESH_ADD_SIFT=1 by default)Same A/B as on #219 (A B C C B A, PGO, 300 s each, RTX 4090 / i9-14900K, uncapped): arm C = main
c8258f9+DARNER_REFRESH_ADD_SIFT=1: 27.3 / 27.5 fps (mean 27.4), median frame 36.2 / 34.9 ms, vs main 24.6 / 27.4 fps (mean 26.0). That's within main's own run-to-run spread, so no measurable effect on current main. Closing; happy to reopen if someone sees a difference on a slower CPU.Pull request closed