GPU: attribute the copy term's VirtualQuery work (FIND-49) #3429
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!3429
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3429"
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?
@Jackster on GitHub · 2026-11-27 01:27 UTC · original
Jackster:gpu/copy-term-attribution→main· +49 −2 · 3 files · 1 commits · openWhat
The frame line already prints the copy term's pieces —
copies … MB,runs … ms,queries … ms,moves … ms,watch time: … protecting,snapshots … MB in … ms— butC::Queries/C::QueryUswere never incremented, so the "queries" column was always zero. With borosf's measurement on FIND-49 (the ~927 ms copy term is per-page bookkeeping, not the kernel copy), that leftMoveUs, watch time and snapshots attributable and theVirtualQuerywork invisible.This wires the two
VirtualQuerywalks intoQueryUs:host.rscopy_mapped: thecommitted()check on a title destination.watch.rsprotect_noting: theunmapped(page)query. It nests insideProtectUs, which the frame line also prints; the comment says so, and the two mean different things (per-query cost vs the whole protect loop).Plus
copystat::getundercfg(test)and one regression test.Why
FIND-49 asks for exactly this: "Anyone optimizing that term should attribute it on the frame line (copystat MoveUs vs QueryUs vs SnapshotUs vs WatchUs) before writing code." There is no behaviour change, and
copystatis behindfeature = "diagnostics", so a release build pays nothing.Testing (Windows 11, Radeon RX 7900 XTX)
cargo test -p victory-gpu --lib --features diagnostics: 247 passed / 0 failed / 1 ignoredcargo test -p victory-gpu --lib(no feature): 231 passed / 0 failed / 1 ignored — the plain build is unchangedcargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo test --workspace --locked: 872 passed / 0 failed (the new test is diagnostics-gated, so the default run is unchanged)Control: with the two lines removed from
protect_noting,watch::tests::a_virtual_query_on_an_unprotectable_page_is_countedfails with its own message ("the unprotectable page's VirtualQuery is attributed to queries").Synthetic only, no game data. AI-assisted.
@fuzeofficlal on GitHub · 2026-11-27 01:50 UTC · original · approved these changes
Looks good. Both copy-path
VirtualQuerysites (crates/victory-gpu/src/host.rs:2515-2517aroundtexture::committedincopy_mappedandcrates/victory-gpu/src/watch.rs:668-670inprotect_noting'sunmappedcheck) are cleanly attributed to the existingC::QueriesandC::QueryUscounters without double-counting, and#[cfg(feature = "diagnostics")]gating keeps non-diagnostics builds warning-free.Verified on commit
f7481f4669e6b6efcdf7c4b72e744e5dbb7deebd:cargo xtask policypassed (191 files ok).cargo clippy -p victory-gpupassed cleanly with-D warningsacross all four configurations (--lib,--tests,--features diagnostics --lib, and--features diagnostics --tests).watch::testspassed 15/15 (default) and 16/16 (--features diagnostics, includinga_virtual_query_on_an_unprotectable_page_is_counted) on both an NVIDIA RTX 5090 and WARP (VICTORY_D3D12_DEBUG=1).@Dukestar69 on GitHub · 2026-11-27 01:52 UTC · original · approved these changes
LGTM — verified on Windows:
cargo test -p victory-gpu --lib watch::passed (15/15 default; 16/16 with--features diagnostics, includinga_virtual_query_on_an_unprotectable_page_is_counted)cargo clippy -p victory-gpu --all-targets -- -D warningsand--features diagnostics --all-targets -- -D warningsboth passed with 0 warningscargo xtask policypassed (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.