VICTORY_READ_WATCH: log which title code reads textures the card writes #4676
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4676
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4675"
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?
@cadfan on GitHub · 2026-12-01 01:31 UTC · original
cadfan:diag/read-watch→main· +568 −0 · 6 files · 1 commits · closed without mergingRefs #4534
What it changes
Why I needed it. In #4534, rivers and pools pushed the player out like a strong current. The logs said nothing was wrong. On the console the CPU sees what the GPU wrote; here, a texture the card writes stays in its host copy unless its kind is copied back (
texback.rs). So the likely cause was the title's CPU reading a texture nobody had copied back. But nothing in the tree could say which texture, or whether the title read it at all.texback.rsalready cites aVICTORY_READ_WATCH=1run of the upstream trace for the ocean's kinds.docs/unified-memory-audit.mdnotes the switch was never built in this tree (U0, and in #2960's description). This PR is that switch.What it does. It is off by default and only turns on with
VICTORY_READ_WATCH=1. When off, each hook is one cached switch check.VICTORY_READ_WATCH_MAX_KB(16 MiB by default) are skipped. So are textures whose kind is already copied back after unordered access.VICTORY_READ_WATCH_EVERYframes, 30 by default), the pages of each registered texture's title memory are made no-access.VICTORY_TEXTURE_BACKtakes it, so it can be tried there straight away), how the card writes it, the code's place, read or write, and the offset.Like
land's reads, it leaves alone the pages the guards hold, and the first page of each 64 KiB block. It changes nothing the title sees: every page is given back as it was, on first touch, on release, or on remap.How it helped (#4534). The fix is the separate PR #4675.
256x256f61). It was read from two places in the title (+0x50313d2,+0x203345d) about ten times a second. Copy-back only ever ran for unordered-access writes, so no list of kinds could have reached it.2048x128f62,4096x64f62,4096x64f57), all zeros.It took three runs from "something in the water is stale" to a fix, and no guessing at kinds.
How it was tested
0b353a75(main of 2026-11-30 plus #3043 and #3487). Frame rate with the watch on was not measured. It is a diagnostic, and it faults once per page per period while on.cargo testpassed for the crates it touches: yes, apart from tests that also fail onmain:dde18b0f),cargo test -p victory-gpu --lib -- readwatchpasses. The tests area_run_split_at_a_touched_page_keeps_both_sidesandan_armed_page_opens_on_its_first_read_and_the_rest_stay_armed. The second arms real pages, reads one through the handler, and checks that the rest stay armed and that disarming restores them.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: clean.cargo test --workspace --locked --no-fail-fast: everything passes exceptvictory-hle'sxmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it. That test fails the same way onmain(7d93ee07) when the crate runs as a whole, and passes alone. Open PR #2439 covers it.card_steps::shared_scratch_eliminates_flight_settle_end_to_end(#2741) failed once, then passed 3 times out of 3 alone, onmainand on this branch.Checked for overlap
VICTORY_READ_WATCH,read watchandtexback, and for the files this touches. Related: #2960 (VICTORY_BACK_READS, per-buffer diagnostics of the memory bridge, diagnostics builds only). That one counts buffer copy-back, refreshes and waits. It doesn't find title reads of textures, so there's no overlap. #4675 (the fix this found). This PR doesn't depend on it, and the two merge cleanly together.@trustno1-coder on GitHub · 2026-12-01 18:35 UTC · original
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