GPU: collect tracked page runs without temporary trees #3387
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!3387
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3387"
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?
@Desamodeth on GitHub · 2026-11-26 21:23 UTC · original
Desamodeth:perf/watch-runtime-page-runs→main· +34 −3 · 1 files · 1 commits · openThe fallback in
watch::runtime_pagesinserted each 64 KiB page into a temporaryBTreeSetof eligible or foreign pages, then took their difference. Even a range consisting entirely of ordinary committed memory allocated tree nodes to return an empty vector. This follows borosf's measurement of the cost of building those sets. Original finding · Coordination claim.Walk the
VirtualQueryregions in address order. When a foreign region appears, emit the eligible run before its first page and resume after its last page. A 4 KiB foreign region therefore excludes its entire overlapping 64 KiB page. The final run ends at the last successfully queried region. The Windows queries, classification predicate, write-watched fast path and caller are unchanged.CPU measurements
Median µs per call to
runtime_pages, base63bcca43vs this patch. The range of medians is from two runs in opposite order.Windows x64, Ryzen 7 9800X3D, rustc 1.98.1,
-C opt-level=3. The isolated benchmark called the old and new functions on the same nativeVirtualAllocmapping, alternating order and taking 21 samples per variant after two warm-ups. For the mixed case, reserve 64 MiB, then commit one 4 KiB block at offseti * 65536 + 4096fori = 1, 33, 65, …. Both versions return the same 992 page numbers. Allocation counts came from a separate counting-allocator build. These measurements cover page classification only.Correctness
views.victory-gpuwatch tests passed on Windows. Workspace Clippy passed for all targets with default and all features, with warnings denied.cargo xtask policypassed (191 files).AI-assisted with Codex. No game data or GPU used for local verification.
@Dukestar69 on GitHub · 2026-11-26 21:27 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).cargo test -p victory-gpu --lib watch:: -- --test-threads=1: 16 passed, 0 failed (includingruntime_pages_excludes_a_page_split_by_a_private_region).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 21:51 UTC · original · approved these changes
Clean replacement that preserves exact equivalence with the previous
BTreeSet::differencelogic while avoiding temporary tree allocations.Checked all boundary cases in
runtime_pages(crates/victory-gpu/src/watch.rs:382-423): split 64 KiB pages containing one or more 4 KiB foreign regions, back-to-back foreign regions (run_start > at / PAGEsafely yields an empty range), unalignedstart/end, and earlyVirtualQuery == 0termination on either the first or a later iteration (scanned_endtracks only queried regions).Verification on
origin/main(63bcca43):cargo xtask policy: ok (191 files ok)cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): cleancargo test --locked -p victory-gpu --features diagnostics -- watch::tests:: --test-threads=1: 16/16 passed on RTX 5090 and 16/16 passed on WARP (includingruntime_pages_excludes_a_page_split_by_a_private_region)BTreeSet::differenceimplementation against the new run accumulator (including unaligned ranges, mixed 4 KiB sub-page regions, and simulatedVirtualQuery == 0early breaks): 2,000/2,000 matched identically.@Jackster on GitHub · 2026-11-26 22:34 UTC · original
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:watch::tests::runtime_pages_excludes_a_page_split_by_a_private_regionby name: 1 passed.cargo test -p victory-gpu --lib: 232 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.Synthetic only. 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.