Repository navigation
Conversation
…mark pages current conditionally
|
Triage verdict — Needs changes ( Evidence
Checks and limits
Next step
This verification was AI-assisted. |
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at AI-assisted (Claude Code). |
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Copy-back writes only changed bytes + pages marked current (#721/#722) — part of a three-way split of #2000 (which fixed #721/#722/#726 in one PR): #2009 covers copy-back, #2010 covers #726's v_med3 NaN fix (shader, macOS-tested separately). Maintainer should compare #2000 vs #2009+#2010 and pick.
… only changed bytes; mark pages current conditionally
|
Automated triage for the maintainers. Needs rebase. This PR no longer merges cleanly into From the earlier needs-work note, still open: regression tests in the PR for the #722 race and for #721, a bound or measurement for the per-run Generated by Claude Code |
…ck as one (opt-in); copy-back timings Putting shader writes back into title memory wrote each run of the GPU's bytes with its own NtWriteVirtualMemory. With the structure builder on, a frame put back about 350 pieces holding 780,000-910,000 runs (about 2,400 per 64 KiB piece: the builder changes a few bytes here and there in each node), 248 ms a frame on an RTX 4080. VICTORY_BACK_JOIN=<n> writes runs no more than n bytes apart as one call, gaps included (title bytes read just before). With n = 256 the same frames take 1,300 calls and 1.8 ms of writing; copying back fell from 327-354 ms to 58-65 ms a frame and the frame from 849-916 ms to 502-583 ms (one run each). Unset or 0: each run alone, as before (upstream Marvisak#2009). The shortcut: a title write landing in a gap between the read and the write is lost; the relay's merge already writes whole stretches the same way. Also: a frame-rate line of the copy-back's pieces, runs, kernel writes and the time reading and merging, opening guards and writing, and of the relay's merges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A4bpLmErkufJL3LGgfR561
|
Deterministic reproduction of the guarded copy-back race Following up on the race identified in review, a test simulates a GPU write by changing the host copy. During guarded snapshot copy-back, a test hook makes a second thread write to the tracked title page just before
Three seeds on main and two on the PR gave the same result. The other eight cases met their visibility deadlines on both builds. On #2009 the write lands after the final comparison and before the page is re-protected. That write is marked as already copied. Marking the page current requires validating its bytes after re-protection and preserving later writes, including writes through aliases. Prior review · Related earlier report Reproducer (test, test-only hook, and the one-line assertion change for this PR): https://gist.github.com/ajsem1337/551639fa596a63f63282956d42917b0c Found with AI assistance (Codex wrote the original test, Claude Code ported it to |
|
Re-ran the reproducer from the gist on b9ecb1e: the Limits: the gist's 0001 no longer applies to the changed |
|
Independent GPU validation for PR #2009 (Windows, Rust 1.100.0/MSVC, head b9ecb1e, no game data): |
… (240,000 writes a frame under Wine) Since only the GPU's bytes are written back (upstream Marvisak#2009), every run of changed bytes in a piece is a write of its own (`write_mapped`, one NtWriteVirtualMemory call each). A shader that writes records leaves many short runs, because every byte of a record that comes out as it was ends one: in the world frames of the opening scene about 250 pieces a frame held 240,000 to 280,000 runs. At about 4 microseconds a call under Wine that was 0.8 to 1.2 s of every frame ("putting them back" in the frame account). Runs with fewer than 64 bytes between them are now written as one (`VICTORY_BACK_RUN_GAP`; `0` writes every run on its own, as before). That leaves about 4,000 writes a frame. What it gives up: the bytes between two joined runs are written as they were read a moment before, so a title write that lands on one of them between the read and the write is lost. Before Marvisak#2009 that held for the whole stretch from a piece's first changed byte to its last; now it holds for bytes less than 64 bytes from one the shader wrote. Test: `runs_closer_than_the_gap_are_joined`.
|
Closing to re-scope: taking on better-scoped issues instead. |
Split from #2000 per review feedback (gpu-only, Windows path). #721: copy_back now writes only changed bytes. #722: page marked current only if title still matches. Builds clean; shadow tests pass.