GPU: coalesce identical write declarations within a submission #435
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/435"
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 melon0918 on 2026-11-24T03:20:53Z.
What changed
World passes declare the same writable shadow-buffer ranges repeatedly. Each repeat used to flush the accumulated refreshes, even after the first declaration had taken the pre-submit snapshot and marked that exact range pending. Store the first declaration per shadow, address and length in the submission batch. Use that same ordered list for copy-back after the fence, replacing the second pass over the deferred command steps.
Verification
cargo test --locked -p victory-gpu --features diagnostics -- --test-threads=1passed 46 tests with one existing benchmark ignored. The added test covers repeated declarations, overlapping ranges, distinct shadows, and submission boundaries.cargo xtask policypassed. The PR contains only source and a synthetic test. AI-assisted (Codex).Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T05:41:20Z.
Review: APPROVED
Tested
657efd8on Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (265 passed, 0 failed).I checked that dropping the repeated
flush()+writing()keeps behaviour the same:Shadow::writingalready returned early. The merged snapshot range equals the existing one, so the snapshot was never retaken. The only effects of a repeat were an extrapendingentry and an extra refresh flush.title_written()step or by the batch flush before the lists run. The copy-back compare (host != old && t != h) gives the same result whichever flush applied them.batch.gpu_writesin declaration order with the same per-shadow, address and length dedup the removed loop did. It also covers lists named twice in one submission, since the batch spans the whole submission.No issues found. I cannot reproduce the CPU-copy timings without a game package here.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T03:35:15Z.
Overlaps with #440: both deduplicate
Step::GpuWriteper submission incrates/victory-gpu/src/host.rs, and they conflict textually —git merge-tree --write-tree pr435 pr440reportsCONFLICT (content)inhost.rs. Worth choosing one.Both were verified separately on Arch Linux x86_64, Windows MSVC release build under Wine 11.22 (
--test-threads=1):657efd8):victory-gpu44 passed, 0 failed, 1 ignored; the newhost::batch::exact_gpu_writes_are_declared_once_per_submissionpasses.0ba3e44): 44 passed, 0 failed, 1 ignored; itsshadow::submission_tests::repeated_gpu_writes_keep_their_first_copy_back_orderalso passes.The difference is where the state lives: this PR dedupes in
Batch::new_gpu_writeand keeps copy-back deferred steps, #440 collectsBatch::copy_backin first-declaration order (and adds the ordering test). Both fix the same repeated-range cost.upstream-sync referenced this pull request2026-11-24 19:03:41 +00:00
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:17:47Z.
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/host.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T02:59:58Z.
Triage verdict — Narrow the scope and rebase (
657efd8)Evidence
mainat940d32falready deduplicates exact keys for copy-back and combines theirmissedstatus. The remaining opportunity here is reducing repeated preparation before submission. That path still flushes on each unmarked declaration.Checks and limits
0on this head (657efd8) where the expected byte was33.Next step
This verification was AI-assisted.
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.