GPU: a marked page's copy-back reads the title's page into one buffer per thread #3244
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3246"
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 Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-26T14:25:03Z.
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
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T14:28:20Z.
Review: APPROVED
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):
ead_into / write_mapped.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T15:28:27Z.
WARP verification of #3246 (test report only, no code changes)
Head
c2e4507ce40ccdf1056ccf9c40e39f27bb8721ef, main63bcca43c6a00a758510398fa43096ce7e4f7df0(merge base = main).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 (
<test> --exact), so one crashing test cannot hide the others. (With the old 10.0.19041 dxil.dll the validator tests crash with an access violation, on main too; unrelated to this PR.)Commands (head, checked out detached):
cargo test -j 4 -p victory-gpu --features diagnostics --lib(thediagnosticsfeature is what makesVICTORY_D3D12_WARPtake effect; without it the host tests would pick the physical adapter)shadow::tests::a_partial_marked_page_after_a_whole_one_takes_none_of_its_bytesResults:
panic!right after that early return and the test hit it, so on WARP it runs through to its assertions (probe reverted; not part of the PR).victory-gpulib on head: 248 tests, 247 passed, 1 ignored, 0 failed. On main: 247 tests, 246 passed, 1 ignored, 0 failed.AI-assisted: verification by Claude Code (Claude Sonnet 5.5). Synthetic tests only; no game files, dumps, shader names or hashes.
Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T07:05:54Z.
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
mainplus the unmerged PRs this setup needs (#3312, #3318, #2472 and others, listed in #3425). This PR merged on top, 600 s runs, medians of the last 30 frame-rate lines, against a control run of the same base taken next to it (frame times drift by up to ~25 ms between runs hours apart).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
shadow::test passes under Wine.AI-assisted (Claude); measured on my machine, no game data shared.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T23:33:41Z.
I tested #3627 on top of the current #3246 head
c2e4507, with both commits retained as parents of c09d8dc. The two synthetic WARP copy-back calls still account for three compared pages, with one call in the single-page bucket and one in the 2–15 bucket. The withheld page is excluded. The four bucket boundaries and window reset passed.The existing partial-page regression also passed with thread-local scratch reuse. In total, 247 existing GPU tests passed with one ignored, plus the app-local WARP 1.0.22 and Agility 1.620.2 identity check. Strict all-features GPU Clippy and the asset policy check passed.
The tested combination is available for measuring the workload discussed in #3604. The maintainers can review the scratch lifetime and the diagnostic change independently.
Combined commit · Counter results in #3627
If you reuse the diagnostic change, please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg [email protected] if folding it into another commit.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.