Textures picked by index: after their last recheck they are watched for writes, not let go #4161
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4161"
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 Lyrnc on 2026-11-30T16:53:19Z.
Possibly related, cause not confirmed (see "Not confirmed"): #3409, #3559, #1167, and #3829 #3676 #3288 #3526 #3554 #3882
What it changes
What was wrong. A texture picked by index that is uploaded whole gets five more looks after the upload (
RECHECK_FRAMES = [4, 12, 40, 120, 400]; each look is a 48 KiB fingerprint). After the fifth, about 576 frames or 20-30 s in, the slot isTold::Done(None): it leaves the queue and is never checked again. If the title later rewrites that texture's memory and nothing reports it (no descriptor write, no remap, no page write that reaches the queue), the host copy keeps the old bytes until the slot is written again, which may be never. #3409 (a parked car solid green, at least 200 "a texture picked by index changed after its upload with nothing to tell of it" warnings) and #3559 (that counter past 1,000, wrong-colour ground patches) look like this case, but that is not proven yet.What this does. After its last look the slot is no longer dropped. Its memory is watched by the write tracking that already exists for title memory,
crate::watch::writes_since: the kernel's write watch, or the guards on view memory. That is the same pathStaging::refresh_timeduses for textures read through tables. When the tracking reports a write, the slot is due again the same waytexture_slots_remappedmakes a slot due. Its upload compares the bytes first (texture::unchanged) and the schedule starts over.descriptor/retired.rs(new):RetiredWatch, the slots that are out of the queue after their last look. Each has a record (address, bytes, last fingerprint, the tracking's asking number), and a FIFO holds the frame from which each is next asked about.draw.rs: the last look takes the tracking's asking for the memory before its fingerprint (retired::retire). A write after the fingerprint is then news to the tracking, and a write before it is in the fingerprint. If the look finds the texture as uploaded, the pass tellsTold::Retire(..)where it used to tellTold::Done(None). The decision is now a small pure helper (unchanged_told,last_look). If another thread is already asking about the same memory, the last look is made again 16 frames later, so the pass never waits.TextureQueue::retiretakes the slot out asdonedoes and hands it to the watch.TextureQueue::putdrops it from the watch when it comes back into the queue (written again or made due); it is retired again after its new looks.HostHeap::texture_slots_retired_writtenruns once a frame next totexture_slots_remapped. It asks the tracking about at most 128 retired slots, each at most every 16 frames, within 0.5 ms, without holding the queue's lock while it asks. Slots found written are made due withTextureQueue::changed. Slots that tables read lately stay watched, because the draws bring those up to date, and become due once tables stop reading them.writes_sincereturnsNone) falls back to the fingerprint: at most 4 a pass, and each slot at most every 400 frames (192 KiB a frame at most).textures picked by index after their last look, watched for writes: N slots now; since the start: retired (untracked) / askings / found written and due again / fingerprints.VICTORY_RETIRED_WATCH=0gives the old behaviour exactly: the slot is done after its last look.Cost. The schedule ends so that slots are not fingerprinted for ever on the thread that records the frame (#886 measured about 30 MB a frame of turn hashes on table textures, which found nothing). This change adds no fingerprint reads for tracked memory. Each watched slot costs one tracking query about every 16 frames. For guarded view memory that nothing wrote, that is the lock-free published bits and one journal lookup. For write-watched memory, it is one kernel
GetWriteWatchover the range. The table path makes the same query for each staged texture at every check. A pass is bounded by count (128) and time (0.5 ms). Guarding means the title's next write to a retired texture's 64 KiB blocks faults once, which is how buffers and table textures are tracked already.How it was tested
VICTORY_RETIRED_WATCH=0against the default, Series S 720p DLSS Quality, standing and walking. It compares the warning count, the new line, frame times, and fixed-time shots. I will post the results here.descriptor::host::tests::a_slot_written_after_its_last_look_is_due_again: five looks find the slot unchanged, it leaves the queue at frame 576, a fake write tracking reports a write at frame 650, and the slot is due by frame 666. It fails if the slot is never due again or if watched memory is fingerprinted.a_retired_slot_written_again_leaves_the_watch: a slot written again is queued and not watched, and a retire for an old write changes nothing.draw::recheck_schedule_tests(3): the schedule is unchanged; the fifth look retires the slot with its fingerprint; with the switch off it isDoneas before; a busy tracking retries; painted slots (VICTORY_PAINTED_EVERY) are never retired.descriptor::retired::tests(8): order and per-pass budget; written, later and stale entries; compaction; tracked memory is asked and never read; untracked memory is fingerprinted rarely and a few a pass; memory that stops being tracked is fingerprinted at once.cargo test -p victory-gpu --lib --lockedon top of main84bd61e2: 1144 passed, 2 failed, 66 ignored. All 13 new tests pass. The two failures are in files this PR does not touch, and they come from main:list::thin::tests::bindings_record_no_work("a call is in no list", 47 vs 49) andshader_cache::tests::every_switch_of_the_translator_is_in_the_key(VICTORY_ORACLE_RUNSis no longer read by the translator).cargo clippy -p victory-gpu --all-targets --locked -- -D warnings, and the same with--all-features: nothing in the files this PR changes. The only errors are main's own:shadow.rsrangedis never used,host.rs:5092seed % 3 == 0(manual_is_multiple_of), and, with all features,copystat.rsmbis never used.cargo xtask policy: one violation, from main:crates/victory-shader/src/native.rshas a 560-character hex run. This PR adds no data.cargo testpassed for the crates it touches: the new tests yes. victory-gpu as a whole still has main's two failures listed above.Not confirmed
Checked for overlap
Told::Done. None keeps checking slots after the last look. Related: #2651 (open: tests for the painted schedule. It also extracts this decision into a helper, so the two would conflict trivially), #2605 (open: batches recheck claims), #3551 (open: requeues remapped slots after the table grace), #1573 and #2104 (merged:VICTORY_PAINTED_EVERY,VICTORY_FULL_FINGERPRINT).AI use
Claude Code (Claude Opus 5.5) wrote this change, its tests and this description. No game files or game data are included.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T02:47:15Z.
Bench result for this PR: an A/B by switch in one diagnostics build of
d6b7d9db(on main84bd61e2), run overnight. RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11. Series S, 720p, DLSS Quality, frame generation off (as #3409). Same save, own shader cache, warmed first.VICTORY_RETIRED_WATCH=0, the old behaviour.The warning is written for the first 200 changes and then every 1,000th, so its running total (
changed=) is known only to that step. Fingerprints of untracked memory: 0 in both b runs. No device removed, DRED or "did not close" line in any run.What this shows
What it does not show
AI use: Claude Code (Claude Opus 5.5) ran these on our bench queue, parsed the run logs and frame files with its own scripts, looked at the shots locally, and wrote this comment.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:46:24Z.
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed