GPU: scan copy-back bounds in 32-byte chunks #255
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!255
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-255"
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?
@gomeaw on GitHub · 2026-11-24 23:01 UTC · original
gomeaw:perf/shadow-copy-back-span→main· +45 −29 · 1 files · 1 commits · openSummary
Copy-back locates the first and last changed byte of each differing piece before replaying GPU writes into title memory. The RTX 5080 report in #107 measured 44–47 ms per frame for the broader copy-back stage in one cutscene.
Use fixed 32-byte equality in both searches and inspect individual bytes only in the unequal chunk or the partial tail. On Windows x64, Rust 1.98.1 emits two SSE comparisons per complete chunk. The synchronous, relay and card-local paths all use these helpers. The byte offsets passed to the merge stay the same.
Related work: #71 changes the GPU compare and readback queue. #240 reduces scratch allocation and still uses both searches. I verified that this patch merges cleanly with #240.
Measurement
Windows x64, GitHub-hosted AMD EPYC 7763, Rust 1.98.1, optimized standalone A/B of the original and patched helpers. Median of three runs, each reporting the median of nine samples over 128 synthetic pieces per iteration.
A 64 KiB piece differing at both ends took 0.6 ns longer. The 64-byte input with a middle change took 3.3 ns longer. The benchmark times the CPU search only. An independent RTX 5070 checkpoint A/B passed the shadow tests and reported similar copy-back time per MB with variation in streaming. The gameplay benefit remains unverified. Independent test report Windows run · Benchmark source
The bytewise regression checks cover unaligned input, equal spans, partial chunks, unequal lengths and changes on either side of chunk boundaries. Both Clippy configurations and
cargo test --workspace --lockedpassed on the Windows x64 runner with 497 passed, 7 ignored and 0 failed. The asset policy also passed. Windows test jobAI-assisted with Codex. All benchmark and test inputs are synthetic.
@ryotdev on GitHub · 2026-11-24 23:20 UTC · original
I tested
413bab7on Windows with an RTX 5070 (driver 610.88) and Ryzen 7 7800X3D. I ran the same 3D checkpoint once per build, with the same release settings, starting cache files and scripted inputs, and capture disabled. The only source change between the two builds was this PR. All 20 native shadow unit tests passed, including both byte-search tests.In the shared 145–158 seconds after launch, both runs had 12 window-title samples at 4,800–5,100 draws/frame. Median reported frame time was 231.8 ms before and 223.4 ms after. The two host copy-back reports per arm averaged 35.2 ms for 70.05 MB before and 33.5 ms for 66.9 MB after, about 0.50 ms/MB in both. Streaming varied between the runs and the host frame-time reports moved in the opposite direction. This pair does not establish an end-to-end speedup or a regression. The changed byte-search functions represent only part of the copy-back timer.
AI-assisted hardware test. No game data attached.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.