Skip to content

Lazy landing and lazy fetch: what the GPU writes to memory the CPU never touches stays on the card (VICTORY_LAZY_LAND=1, VICTORY_LAZY_FETCH=1, on top of #1038) - #1184

Closed
urielbeaupre wants to merge 13 commits into
trustno1-coder:mainfrom
urielbeaupre:perf/lazy-land
Closed

urielbeaupre wants to merge 13 commits into
trustno1-coder:mainfrom
urielbeaupre:perf/lazy-land

Conversation

@urielbeaupre

@urielbeaupre urielbeaupre commented Nov 28, 2026 •

Copy link
Copy Markdown

Depends on #1038. This branch is #1038's two commits plus the ones here. Lazy landing only works on the write-watched private memory #1038 adds.

The finding

Every frame the GPU writes a 21 MB buffer (0x1412200, from XMemAllocDefault). The layer then does this with it:

  1. Lands it: fetches the card's bytes and merges them into title memory (land::piece → safecopy::merge), about 22 MB a frame.
  2. Echo-checks it: right after, the copy's own refresh reads all of it back from title memory (Shadow::take → take_landed → host::read) to see whether the CPU changed it.

The title never touches it. A fault probe, included here as VICTORY_READER_PROBE_LEN=1412200 (test only, off), makes the buffer's pages inaccessible once a second and records who faults, with the call chain. Over a full 165 s run there were 2 callers, both ours:

caller page touches share
host::read ← Shadow::take (refresh / echo check) ~350,000 66%
land::piece ← Shadow::land_card (landing merge) ~220,000 34%

The title's code made none. The buffer is still needed: skipping its landing outright (VICTORY_LAND_NEVER_LEN=1412200, test only) makes the echo check read stale title memory and send it up over the card's bytes, and the scene goes low-poly. So the GPU → title memory → GPU round trip has a consumer, but that consumer is only the copy itself.

The change: lazy landing (VICTORY_LAZY_LAND=1, off by default)

For a copy that lies whole in private write-watched memory (title_memory_private, marked from #1038's watched_reservation), is at least 1 MiB long and has no other live copy over it:

  • Landing: the card's bytes go into the copy's CPU side only. Those 4 KiB pages are marked ahead and made PAGE_NOACCESS. A page becomes ahead only if the landing covers all of it and title memory still equals the copy's CPU side. That compare runs with the page read-only first, so no title write can slip in.
  • Refresh: the copy skips its ahead pages and is stamped up to date with them (Shadow::landed_ahead). It does not re-read 21 MB a frame.
  • Other readers: textures, descriptors and other trackers are told the pages were written (Notes::ahead → watch::landed_beside). They re-read, fault, and get the GPU's bytes.
  • Demand: a vectored handler, first in the chain, catches any access to an ahead page. It makes the page read-write, copies the copy's CPU side in, one 4 KiB page at a time, then retries the access. host::read, write_mapped and the kernel-write hooks land their range first.
  • Back-off: more than 64 pages landed on demand in a second, or a new copy over the memory, turns lazy off for that copy for good (logged once).
  • Lifetime: freed or unmapped memory drops its ahead state and goes back to read-write. A dropped copy lands its pages first.
  • Locking: one RwLock per copy slot. Landing and refresh take it shared and never touch an ahead page under it. The fault handler takes it exclusively. A thread-local guard keeps a thread from re-entering. ASSIGN is always taken before a slot lock.

The log line, every 5 s:
lazy landing (VICTORY_LAZY_LAND=1): N copies lazy, X MB a frame landed into them alone (not into title memory), Y MB ahead now; per frame F faults on pages ahead, P pages landed on demand; K copies turned off since the start

In the runs below it reads: 1 copy lazy, 19.9 MB a frame, 0 faults, 0 turned off.

Measured

RTX 4070 Ti 12 GB, Ryzen 9 7900X, Series S profile, DLSS off, the same save, warm cache. One build, switches alternated. Cutscene = seconds 60–110 after input; after = 110–165.

Lazy landing on top of the write watch (VICTORY_LAZY_LAND 1/0, both with the write watch):

run lazy cutscene fps CPU preparing after scene change copying (60–165 s)
C1 on 41.5 18.2 ms 25.5 10.8 ms
B1 off 38.0 21.2 ms 24.1 13.3 ms
C2 on 41.4 17.7 ms 27.0 9.9 ms
B2 off 39.3 19.8 ms 24.6 12.4 ms

That's +2.8 fps in the cutscene (+7%) and +1.9 after the scene change (+8%), with 2.6–4.4 ms less CPU preparing a frame. Draw counts match on and off (about 1,400 in the cutscene, 3,400–3,750 after), and nothing looks different on screen.

Against main's behaviour, from an earlier rotation the same afternoon (the write watch off: 36.0 / 23.7 fps, see my second comment on #1038): #1038 alone gives about +2 fps, and with this on top it's about +5.5 fps (+15%) in the cutscene and +2.6 (+11%) after the scene change.

Lazy fetch (VICTORY_LAZY_FETCH=1, needs VICTORY_LAZY_LAND=1, off by default)

With lazy landing, the relay still fetched the lazy copy's flagged pieces every frame: a readback list and a wait, 6–7 ms of "copying back", only to put them in a CPU side nothing reads. With lazy fetch, those pages are not fetched at all.

  • Claim: pages of a lazy copy's flagged pieces are "claimed" by the card (Shadow::claim_card_only). They are marked card-only and NOACCESS, other readers are told they were written, and the copy is noted up to date. A page is refused if it has title bytes the card may not have: dirty, or sent after the fetches merged so far.
  • Never sent up: card_dirty leaves card-only pages out. If something marked one of them to go up, it is fetched first, then sent as the card's own bytes.
  • Demand: any touch goes to one fetch thread with its own copy queue: one CopyBufferRegion, no waits on other queues or fences, all D3D objects made at the first claim. It fetches every card-only page, lands them, and turns the copy off for good. The touching thread holds none of our locks while it waits, and the wait is timed, so the process can still exit. Flights still in the air are not waited for: their own landings merge what differs.
  • The log line adds: MB a frame not fetched, MB the card alone holds, fetches on demand, and why pages were fetched all the same.

Measured against lazy landing alone (same build, VICTORY_LAZY_FETCH 1/0, same setup as above). In game: 20.1 MB a frame not fetched, 0 pages refused, 0 fetches on demand, 0 errors.

run lazy fetch cutscene fps CPU preparing after scene change copying back
F1 on 42.9 18.8 ms 26.5 4.9 ms
L1 off 40.0 20.1 ms 25.1 6.7 ms
F2 on 41.8 19.3 ms 26.1 4.5 ms
L2 off 40.2 19.7 ms 24.7 6.5 ms

That's +2.3 fps in the cutscene and +1.4 after the scene change (both about +6%), with copy-back about 1.9 ms shorter. Draw counts match.

All together, in the cutscene: main about 36 fps → #1038 about 38 → lazy landing about 40 → lazy fetch about 42, roughly +17%. After the scene change: about 23.7 → 26.3 (+11%). These come from rotations in several sessions the same afternoon, so the total is approximate. Each step is measured against the one before it, in the same session.

Tests

  • cargo test -p victory-gpu --release --lib: the 12 new lazy tests pass. They cover the bitset and part arithmetic, eligibility, back-off and turn-off, the claim racing land_range, card-only pages never going up, a demand fetch bringing the card's bytes in, and the full path on real memory:
    • title memory stays stale after a lazy landing;
    • a CPU read, a write and read_into fault and get the GPU's bytes;
    • a refresh skips ahead pages, and the lazy copy copies 0 bytes while another tracker is still told;
    • freed memory keeps no NOACCESS pages;
    • several landing threads run with a concurrent reader.
  • indirect::tests::host_list_budget_starts_empty_at_each_submission and warp_batch_charges_every_execution fail, but they fail the same way on perf(xmem): write-watch large XMemAllocDefault allocations #1038's head without these commits.
  • cargo test -p victory-hle --release --lib: 183 passed.
  • Before opening this, independent reviews covered the locking, the demand path, readers outside the copies, the integration with perf(xmem): write-watch large XMemAllocDefault allocations #1038 and lazy fetch. Each issue they found is fixed in its own commit here.

Known limits

  • Kernel calls the runtime passes straight through (WriteFile, send/sendto from title memory): these would fail on an ahead page instead of faulting. The probe saw none of them on this buffer.
  • Copies that other copies overlap are never lazy. Lazy turns itself off when one appears.
  • Related: gpu: retain certified section pages until CPU demand #420 aims at the same idea (keep GPU-produced bytes until the CPU asks) for section-backed pages. This covers private write-watched memory only.

🤖 Generated with Claude Code

shreezzz and others added 8 commits November 28, 2026 07:44
Keep large write-watched XMemAllocDefault reservations out of the low 4 GiB reserved for ADDRESS_32BIT / ALLOC_32BIT requests and honor the 64-bit upper bound from address_range(0), with regression checks across min, 64 KiB, and 2 MiB alignments.

Assisted-by: OpenAI Codex, Google Gemini
…EADER_PROBE_LEN (who touches its title memory)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ys in it (VICTORY_LAZY_LAND=1, off by default)

The title's 21 MB XMemAllocDefault buffer is written by its shaders every
frame and never touched by its CPU (fault probe over 165 s). Landing it put
~22 MB a frame into title memory, and the echo check read it all back.

For a copy in the card's memory whose title memory lies whole in a
write-watched XMemAllocDefault block, at least 1 MiB long, with no other
copy over that memory (crate::lazy):
- a landing puts the card's bytes into the CPU side alone for 4 KiB pages
  the piece holds whole, that the card changed, and whose title memory
  equals what the copy held (looked at with the page read-only); those
  pages are "ahead" and made PAGE_NOACCESS (one VirtualProtect per run);
- a refresh (take / take_landed / copy) leaves pages ahead out;
- a vectored handler, registered ahead of crate::watch's, lands a page on
  its first touch (the title's, or our safecopy readers') and lets the
  access go on; our kernel-path reads/writes (host::read, write_mapped)
  and the runtime's kernel writes (kernel_writing, kernel_will_write)
  land the range first;
- freeing/unmapping drops pages ahead (no NOACCESS left behind), a dropped
  copy lands its pages; more than 64 pages landed on demand in a second,
  or another copy made over the memory, turns the copy off for good.
Locking: one RwLock per slot, shared by landing and refresh threads (which
touch no page ahead and wait for nothing under it), alone for demand; a
thread-local count keeps a faulting lock holder from waiting on it again.
INFO line every 5 s with copies lazy, MB a frame left ahead, faults and
pages landed on demand per frame, copies turned off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 7ae6318:
- A lazy landing wrote no title memory, so the write watch never named
  its pages, and nothing else that reads the memory by the journal
  (textures, descriptors, other trackers) would take them again. Pages
  left ahead now go into the job's land::Notes (Notes::ahead) and are
  noted at its flush as a landing beside the guards is
  (watch::landed_beside: the journal with a new asking, LANDED,
  descriptor::host::remapped). Those readers take them again and fault
  them in; one that does so often turns the copy off by the back-off.
  Replaces watch::landed_ahead. Test: a tracker over write-watched
  memory is told of a lazy landing, and reads the card's bytes.
- land_ahead made a whole run read-write before copying into it, so a
  thread's write in between was put under older bytes. Pages are now made
  writable and copied one at a time (the window is one 4 KiB copy, for a
  page nobody has seen since it went ahead; private memory has no second
  view to write through). Runs that are only dropped stay batched.
- The count of pages ahead goes up with their bits (before read-only), and
  is read with Acquire by land_range and not_ahead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
673ebb8 noted pages left ahead as written for every reader, the lazy copy
too: no copy was noted as up to date with them (Notes::ahead pushed a null
copy), so the lazy copy took its whole span as written at every refresh,
only to skip it (copies MB back from ~40 to ~60 a frame).

Notes::ahead now takes the lazy copy, and the flush notes it as up to date
with a block whose noted pages all came through it, ahead
(Shadow::landed_ahead): if it was up to date with the block's last write
before. Without Shadow::landed's guard bit: lazy copies are of
write-watched private memory, where a title write not noted yet is in the
kernel's bits and comes with a later number, so pages of the block landed
as before (the title wrote them) are still taken again. A block with
entries beside the guards and ahead is noted for neither.

Test: the lazy copy has nothing to refresh after three landings while a
tracker is told each time; a page of the block the title wrote is taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alxspb added a commit to Alxspb/VIctory-NVIDIA that referenced this pull request Nov 28, 2026
…are matcher

Merged-in trustno1-coder#1184 met trustno1-coder#933 lock-free copied[] and trustno1-coder#884 Spare::take matcher; adapt both calls instead of reintroducing a lock.
Urielbeaupre and others added 3 commits November 28, 2026 17:06
…_LAZY_FETCH=1, off by default)

With lazy landing (VICTORY_LAZY_LAND=1) the 21 MB buffer's flagged pieces
were still fetched every frame (a readback list and a wait, ~5-6 ms of
copying back) only to go into a CPU side nothing reads.

crate::lazy::fetch: relay_card_back claims the pages of a lazy copy's
flagged pieces that may stay with the card alone (Shadow::claim_card_only):
pages ahead already, or pages made ahead as a lazy landing does (title
memory equal to the CPU side, looked at read-only, then NOACCESS); none with
title bytes the card may not have (dirty, or sent since the merged fetches).
They are not fetched, are marked "the card's alone" (State::cards), and are
told as written to every other reader with the copy noted up to date
(Notes::ahead). The rest of each piece is fetched and landed as before.

Nothing of them goes up: card_dirty leaves them out (Shadow::without_cards),
every refresh leaves out pages ahead, and whatever else writes the CPU side
there touches title memory first. The card's hashes are its own, so the
next frame's flags stay right.

On demand (the title's fault, host::read, kernel-write hooks, card_merge,
drop, turn-off) all of a copy's card-only pages come down at once on a
thread of its own, through its own copy queue (one CopyBufferRegion, no
waits on other queues or fences), into a readback buffer made at the first
claim; the CPU side and title memory take them, every page lands, and the
copy lands as before from then on. The asker waits with no lock of ours
held; the fetcher takes only the slot's lock. In-flight flights are not
waited for (that could wait on the faulting thread); their own landings
merge what they change. Freed memory drops card-only pages.

The 5 s line adds MB a frame not fetched, MB the card alone holds, and
fetches on demand. Test: claimed pages are left out of what goes up, a page
with bytes to go up is fetched, and the title's read brings the card's
bytes into title memory and the CPU side. Also: the back-off test reads
enough pages for a slow machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In game lazy fetch never claimed a page. A copy keeps the notes of what it
sent up (`Card::sent`) until it sends again (card_dirty forgets them only
for copies it touches), and a lazy copy sends nothing once it is lazy: its
first send, all of it, stayed noted for ever, and claim_card_only avoided
every page as "sent, maybe not received". Only sends after the fetches
merged so far (RELAY_FETCHED) are avoided now, as the merges themselves do.

The 5 s line now says why pages of flagged pieces were fetched all the
same, per frame: the copy could leave none, not whole in the piece, title
bytes the card may not have, title memory differed. Test: an old send over
the whole copy does not keep pages from the card, a newer one does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- land_range looked for pages the card alone holds under the shared lock,
  then landed under the lock alone without looking again: a claim in
  between (pages ahead made the card's) had the stale CPU side land and the
  card bit cleared, the card's hashes matching, never flagged again. It
  looks again with the lock held alone and fetches then. Test: a claim run
  in that gap (a test hook) ends with the card's bytes.
- card_dirty dropped bytes to go up that met pages the card alone holds.
  Nothing should mark those; if something does, they come down first
  (fetch_if_cards, logged once) and go up as the card's own bytes. Test.
- A wait for the fetching thread is timed: if the thread is gone (the
  process ends), the pages land with the CPU side's bytes and that is
  said, instead of waiting for ever; a panic there fails the process.
- The fetching thread logs only after the asker is told, allocates
  nothing on the way; the driver locks it may wait for are documented.
- card_merge and card_merge_relay fetch only pages the card alone holds
  (before_compare); pages only ahead fault in as before 0ea8d5e's parent,
  so lazy landing alone is as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
465d6a0eac added a commit to 465d6a0eac/VIctory-NVIDIA-Experiment that referenced this pull request Nov 28, 2026
Urielbeaupre and others added 2 commits November 28, 2026 17:19
RELAY_FETCHED says later merge-fetches are queued behind these sends, not
that the card ran them: with no relay copy queue and nothing to fetch it
rises to the current QUEUE_ORDER, past sends queued behind flights in the
air. A claim ignoring such a send S, then a demand fetch on its own copy
queue before S runs, would lose S's title bytes for good (the hashes
match, nothing is flagged again).

CARD_RAN: the sends the card has run - the largest sent_as of the flights
being landed, the sends behind a fetch that was waited for, and all of
them at the end of a waited submission. claim_card_only avoids sends
after it. Steady state is as before: a lazy copy's notes are of its first
send, which every later landed flight ran behind.

Test: a send queued ahead of the merge-fetches but not run still keeps
its page from the card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ExitProcess can end the fetching thread while it holds a slot's lock (held
through its wait for the card, up to 60 s) or WANT: the fault handler,
land_range, let_go, freed and abandon then waited for ever. Now, once the
thread is gone (stuck: started, its handle signalled), nothing waits for
those locks: slot locks are taken with try_write in a bounded loop, WANT
with try_lock, and the fetch is waited for by polling a per-slot served
id, not a condvar that would take WANT back. Giving up makes the slot's
pages read-write as they are (older bytes, acceptable at exit) and says so
with OutputDebugStringA, which takes no lock of ours.

