Repository navigation
Conversation
… per thread `Shadow::copy_back_marked` read the title's bytes of each page shaders marked into a fresh `vec![0u8; n]` of 64 KiB: thousands of pages a world frame (about 12,700 on an RTX 2080), each allocation zero-filled and its pages faulted in again. The buffer is now one per thread, resized to the page's length; every byte up to it is read from the title before use. RTX 2080, warm caches, in the world: reading the title's pages for marked copy-backs 132 -> 100 ms a frame (median of 12 frame reports). Test: shadow::tests::a_partial_marked_page_after_a_whole_one_takes_none_of_its_bytes (a whole page the shaders filled goes back, then the copy's last page, held in part, which a shader and the title both wrote: it keeps both writers' bytes and none of the first page's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
Dukestar69
left a comment
There was a problem hiding this comment.
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):
- Reusing a thread-local Vec via std::mem::take / give_back avoids per-page 64 KiB allocations and page faults while remaining reentrancy-safe across
ead_into / write_mapped. - cargo test -p victory-gpu --lib shadow:: -- --test-threads=1 (RTX 5090): 11 passed, 0 failed (including �_partial_marked_page_after_a_whole_one_takes_none_of_its_bytes).
- VICTORY_FORCE_WARP=1 cargo test -p victory-gpu --lib shadow::tests::a_partial_marked_page_after_a_whole_one_takes_none_of_its_bytes -- --test-threads=1 (WARP): 1 passed, 0 failed.
- cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
- cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…buffer Import upstream Marvisak#3246: reuse per-thread marked-page copy-back buffer
|
WARP verification of #3246 (test report only, no code changes) Head Env: Windows 11, WARP only (adapter "Microsoft Basic Render Driver", d3d10warp.dll 10.0.26100.9818), VICTORY_WARP=1 and VICTORY_D3D12_WARP=1, dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0), cargo -j 4. No physical GPU used. Each test was run in its own process ( Commands (head, checked out detached):
Results:
AI-assisted: verification by Claude Code (Claude Sonnet 5.5). Synthetic tests only; no game files, dumps, shader names or hashes. |
… the buffer path, a refresh by event that passes its check Found by reading and closed, none seen in a run: a read of the kernel's into title memory that outlives a check's re-arming of the block (a finished ReadFile now counts the blocks under it written once more); a title buffer copy made while no asking stood, whose written bits were taken and nothing noted; a view a mapping dropped that a check's late protection call left read-only and unknown, so that the title's write there was an access violation nobody answered. The refresh by event (VICTORY_REFRESH_EVENTS, still off): a mapping is counted under the guards' lock, a copy with blocks not there is asked once in 30 frames, and the check decides with the asking's locks held. The check counted 0 in the prologue and at the open world's entry, where it had counted 7 and 2. A landing can take the kernel's written bits of the private memory it wrote (VICTORY_LAND_TAKEN, off; its check counted 0 as well). With both on, preparing falls from 40.6 to 36.4 ms a frame in the first room and the copies read from 89 to 70 MB; the frame does not move (67.8 against 66.6 ms), so they stay off. A compute dispatch stands for its pipeline until it is made, where it was dropped and never repeated (after fxceless/victory-fork pull request Marvisak#1312). Title bytes under flights are read into one buffer a thread (after Marvisak/VIctory pull request Marvisak#3246). The check of stale copies (VICTORY_REFRESH_CHECK) discounts looks under a read the title has submitted: its warnings at the world's entry were blocks DirectStorage was still filling. Parts of the host moved to files of their own (host.rs was at the repository's size cap). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Measured in game on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with its vkd3d-proton, GTA VI's opening prison yard, warm cache; base is Measured on the base without #3341 (this PR is the alternative to its pooled buffer):
About 3.4 ms off copy-back, the only one of the six copy-back/refresh PRs I measured that moved copy-back clearly. #3341 on the same kind of base made copy-back 5-7 ms slower in two independent pairs, so on this setup this PR is the better of the two. Its new AI-assisted (Claude); measured on my machine, no game data shared. |
Shadow::copy_back_markedreads the title's bytes of every page shaders marked into a freshvec![0u8; n], 64 KiB each. In the world that's thousands of pages per frame (about 12,700 on an RTX 2080 here), each allocation zero-filled and its pages faulted in again. The buffer is now one per thread, resized to the page's length. Every byte up to that length is read from the title before it's used, as before.Measured: RTX 2080, Windows 10, a story save that loads into the world, warm caches, 5-minute runs. Reading the title's pages for marked copy-backs took 132 ms per frame before and 100 ms after (median over the last 12 frame reports). Most of what's left of the marked pages' cost is waiting for the guard lock, which this doesn't touch.
Test:
shadow::tests::a_partial_marked_page_after_a_whole_one_takes_none_of_its_bytes. A whole page the shaders filled with0xeegoes back, then the copy's last page, held only in part, which a shader and the title both wrote. The second page keeps both writers' bytes and none of the first page's. The existing marked-page tests still pass.AI-assisted (Claude Code); the runs were on my machine. No game data.
🤖 Generated with Claude Code
https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G