GPU: reuse page buffers in tracking and copy-back #3772
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3772"
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 xjimwilson on 2026-11-28T17:46:52Z.
Low-risk CPU-side cleanups in
victory-gpu's page tracking and copy-back paths. Each one removes avoidable work; none changes behaviour.Changes
watch.rs: no allocation in the write-fault handler.Changed::saveran under the guard lock on the title's threads and allocated and zeroed a fresh 64 KiB buffer on every first write to an armed page. It now takes one from a small pool (SPARE_PAGES, up to 256 pages / 16 MiB). Pages that are taken, disarmed or consumed bycopy_back_markedgive their buffer back.shadow.rs: one page buffer per thread for copy-back comparisons.copy_back_page,copy_back_markedandcopy_back_or_noteach allocated a new 64 KiBVecper page compared. They now share a per-threadPageScratch. Its stale contents are never read: each use starts with a full successful read.watch.rs:take_splituses binary search for unmapped pages.protect_notingbuilds the unmapped list in page order (checked with adebug_assert!), so the per-pagecontainsscan becamebinary_search.watch.rs: cheaperDrop for Tracked. It now walks only the held pages (range_mut) and swap-removes itself, instead of looking up every page in its range and runningretain. A tracker holds each page at most once, and holder order is not used anywhere.host.rs: withheld ranges grouped by copy. Each copy-back range is now checked only against its own copy's withheld ranges, not every withheld range in the submission.Testing
cargo clippy -p victory-gpu --target x86_64-pc-windows-msvc --tests, with and without--features diagnostics: no warnings. This was cross-checked from Linux withblake3built pure-Rust, becauseml64.exeisn't available there.cargo test --workspaceand an in-game frame-rate comparison. Both need Windows. Please run the tests before merging.Expected impact is small (CPU-side overhead only). The larger items (overlapping CPU/GPU submissions, splitting the guard lock, finer write marks, shader lookup hoisting) are deferred until the diagnostics frame-rate line shows where a world frame's time goes.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-28T19:10:20Z.
Independent CPU-only WARP verification on Windows 11 Pro build 26200.9974 using system WARP 10.0.26100.9818 and SDK dxil.dll 1.8.2502.11. Both WARP flags were set, and the compositor initialized on the Microsoft software adapter. The synthetic SDK validator smoke test passed.
63bcca43c6a00a758510398fa43096ce7e4f7df07dcddfbe5e46fac6dee280df127da6629093d98cStrict
victory-gpuClippy passed in both default and diagnostics configurations on both revisions. The asset-policy check passed for all 191 files on each. I found no correctness defect in pool hand-back when pages are taken, disarmed, or consumed by marked copy-back, including its failed-read return.AI-assisted by Codex (gpt-6.2-sol).
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.