fetch_if_cards keeps overwriting what was marked to go up on pages the
card alone holds with the card's bytes (logged once): nothing can have
written those bytes legitimately, as title memory there is inaccessible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@urielbeaupre urielbeaupre changed the title Lazy landing: what the GPU writes to memory the CPU never touches stays out of title memory (VICTORY_LAZY_LAND=1, on top of #1038) Lazy landing and lazy fetch: what the GPU writes to memory the CPU never touches stays on the card (VICTORY_LAZY_LAND=1, VICTORY_LAZY_FETCH=1, on top of #1038) Nov 28, 2026
@urielbeaupre

Copy link
Copy Markdown
Author

@POMXARK @tippythetaidum @Bj0rnis: you ran careful A/Bs on #1038 and #1014 today. Would you be up for one on this? It stacks on #1038 (this branch includes its two commits), so the comparison is #1038 alone against #1038 plus this. Both switches are off by default:

The log line every 5 s shows whether it engaged. When it works it reads something like 1 copies lazy, … 20.1 MB a frame not fetched at all, … 0 fetches on demand … 0 copies turned off. If it says 0 copies lazy, or the "fetched all the same" counters are non-zero, please paste that line: it means your setup takes a path I haven't seen yet.

What I'd most like to know:

  1. fps and copying back / preparing with it on and off, at your usual draw-count buckets;
  2. any visual difference (missing detail or low-poly LODs would point at the buffer being stale);
  3. on Linux/Proton, whether 0 fetches on demand holds.

On my RTX 4070 Ti / 7900X (Series S, DLSS off) it measured +2.8 fps on top of #1038, then lazy fetch added +2.3 in a cutscene, with copy-back about 2 ms shorter. Results on an RTX 5080 at 1440p with DLSS would show whether that holds where the frame is more GPU-heavy.

🤖 Generated with Claude Code

@Marsietiss

Copy link
Copy Markdown

Thanks for the lazy landing work. We ported #1184 onto our tree and found one stale-read path; the fix applies cleanly on top of this PR's head (b126a98), so here it is as a commit rather than a PR (this PR's head is in a fork, so I could not target it): https://github.com/Chezzuss/VIctory/commit/5ba8b55fc09e41889da3271bc7f0f193c539d7eb (branch fix/lazy-keep-ahead, 3 files, +108/-4 incl. a test).

What we saw: with VICTORY_LAZY_LAND=1 the title read stretched car geometry; with it off the same scene was fine. Cause on our side: the write watch (watch.rs) calls VirtualProtect on whole 64K blocks (guard, unguard, arm, alias). Where a block covers pages a lazy copy holds ahead (PAGE_NOACCESS), that call reopens them as RW/RO, so the title reads the stale title bytes through the opened page with no fault, and the card's bytes never land.

Fix: lazy::keep_ahead(at, len) re-closes the pages ahead (under the slots' shared lock) after each watch protect, and lazy::guardable(at, old) accepts a PAGE_NOACCESS first page when that page is ahead, so the watch's "not ours, put it back" check does not misfire. A counter in the lazy log line reports pages re-closed per frame. cargo test -p victory-gpu --lib lazy passes, including the new a_protection_over_pages_ahead_does_not_open_them.

Caveat: I only checked that it builds and the lazy tests pass on this head; the in-game confirmation was on our merged tree (which has more write-watch changes than this PR), so please treat it as a lead, not as proof for your base. Happy to adapt it if the watch code differs.

@urielbeaupre

Copy link
Copy Markdown
Author

@Marsietiss thank you, that's a precise diagnosis. I couldn't fetch the commit: https://github.com/Chezzuss/VIctory returns 404 for both the repository and 5ba8b55 (it's private, or it was taken down). Your description is clear enough to implement from, so I'll do it here and credit you in the commit:

  • lazy::keep_ahead(at, len): after each VirtualProtect the write watch makes over a 64 KiB block (guard, unguard, arm, alias), pages a lazy copy holds ahead are made PAGE_NOACCESS again, under the slots' shared lock;
  • lazy::guardable(at, old): the watch's "not ours, put it back" check accepts a PAGE_NOACCESS first page when that page is ahead;
  • a re-closed-pages counter in the lazy log line, plus a test for a protection change over pages ahead.

I'll also log on this base how often the watch touches blocks with pages ahead at all, to see whether the path is reached here or mainly on trees with more write-watch changes. If it's convenient, a git format-patch of 5ba8b55 pasted here would still be useful to check my version against yours.

On the flickering ground you saw with #1038: noted. If I can reproduce it here, I'll report which allocation it is.

🤖 Generated with Claude Code

@Marsietiss

Copy link
Copy Markdown

Follow-up: the commit link above points into a private repo, sorry. The same fix is now public in our fork Mangrove:

Same caveat as before: builds and lazy tests pass on your head; the in-game check was on our merged tree. Thanks again, @urielbeaupre.

krolyxon added a commit to krolyxon/VIctory-NVIDIA-proton that referenced this pull request Nov 28, 2026
krolyxon added a commit to krolyxon/VIctory-NVIDIA-proton that referenced this pull request Nov 28, 2026
Conflicts:
- watch.rs: trustno1-coder#933's protect_here/protect_run split kept, upstream's soft
  views parameter passed through both.
- shadow.rs: upstream's has_pending and PageMerge landing loop taken (on
  trustno1-coder#1298's copied tuple); trustno1-coder#1184's lazy landing applied to upstream's
  outside_sorted_into parts.
- pool.rs: trustno1-coder#814's take_from_with (one empty block made ahead) kept; its
  base is the same trustno1-coder#661 change upstream merged.
- card_steps.rs: upstream's taken whole (VICTORY_PLACED_FILLS, trustno1-coder#740);
  trustno1-coder#1298's card_steps part dropped.
- draw.rs: upstream's trustno1-coder#532 values; trustno1-coder#814's cached slot handle kept inside
  upstream's rest() timing.
- descriptor/host.rs: upstream's TextureQueue ordering taken whole; trustno1-coder#814's
  VICTORY_DUE_FRESH_FIRST and its play.rs default dropped. A test module
  both sides added was kept once.
- emit/mod.rs, send.rs: both sides kept.
bigboss22869 added a commit to bigboss22869/VIctory-RTX5070Ti that referenced this pull request Nov 28, 2026
…o1-coder#1038's write-watched large XMemAllocDefault) for measuring

Conflicts with this fork's trustno1-coder#1014 port resolved by keeping both (lib.rs exports,
title_memory_freed). VICTORY_LAZY_LAND and VICTORY_LAZY_FETCH stay off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bigboss22869 added a commit to bigboss22869/VIctory-RTX5070Ti that referenced this pull request Nov 28, 2026
…he guard (VICTORY_STORE_BESIDE=1, VICTORY_COPY_BESIDE=1)

RTX 5070 Ti at the deck, native 1440p, no DLSS (2026-11-28): 44.0 ms against 45.0,
preparing 28.9 against 33.9 ms, copies 12 against 17 ms; the picture as before.
Also in play-foxhound.ps1, which the desktop shortcut uses. Measured and left
off: VICTORY_HELPER_PRIORITY=1 (46.3), fewer pool threads (47.3),
VICTORY_FAULT_UNLOCKED=1 alone (46.0), lazy landing of trustno1-coder#1184 (45.0-45.1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@urielbeaupre

Copy link
Copy Markdown
Author

Closing this, because current main no longer has the cost it removes.

I rebased it onto main 32ecacf (with #1038's two commits; no conflicts, 491 tests pass) and added the keep-ahead fix Marsietiss reported. My version keeps the pages ahead NOACCESS throughout the watch's protections instead of reopening and re-closing them, and the lock order can't deadlock. Credit to Marsietiss/Mangrove@d9aec2a. In game on that base, lazy landing never engaged, so I added an always-on diagnostic. With main's launcher defaults (Series S, RTX 4070 Ti) it reads:

2 write-watched XMemAllocDefault blocks (92 MB); copies made 7,793, 0 of them of 1 MiB or more in such a block;
asked at landings 3,121, lazy 0; turned down: 3,120 under 1 MiB, 1 not in a write-watched XMemAllocDefault block

The 21 MB buffer (0x1412200) that went GPU → title memory → echo re-read every frame on 63b902f isn't copied back on current main at all: copy-back is down to ~3.8 MB of new bytes a frame. So there's nothing for this PR to keep on the card, and reviewing it would only cost time.

For the record, in case that buffer comes back (e.g. with the structure builder on):

  • on 63b902f + perf(xmem): write-watch large XMemAllocDefault allocations #1038, lazy landing gave +2.8 fps in the opening cutscene and +1.9 after the scene change, and lazy fetch added +2.3 / +1.4 more (tables above);
  • the reader probe (VICTORY_READER_PROBE_LEN) showed that only the layer touched that buffer, never the title;
  • the rebased branch with the keep-ahead fix and the diagnostic is urielbeaupre/VIctory-NVIDIA perf/lazy-land (I'll push the rebased version there so it isn't lost), if anyone wants to pick it up.

Thanks to everyone who reviewed and tested it, and to Marsietiss for the keep-ahead report.

🤖 Generated with Claude Code

@POMXARK

POMXARK commented Nov 28, 2026

Copy link
Copy Markdown

@urielbeaupre @Marsietiss — confirming your closing finding independently on an RTX 5080 16 GB (Ryzen 7 5700X, 32 GB RAM, Windows 11, Series X 1440p, DLSS Quality + MFG 4x, release build, 20-minute A/B on top of #1038 + Marsietiss/Mangrove@d9aec2a):

  • Unit tests (--release --lib -- lazy --test-threads=1): 14/14 PASS (1.04s), including a_protection_over_pages_ahead_does_not_open_them.
  • 20-minute run (VICTORY_LAZY_LAND=1, VICTORY_LAZY_FETCH=1, VICTORY_LAND_SKIP=1, VICTORY_WC_NO_BACK=1):
    • 0 errors, 0 visual regressions, 0 lazy landing engagements over the entire 20 minutes — matches your diagnostic exactly because copying back is already down to 0.7 MB/frame on current main settings.
    • Run ALL 3D p50 1k–4k 4k–7k 7k–10k Submitting med Copy-back med
      Baseline (#1038, lazy off) 14.80 FPS 16.05 14.80 11.50 59.3 ms 13.6 ms / 0.7 MB
      #1184 + d9aec2a (lazy on) 14.05 FPS 15.10 13.65 10.20 67.9 ms 10.8 ms / 0.7 MB

Good call closing it for current main defaults — and great to have the rebased perf/lazy-land branch + keep_ahead fix archived if large copy-backs return with RT/structure-builder work!

krolyxon added a commit to krolyxon/VIctory-NVIDIA-proton that referenced this pull request Nov 29, 2026
Conflicts:
- shadow.rs: upstream's Copied { pages, ranges } replaces trustno1-coder#1298's tuple;
  trustno1-coder#1298's batched nothing_new_with keeps its shape on it (Copied::ranged
  replaces ranged_in); trustno1-coder#1184's lazy landing and its tests follow (pages,
  arena). An unused copy_all of trustno1-coder#1298's and the VICTORY_WIDE_CHUNK tests
  (helpers dropped earlier) are left out.
- watch.rs: trustno1-coder#1062's owned memory is told in asked() beside trustno1-coder#1298's binary
  search, and counted as known by is_published() (so the batched
  nothing_new sees it too, sampled before the journal's lock).
- structure.rs: upstream's trustno1-coder#1103 (ours came adapted through trustno1-coder#1226).
- lib.rs: both modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants