Write watch: a submission's askings spread over threads (VICTORY_SUBMIT_PARALLEL=<n>, opt-in) #4576
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4576"
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 Mikey970 on 2026-11-30T23:01:05Z.
[pr-performance] opt-in, off by default.
What it changes
VICTORY_SUBMIT_PARALLEL=<n>(unset, 0 or 1: off; at most 16). With it, a submission's one write-watch asking (watch::ask_once, andask_restafterask_first/ask_more) is spread over n threads, the asking one among them:ask_once: its runs are cut into disjoint parts (split_runs: at piece boundaries; a piece longer than a thread's share, at least 16 MiB, cut into shares; pages an earlier piece covers left to that one, so no page is asked twice). The parts are asked at once on a small pool (victory-split,land::each_split), longest first, each byask_run_all, and the answers joined in address order before the journal is told, as one thread would tell it. Pages in the gaps between two parts are not asked (they are not put inahead, sowritesasks about them later, as for any page no run covers).ask_rest: its merged groups (already disjoint) are asked on the pool, each exactly as the loop asked it (the group, then its pieces if refused; the body moved intoask_alone), joined in order.shadow::wide_threads) are at least n-1 helpers unlessVICTORY_WIDE_THREADSis set.write watch asked on several threads per frame (VICTORY_SUBMIT_PARALLEL=n): ... askings in ... parts, ... ms waited for them.Unset, the code paths are the ones on main (the only change is
ask_rest's loop body moved into a function).Why: on our runs the submitting thread spent ~6 ms a frame (10-13 ms in heavy seconds) in
GetWriteWatchwith reset, one run after another.How it was tested
All in-game numbers below are from our fork's build of the same change (not yet run in-game from this branch on main), on one PC: RTX 4080, Ryzen 7 9800X3D, Series X profile 1440p -> 4K DLSS, DLSS frame generation on.
VICTORY_SUBMIT_PARALLELset; benches R112/R113): 31.1 rendered fps (+17%), heavy scenes 25.1 (+14%). Without frame generation: 31.9 vs 31.0. Captured frames correct, no errors in the logs.GetWriteWatchwith reset over all of it): 1 thread 3.8 ms, 8 threads 2.2 ms; with 6 other busy threads in the process 8.6 ms vs 2.5 ms (x3.4). The kernel does not serialize resetting askings across threads on this machine.cargo testfor the crate it touches: the three new tests inwatch::split_tests(part splitting is disjoint, in address order, covers every page once incl. overlapping pieces; runs asked on threads find exactly what one thread finds, joined in order;ask_restgroups incl. a refused one asked as one thread asks them) pass (5 repeated runs), plus the existingwatch::(72) andland::tests, also withVICTORY_SUBMIT_PARALLEL=4set;cargo clippy -p victory-gpu --all-targetsadds no warnings (the 2 it reports are on main already).Risks: the extra threads compete with the title's threads for cores (that is why it is opt-in); how the kernel's resetting
GetWriteWatch(TLB flushes) scales across threads may differ by CPU, Windows build and Wine/Proton.Checked for overlap
VICTORY_SUBMIT_PIPE, the opposite approach: one collector thread serialising all askings, on the premise that concurrent resetting askings contend in the kernel; our measurement above found they scale here), #4395 (VICTORY_ASK_BY_RES, cuts askings at reservation boundaries; composes with this), #2647 (scratch reuse in asking). None asks a submission's askings in parallel.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:37:30Z.
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