Index declared-buffer membership for large copy plans #4395

Open
github-bot wants to merge 1 commit from github-bot/gh-4394 into main AGit
Owner

@⁠sklzygit on GitHub · 2026-11-30 19:44 UTC · original
sklzygit:contrib/buffer-membership-index → main · +68 −3 · 1 files · 1 commits · open

What it changes

Large copy plans repeatedly linearly search declared buffers for each looked-at range. Add a temporary pointer-identity index when there are more than 32 declared entries and more than 8 looked-at ranges, reducing those membership checks from quadratic to amortized linear work. Small plans keep the allocation-free linear path.

Both borrowed and owned preparation use the same exclusion logic. The original iterator supplies the output, preserving range order, bounds and duplicates; declared Arcs keep pointer identities alive throughout the lookup. No shader, command ordering, upload policy, cache key or launcher changes.

How it was tested

  • Windows, Ryzen 7 9800X3D; CPU-only membership checks, no title/assets.
  • cargo test --locked -p victory-gpu --lib host::tests -- --test-threads=1: 114 passed, 3 ignored on upstream e1251c31 plus this patch. Full crate suite was not rerun for this isolated branch.
  • Reference parity covers 42 combinations around both thresholds, empty lists, duplicate declared identities, repeated looked-at identities with distinct range bounds, hits and misses, and retained order.
  • Added an ignored paired measurement: cargo test --release --locked -p victory-gpu --lib measure_large_buffer_membership_index -- --ignored --nocapture.
  • An optimized CPU-only extraction of the committed helper, address hasher, regression and measurement passed. At 8,192 identities, the measured operation was about 5.40 ms linear vs 0.034 ms indexed, including index construction and collecting/checking the retained output. At 64 identities it was about equal (0.52 vs 0.53 us). These are synthetic operation measurements, not frame-time or FPS gains.
  • Changed-file asset policy: 1 file OK. git diff --check passes. Shader wave sizes: not applicable.

Gameplay impact remains unmeasured.

Checked for overlap

  • Searched open PRs and current main for buffer-membership/declared/looked indexing. #2587 introduced the existing borrowed/owned planning and compare grouping; this addresses the remaining linear contains_shadow searches in that path, not its grouping work.

Current-main revalidation (2026-12-01)

Rebased as one focused commit f9271558 directly on upstream 5fabb46e, removing the obsolete upstream-history divergence from the PR comparison. No unrelated launcher, shader or dependency changes.

Hardware for the local checks: Windows 11, Ryzen 7 9800X3D, GeForce RTX 5080 16 GB, 32 GB system RAM, NVIDIA driver 621.40 (32.0.16.2140). These PRs are generic allocator/host changes; the tests below are not gameplay measurements. The local game profile is Series X, output 2560×1440, DLSS Quality, 30 FPS base cap, frame generation off in the latest recorded playtest, ray tracing off. The focused regression tests do not launch the game or depend on this profile.

  • cargo test --locked -p victory-gpu --lib host::tests -- --test-threads=1: 114 passed, 0 failed, 3 ignored.
  • Changed-file asset policy and git diff --check origin/main...HEAD: passed.
  • Full workspace tests and GitHub CI were not claimed passed; no new in-game performance result.
