GPU: track each write range once per submission #440
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!440
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/440/head"
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?
@tcurtsinger on GitHub · 2026-11-24 03:25 UTC · original
tcurtsinger:perf/track-submission-write-ranges→main· +95 −28 · 3 files · 1 commits · closed without mergingChange
Each submission prepares every declared GPU write and then, after the fence, walks all deferred commands again to find the distinct ranges to copy back. Repeating a declaration also grows the shadow's pending list, which later refreshes search.
Record each exact (shadow identity, address, length) on its first declaration. Flush preceding refreshes at every declaration, including repeats. Keep the first-declaration order for copy-back so distinct views that overlap title memory finish in the same order as before. The membership set is released before the GPU wait.
Synthetic measurements
Windows D3D12 WARP, optimized diagnostics build, base
d2a4bae. Each range is 512 bytes. Each sample submits closed command lists with deferred refreshes and GPU-write declarations and checks the resulting title bytes. Values are median microseconds per submission across eight fresh processes per revision in counterbalanced order. Each process ran three warm-up batches and nine measured batches of eight submissions.The 128-distinct control took about 1% longer end to end. The two repeated-range cases improved. The frequency of repeated write declarations in a native world frame and the effect on FPS remain unmeasured.
Verification
Related to #400. AI-assisted implementation and testing.
@DaviTostes on GitHub · 2026-11-24 03:35 UTC · original
Overlaps with #435: 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):0ba3e44):victory-gpu44 passed, 0 failed, 1 ignored;shadow::submission_tests::repeated_gpu_writes_keep_their_first_copy_back_orderpasses.657efd8): 44 passed, 0 failed, 1 ignored; itshost::batch::exact_gpu_writes_are_declared_once_per_submissionpasses.This PR keeps the first-declaration copy-back order and tests it; #435 keeps the set inside
Batch::new_gpu_write. Both fix the same repeated-range cost, so one supersedes the other.@tcurtsinger on GitHub · 2026-11-24 15:27 UTC · original
Thanks for testing both PRs. I ran the same ordering test on both heads with Windows D3D12 WARP. A refresh queued between two identical write declarations is visible to a host callback immediately after the repeat in #440. On #435 the callback ran before the refresh and saw the old byte.
0ba3e44657efd8, with the identical test addedself.flush()moved immediately beforeif self.new_gpu_write(...)The callback is synthetic. Gameplay impact remains unmeasured. Either implementation can preserve the existing ordering by flushing before the duplicate check. I’d keep the regression in whichever PR lands. Test source
cargo test --locked -p victory-gpu --lib --features diagnostics shadow::submission_tests::repeated_gpu_writes_keep_their_first_copy_back_order -- --exact --test-threads=1withVICTORY_D3D12_WARP=1.AI-assisted testing.
@AgneyaK on GitHub · 2026-11-24 18:24 UTC · original
Test report on a 6 GB / 16 GB laptop: on top of #393 this PR gives a further small gain (3,347 → 3,221 ms per world frame, copies 100 → 67 ms). That's within this machine's run-to-run spread (about ±10%), so it's not a clear effect.
Setup: RTX 3050 6 GB Laptop (NVIDIA, driver 32.0.16.2124), i7-13700H, 16 GB RAM, Windows 11 26300, diag build. Title 1.0.2.1, Series X profile, the story load. Base tree:
mainffe310e+ the PRs listed in #1232 + #431. Each PR was merged onto that base, and each row is one run of 300 s from launch. "World frame" is the average of thefps, ms/frame (…)lines under 10 fps with 20+ draws. Write-watch numbers are the last 8copystatlines.AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine and drafted this report; results are from the runs described.
Pull request closed