Repository navigation
GPU: collect tracked page runs without temporary trees - #3387
Desamodeth wants to merge 1 commit into
Conversation
Emit eligible pages directly during the ordered region walk. A foreign region excludes every overlapping page, including partial edges. AI-assisted-by: Codex Astra 6.2 High
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows against origin/main (63bcca4).
- Collecting tracked page runs without temporary trees cleanly reduces allocation overhead while still excluding pages split by private regions.
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
left a comment
There was a problem hiding this comment.
Clean replacement that preserves exact equivalence with the previous BTreeSet::difference logic 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 / PAGE safely yields an empty range), unaligned start/end, and early VirtualQuery == 0 termination on either the first or a later iteration (scanned_end tracks 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)- Additional 2,000-case randomized differential oracle comparing the previous
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.
|
Windows 11,
Synthetic only. AI-assisted. |
|
Independent CPU-only verification of PR #3387 (
|
|
Measured in game on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with its vkd3d-proton, GTA VI's opening prison yard, warm cache; base is
No measurable change here. Its own AI-assisted (Claude); measured on my machine, no game data shared. |
The 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.