GPU: the copies timing no longer counts the flush before a title copy twice #1217
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!1217
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@neonbyte1 on GitHub · 2026-11-24 16:28 UTC · original
neonbyte1:fix/copies-timing→main· +7 −1 · 1 files · 1 commits · openThe
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).
@TG0000 on GitHub · 2026-11-24 16:57 UTC · original
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).
@Zipettte on GitHub · 2026-11-24 17:59 UTC · original
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).
@Marvisak on GitHub · 2026-11-25 01:19 UTC · original · edited 2026-11-26 01:18 UTC
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
@fuzeofficlal on GitHub · 2026-11-26 16:20 UTC · original · approved these changes
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.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.