GPU: the copies timing no longer counts the flush before a title copy twice #1217
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1217"
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 neonbyte1 on 2026-11-24T16:28:54Z.
The
copiesfigure on the frame-rate line counts some refresh time twice.HostList::run_deferredstarts a timer before each step. ForStep::Copyit then callsbatch.title_written(), whoseBatch::flushalready adds each pending refresh's time toPREPARING[0]. The step then addsstarted.elapsed(), which includes that flush again.Step::Run'sRunUscounter (diagnostics) also included the flush.The timer now restarts after the flush in both places. Nothing else changes: the copies themselves, the order of the steps, and every other counter are as before. The reset in the
Runarm is behind thediagnosticsfeature because onlyRunUsreads it there.Why it matters
In world frames with thousands of small title copies per frame, the double counting made
copieslook several times larger than the work behind it. That misattributed the CPU cost of world frames.Measured on an RTX 5090 under Wine 11.22 + vkd3d-proton (prologue, ~3,100 draws/frame, medians over ~55 summary lines):
copiesms/frameThe frame-time drop comes from #514; this change only removes the double count from
copies.Checks
cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings, with and without--features diagnostics: clean. Cross-compiled from Linux.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by TG0000 on 2026-11-24T16:57:14Z.
Confirmed by reading: the same double count was in the
copiescolumn of my own measuring tool (timer started beforebatch.title_written()); its wall-clock columns (whole frame, preparation, copy back) do not have it. Thanks for finding it.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T17:59:54Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
a2e532d:cargo test -p victory-gpupasses, 50 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
upstream-sync referenced this pull request2026-11-24 19:03:41 +00:00
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:19:11Z.
Automated triage for the maintainers.
Merge candidate. The rebase onto current
mainresolved the earlier conflict, and it merges cleanly now.In
HostList::run_deferred(crates/victory-gpu/src/host.rs), theStep::Copyarm now restartsstartedafterbatch.title_written().Batch::flushalready adds each refresh's time toPREPARING[0], so the oldstarted.elapsed()counted that flush a second time in thecopiesfigure. TheStep::Runarm does the same for theRunUscounter, behinddiagnostics. I checked that nothing else readsstartedin between and that the copies themselves and the step order don't change. The per-stepTimedwatch still measures the whole step, which is fine for a step timer.CI: passing (
check).Recommending a look, not approving.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T16:20:29Z.
Review: APPROVED
Reviewed
81002a3aa5cf8f1bda20b8945e7001e79d775bf6(merged cleanly onto63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 with an NVIDIA GeForce RTX 5090, WARP, and D3D12 Debug Layer.Audit
crates/victory-gpu/src/host.rs:2272,:2294: resettingstarted = Instant::now()right afterbatch.title_written()inStep::Copy(and under#[cfg(feature = "diagnostics")]inStep::Run) stopsPREPARING[0]andC::RunUsfrom double-countingBatch::flush()time while_timed = Timed(started, ...)retains the initialInstantby value for whole-step timing. No behavioral or ordering change, and clean under both default and--all-featuresbuilds.Verification
63bcca43c6a00a758510398fa43096ce7e4f7df0+cargo run -p xtask -- policy(191 files ok)cargo clippy -p victory-gpu --all-targets -- -D warnings(default &--all-features)victory-gpuhost::withVICTORY_D3D12_DEBUG=1:host::filter is the pre-existingdescriptor::host::tests::dynamic_slots_are_held_until_released1M view-heap cap failure onmain; allcrate::host::tests pass).--features diagnostics, skipping the pre-existingmainDebug Layer mismatch incompositor_failure_presents_primary_in_the_same_frame): 35/35 passed.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T19:31:48Z.
Review: APPROVED
LGTM — verified on Windows against
origin/main(63bcca4).startedafterbatch.title_written()inStep::CopyandStep::Runavoids double-counting the flush duration inPREPARING[0]andC::RunUs.cargo test -p victory-gpu --lib host::title_copies:: -- --test-threads=1: 2 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings(default +--features diagnostics): clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.