Copies remember the ranges they took whole: a page part asked for again is not read again unless written #3818
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3818"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by stasadance on 2026-11-30T08:21:24Z.
What it changes
A copy remembers only the last and the longest range it took whole (
ranged). Draws ask for parts of the same 64 KiB pages again in every submission, andcopiednotes a page only when a refresh holds all of it. So a part of a page that was asked for again after other ranges of the copy were read was read again from title memory, compared, and found unchanged. In a drive the frame line read "copies 23.3 ms 82.8 MB" a frame, while only 17.0 MB a frame was actually sent up: about 60 MB a frame were read and compared for nothing.Each copy now also keeps a small memo of ranges it took whole, a slot each by the hash of the range's ends (
range_memo,memo_slot), under the same lock and SeqLock asranged. A range asked for again is known as taken whole unless it was written since. Copies of one 4 KiB page or less don't get a memo.VICTORY_RANGE_MEMO=0goes back to the two slots alone.How it was tested
cargo testpassed for the crates it touches: nativecargo testcannot buildvictory-gpuon a Linux host (same on main), so no;cargo xwin clippyfor the Windows target adds no warning over current main.Checked for overlap
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-30T08:55:41Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoruiopz on 2026-11-30T09:31:57Z.
Independent .05 check at exact PR head
8ab3c0342on an RTX 5070 Laptop (8 GB). The locked Windows diagnostics executable built and played. I used the same executable, copied save, input tape, warm cache, Series S 640×360 rendered through DLSS Ultra Performance to 1080p, frame generation off. Each run settled for 25 seconds after the world loaded, then recorded a 21.5-second window with 16 pose-matched screenshots. Only VICTORY_RANGE_MEMO changed. The order was off/on, then on/off.FPS and copy values are medians of the in-window host reports. Frame p99 uses the CSV frames with 3,500–7,000 draws. Each run had one fully retained 10-second soft-view report. Memo-on recorded 85 and 92 memo-only refresh skips per frame. This shows fewer soft-view bytes and moderately lower copy volume on this route. The rendered FPS was close across the pairs, and the upper tail was longer with the memo enabled. Each condition was only sampled twice in this fixed porch scene.
I also ran a CPU-only regression twice in fresh processes at exact head plus this optional test commit. The test displaces both legacy notes so only the memo can skip the unchanged partial range, then writes a byte through a second mapping. Both VICTORY_RANGE_MEMO=0 and =1 passed. The memo skipped the unchanged reread, and both paths subsequently copied the edited byte and matched all 128 KiB of expected CPU-side data.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by stasadance on 2026-11-30T09:37:07Z.
Thanks @Yoruiopz, that A/B is exactly what this needed. Looking for what could lengthen the tail, I found one real cost: to count
MEMO_SAVED, every look the memo answered was evaluated a second time with the two slots alone, on nearly every look rather than just the memo-only skips. That second pass repeatspublished()(which can maketell_watch()scan the heap) and theOWNED/JOURNALread locks that title-side writes take for writing, so the submitting thread and the title's writers block each other more. It's diagnostics-only now (the new commit on this branch); release builds no longer do it.Two other effects I'd expect, both smaller: one extra cache line read per look for the memo slot, and written pages inside memo'd ranges going through the parts path (
again_at) instead of one plain run, which moves fewer bytes but holdscopy_locka little longer. If you rerun, more pairs plus the lock-wait line would show whether the tail moves.