**@⁠sklzygit** on GitHub · 2026-11-30 19:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4394) `sklzygit:contrib/buffer-membership-index` → `main` · +68 −3 · 1 files · 1 commits · open ## What it changes Large copy plans repeatedly linearly search declared buffers for each looked-at range. Add a temporary pointer-identity index when there are more than 32 declared entries and more than 8 looked-at ranges, reducing those membership checks from quadratic to amortized linear work. Small plans keep the allocation-free linear path. Both borrowed and owned preparation use the same exclusion logic. The original iterator supplies the output, preserving range order, bounds and duplicates; declared Arcs keep pointer identities alive throughout the lookup. No shader, command ordering, upload policy, cache key or launcher changes. ## How it was tested - Windows, Ryzen 7 9800X3D; CPU-only membership checks, no title/assets. - `cargo test --locked -p victory-gpu --lib host::tests -- --test-threads=1`: **114 passed, 3 ignored** on upstream `e1251c31` plus this patch. Full crate suite was not rerun for this isolated branch. - Reference parity covers **42 combinations** around both thresholds, empty lists, duplicate declared identities, repeated looked-at identities with distinct range bounds, hits and misses, and retained order. - Added an ignored paired measurement: `cargo test --release --locked -p victory-gpu --lib measure_large_buffer_membership_index -- --ignored --nocapture`. - An optimized CPU-only extraction of the committed helper, address hasher, regression and measurement passed. At 8,192 identities, the measured operation was about **5.40 ms linear vs 0.034 ms indexed**, including index construction and collecting/checking the retained output. At 64 identities it was about equal (0.52 vs 0.53 us). These are synthetic operation measurements, **not frame-time or FPS gains**. - Changed-file asset policy: **1 file OK**. `git diff --check` passes. Shader wave sizes: not applicable. Gameplay impact remains unmeasured. ## Checked for overlap - [x] Searched open PRs and current main for buffer-membership/declared/looked indexing. #2587 introduced the existing borrowed/owned planning and compare grouping; this addresses the remaining linear `contains_shadow` searches in that path, not its grouping work. ## Current-main revalidation (2026-12-01) Rebased as one focused commit `f9271558` directly on upstream `5fabb46e`, removing the obsolete upstream-history divergence from the PR comparison. No unrelated launcher, shader or dependency changes. Hardware for the local checks: Windows 11, Ryzen 7 9800X3D, GeForce RTX 5080 16 GB, 32 GB system RAM, NVIDIA driver 621.40 (32.0.16.2140). These PRs are generic allocator/host changes; the tests below are not gameplay measurements. The local game profile is Series X, output 2560×1440, DLSS Quality, 30 FPS base cap, frame generation off in the latest recorded playtest, ray tracing off. The focused regression tests do not launch the game or depend on this profile. - `cargo test --locked -p victory-gpu --lib host::tests -- --test-threads=1`: **114 passed, 0 failed, 3 ignored**. - Changed-file asset policy and `git diff --check origin/main...HEAD`: passed. - Full workspace tests and GitHub CI were not claimed passed; no new in-game performance result.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 19:46:03 +00:00
github-bot force-pushed github-bot/gh-4394 from c4bff1d7b5 to f9271558da 2026-12-01 04:14:10 +00:00 Compare
Author
Owner

@⁠albertik322-sudo on GitHub · 2026-12-01 17:00 UTC · original

Tested as part of a batch cherry-picked onto main @ 5fabb46e (with #3943, #4394 and this one together). PC: RTX 3070 Laptop 8 GB, i7-11800H, 32 GB RAM, Windows 11. Series S, DLSS Performance, FG x4.

No isolated measurement — but the batch showed no regressions over multiple 20+ minute sessions: fps medians stable or slightly up (17.4 to 17.8 in light scenes), no crashes, no visual corruption. Posting mostly to confirm it runs fine on a memory-tight 8 GB laptop, which is probably the harshest environment for anything touching allocator locking.

**@⁠albertik322-sudo** on GitHub · 2026-12-01 17:00 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4394#issuecomment-7318604984) Tested as part of a batch cherry-picked onto main @ 5fabb46e (with #3943, #4394 and this one together). PC: RTX 3070 Laptop 8 GB, i7-11800H, 32 GB RAM, Windows 11. Series S, DLSS Performance, FG x4. No isolated measurement — but the batch showed no regressions over multiple 20+ minute sessions: fps medians stable or slightly up (17.4 to 17.8 in light scenes), no crashes, no visual corruption. Posting mostly to confirm it runs fine on a memory-tight 8 GB laptop, which is probably the harshest environment for anything touching allocator locking.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4395/head:github-bot/gh-4394'
git switch 'github-bot/gh-4394'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4394'
git switch 'github-bot/gh-4394'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4394'
git switch 'github-bot/gh-4394'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4394'
git switch 'main'
git merge --squash 'github-bot/gh-4394'
git switch 'main'
git merge --ff-only 'github-bot/gh-4394'
git switch 'main'
git merge 'github-bot/gh-4394'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4395
No description provided.