Perf/indexed copyback ranges #1869
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!1869
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1869"
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?
@VlREX on GitHub · 2026-11-24 23:53 UTC · original
VlREX:perf/indexed-copyback-ranges→main· +204 −2 · 2 files · 3 commits · openReplace linear precise UAV range scans with a sorted prefix-maximum interval index and binary search. Synthetic lookup comparisons reduced from 6,292,480 to 45,058, excluding index construction. Independently verified with 102,464 JavaScript model queries and 131,072 native C queries, zero mismatches. Four Rust tests included. Native Rust and GPU benchmarks pending. Complementary to #1865. AI-assisted (ChatGPT).
@upipibi on GitHub · 2026-11-25 00:10 UTC · original
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at
b118e79:cargo test -p victory-gpu --lockedgives 80 passed, 2 failed, 1 ignored. The two failures are the NVIDIA heap-cap onesmainalso has (descriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views, #1744), so there is nothing new on this hardware. Not run: a title.AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 07:26 UTC · original · edited 2026-11-25 22:19 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflict incrates/victory-gpu/src/memory.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: a number from a real frame showing the linear scan costs something (range counts or before/after copy-back ms), a descriptive PR title, and rustfmt on
precise_ranges.rs.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-25 19:59 UTC · original
Reviewed and verified
163c39ffon Windows 11 againstmain(13f91ca).Code review
AdaptiveRangescleanly addresses the upfront allocation/sorting overhead on small or early-exit sets: it scans linearly with zero allocation untiln >= 8andcomparisons >= n.saturating_mul(32), only building the sorted prefix-max index when the range set actually gets hot. Droppingpreciseanddeclaredright after the scan also avoids holding thebyte_for_bytelock longer than needed.PreciseRanges::overlapsagainst the prior linear predicatea < to && from < a + len:saturating_addavoids end overflow,from >= toreturnsfalse, andpartition_point(|&(start, _)| start < to)+ prefixmax_end > frommatches on nested ranges, duplicate starts, zero-length ranges strictly inside a page vs. on boundaries, and saturating ends.Verification (Windows 11, RTX 5090 + WARP)
VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1: 205 passed, 0 failed, 1 ignored (all 7precise_ranges::testspass).precise_ranges::tests7/7,shadow::tests --test-threads=18/8,memory::tests --test-threads=14/5 (only the known13f91caRTX 5090 1M view-heap failurelists_share_a_table_and_copies_keep_their_views).cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default and--features diagnostics): 0 warnings;cargo xtask policy: 185 files ok.git merge-treeagainst13f91caas well as#2172,#2434,#2096, and#562.@catminou4 on GitHub · 2026-11-25 00:32 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Indexed copyback ranges (docs+gpu): perf work on the copyback path, pairs with #1816's delivered-bytes accounting.
@crashbashash on GitHub · 2026-11-26 10:10 UTC · original
In-game numbers for the linear search this PR replaces, since the description says native benchmarks are pending.
RX 6800 XT, Linux (Proton, vkd3d-proton),
diagbuild with frame pointers ofmain219878aplus our Linuxcommits, a save in the prison, perf (
cycles:u, call graphs) over 30 s in the world.The search shows up as
memory::bind::closure$2(the after-run closure that copies back marked pages): 13.6 % and12.9 % of the submitting thread's samples in two runs. By source line, 95-97 % of that closure's own samples are the
precise.iter().any(...)line; scanning the bitmap itself is negligible. The list is long becausedraw.rspushes aroot UAV's range for every draw or dispatch that binds it, so a list holds many copies of the same few ranges, and
every marked page is compared with all of them.
I tested the same idea in a smaller form on our branch: sort the ranges and merge overlapping or touching ones in
place (the bytes they cover stay the same, so a list that runs again searches the merged list), then a binary search
per page (
partition_point; with disjoint sorted ranges only the last one starting before the page's end can overlapit), with a test against the linear search over random, duplicated, touching and empty ranges. With it the closure
falls to 0.2 % of the thread. Frame times did not move measurably (it is one thread among several; 2 runs
each), so the gain is CPU time on the submitting thread rather than frame rate here.
Either version removes it; no need to change yours for this. Happy to share ours if a smaller diff helps.
AI-assisted (Claude Code). No game data attached.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.