Write watch: a submission's askings hold only the pages they ask about #697
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/697"
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 0xkn0wh3r3 on 2026-11-28T03:38:47Z.
What
A submission's two write-watch askings now hold only the pages they ask about, instead of all memory.
ask_aheadandask_resteach tookAsking::hold_all(). So every submission's asking waited for every other asking in the process to end, and made every other asking wait for it. Other threads ask while a submission is being prepared:With the change they only wait for each other when they ask about the same pages, which is what the hold is for.
VICTORY_ASK_HOLD_ALL=1restores the old behaviour.How
Askings(watch.rs): a new hold of several page ranges, taken all at once or not at all. Two threads that each hold several ranges can never wait for each other in a circle. It uses the sameASKINGlist and condvar asAsking, so the two kinds of hold exclude each other.ask_ahead: works out its runs first, then holds exactly those runs. That includes the pages between a run's pieces, since the kernel's asking walks and resets those too. The hold lasts until the answers are in the journal, as before.ask_rest: works out the rangesask_aheadleft, holds them, and asks exactly those ranges.aheadinstead of taking it out while it asks. Holding only its own pages, it now lets other threads ask meanwhile, and the journal goes on answering them for whatask_aheadasked.Tests
watch::ask_holds::ranges_are_merged_in_order_and_told_apartchecks the range helpers (merged,overlaps).watch::ask_holds::an_asking_waits_only_for_the_pages_it_asks_about:host::refresh_tests::askings_of_other_threads_beside_a_submission:one_submission). The layer prepares one submission at a time, but in the test processunchanged_ranges_are_knownasked as a submission does alongside other tests' submissions.refresh_tests::withwatch::40 times, the new test above lost a copy in 4 runs with page holds and in 1 run with all-memory holds. It never failed in 60 runs on its own.cargo test -p victory-gpu --libon this branch: 455 passed, 0 failed, both with the switch on and withVICTORY_ASK_HOLD_ALL=1, three runs and two.refresh_tests::+watch::+ask_holdsand ofmany_askers_tests, in both modes: no failures.cargo clippy -p victory-gpu --all-targets: 3 warnings, the same 3 asmain.Performance, before and after
Not measured in the game yet. In unit benchmarks the askings don't contend, so they show nothing either way. The expected effect is that the submitting thread no longer waits for the heaps' thread's asking and guarding, nor the other way round, when they ask about different memory.
The diagnostics build's "ranges held" figure in
watch::lock_waitsshows the waits per frame. Comparing a run withVICTORY_ASK_HOLD_ALL=1against one without will say how much this saves.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ArturoWolff on 2026-11-28T03:52:52Z.
Linux/Proton actual-title A/B of your exact head
3055afdc724079de319f73df611d1f1e6699c1be(base.108fc22547), since your description notes that the range-hold timing hasn't been measured in the game yet.RTX 4060 desktop 8 GB, 16 GB system RAM, GE-Proton11-14 / vkd3d-proton 3.2.0. One locked MSVC release executable with
--features diagnostics. Both arms retain our identical previously described Linux backing/DXC adaptations and one-second read-only renderer-clock observer (details and previous baseline). Fresh separate external caches, same cloned prefix seed, Series X1080to1440, 30 cap, DLSS/FG off, full requested RT/water effects, write-back and waits intact; both advanced without recorded input. The effective graphics/settings headers differ only inVICTORY_ASK_HOLD_ALL=1versus0.Whole-interval ranges-held values, in order, are
0.03, 0, 0, 0, 0.10, 0.99, 0.85, 1.43, 1.28, 2.14versus0, 0, 0, 0, 0.02, 0.39, 0.95, 1.53, 0.78, 1.03ms/frame. These are the diagnostic's aggregate acquisition times across all threads, not a critical-path timing or FPS gain. The intervals and loading artwork are not exactly scene-matched; this is one cold-cache pair, not a statistical performance conclusion. The result is consistent with lower range-lock acquisition cost in this startup workload.Both arms ended during the existing #628 loading failure, after visible artwork and black overlay. The final clock sent/completed and started/finished counters caught up respectively to 3761/3761 and 3686/3686, stationary for the last 28.05 and 16.03 sampled seconds. No device-removal/fence-error report, OOM delta, memory-guard stop or recorded kernel GPU fault in either run. Both created the previously refused compute pipeline and the two DXC fallbacks succeeded. No live-world correctness or performance established. The range-lock optimization is not sufficient to restore world entry on this configuration; useful to revisit once active gameplay can be measured.
AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CuteBooty on 2026-11-28T04:42:08Z.
Open-world numbers for this PR from an 8 GB NVIDIA card, to go with the startup A/B above.
victory.exe run, diag profile with diagnostics;VICTORY_THIN=1,VICTORY_RELAY=2,VICTORY_SOFT_VIEWS=copies.8fc22547c+ local commits, one session of 19 minutes) with the next one with it (main63b902fe1+ this PR's commit + #630 + the same local commits, one session of 16.7 minutes): same settings apart from one unrelated lighting switch, same part of the map, same evening.VICTORY_FAULT_UNLOCKEDwas being flipped every 30 s by the in-run A/B, so the "ranges held" figures are given for both of its sides.VICTORY_FAULT_UNLOCKEDonVICTORY_ASK_HOLD_ALL=1on the same exe would be the cleaner comparison. I can run that if it is useful.Measurements and this report were prepared with an AI assistant (Claude Code); the runs were played on my machine.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T04:47:11Z.
Review: APPROVED
LGTM — verified on Windows:
cargo test -p victory-gpu --lib watch::passed (49/49, including both newwatch::ask_holds::tests)cargo xtask policypassed (294 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by urielbeaupre on 2026-11-28T17:06:30Z.
An A/B on top of other copy-path work, for the record. RTX 4070 Ti 12 GB, Ryzen 9 7900X, Series S profile, DLSS off, same save, warm caches.
Base: main
63b902fwith #1038 and #1184 (lazy landing/fetch on). That base already removes most per-frame refresh and copy-back work on the 21 MB buffer. #697 and #1133 merged cleanly on top;VICTORY_ASK_HOLD_ALL=1gives #1133 alone. Cutscene = 60–110 s after input, after = 110–165 s. Warm runs only (the new build's first run built pipelines and isn't counted):On this setup neither shows a gain. Both are within about ±1.5 fps of the base, which is run-to-run noise here, and with both the copying is about 1.3 ms higher on average. No errors, and draw counts match.
This doesn't say the PRs are wrong. Where most refresh spans are already
nothing_newand the big buffer no longer goes round the CPU, there's little left for them to save. In heavy scenes on this machine, the submit thread's biggest cost now is the refreshes themselves: about 23 ms a frame over ~6,500 spans, of which ~5,200 copy nothing.🤖 Generated with Claude Code