Write watch: a submission's askings spread over threads (VICTORY_SUBMIT_PARALLEL=<n>, opt-in) #4577
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!4577
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Mikey970 on GitHub · 2026-11-30 23:01 UTC · original
Mikey970:pr/write-watch-parallel→main· +1351 −868 · 34 files · 14 commits · closed without merging[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), #4396 (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
With the switch, ask_once's runs are cut into disjoint parts (at piece boundaries; pieces longer than a thread's share, at least 16 MiB, into shares) and asked at once on a small pool ("victory-split", n threads with the caller), the answers joined in address order before the journal is told. ask_rest's merged groups are asked on the pool the same way, each as the loop asked it (body moved into ask_alone). The refreshes' threads (wide_threads) are at least n-1 helpers unless VICTORY_WIDE_THREADS is set. Frame line: "write watch asked on several threads". Unset, behaviour is unchanged. Micro-benchmark (4 GiB in 16 write-watched reservations, GetWriteWatch with reset): 1 thread 3.8 ms, 8 threads 2.2 ms; with 6 busy threads 8.6 vs 2.5 ms. Co-Authored-By: Claude Opus 5.5 <[email protected]>@trustno1-coder on GitHub · 2026-12-01 18:37 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