Index non-full pool blocks without changing allocation choices #4220

Closed
github-bot wants to merge 1 commit from github-bot/gh-4219 into main AGit
Owner

@⁠sklzygit on GitHub · 2026-11-30 17:32 UTC · original
sklzygit:contrib/pool-occupancy-index-30 → main · +278 −13 · 2 files · 1 commits · closed without merging

What it changes

Pool::cut currently collects and sorts every block for each fullest-first allocation. Maintain an ordered set of non-full blocks keyed by (Reverse(held_bytes), block_index), updating it when blocks are added, pieces are taken or become reusable, and empty blocks are reclaimed. Allocation order, alignment, variable block sizes, ripe/oldest fallback, quarantine and growth/backoff remain unchanged. The release's 64 MiB block size and memory-retention limits are unchanged.

How it was tested

Original validation on Windows, Ryzen 7 9800X3D:

  • cargo test --locked -p victory-gpu --lib pool:: -- --test-threads=1: 32 passed, 5 ignored. Includes an independent copy of the original sorted selector over 20,000 operations and a mixed-size block lifecycle comparison.
  • Optimized CPU-only extraction of the production pool types plus the committed test module: both parity tests and the paired benchmark pass. The harness stubs host time/submission services and tracing; no D3D resources or game data are used.
  • Crowded fixture: 512 dummy 64 MiB blocks, 8,192 requests, five alternating repetitions. Sorted median 7,429 us; indexed median 608 us (~12.2x for this fixture), with identical placement digest 99a2f43328d0a325. Both reference and indexed paths include index maintenance, so this isolates selection cost rather than measuring an untouched binary end to end. The committed benchmark can also be run through Cargo with paired_crowded_pool_allocation_measurement -- --ignored --nocapture in an optimized build.
  • Changed-file asset policy: 2 files pass. git diff --check passes.

No gameplay FPS, RAM/VRAM saving, or full-workspace CI pass is claimed. Index maintenance adds metadata and update work; fragmented ranges may still require examining multiple non-full blocks. The original first-fit setting remains supported.

Checked for overlap

  • Overlap checked: #4082 removes the same sort with a linear fullest-fit scan. This is an alternative maintained-index approach with allocation-equivalence tests, offered separately so it can be compared/reviewed without the other changes in that PR. #3711 changes placement policy; this PR preserves the existing policy. Searched open PRs for occupancy, BTreeSet, fullest/index and allocation sorting.

Current-main revalidation (2026-12-01)

Rebased as one focused commit ca4df4e1 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 pool:: -- --test-threads=1: 32 passed, 0 failed, 5 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 17:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4219) `sklzygit:contrib/pool-occupancy-index-30` → `main` · +278 −13 · 2 files · 1 commits · closed without merging ## What it changes Pool::cut currently collects and sorts every block for each fullest-first allocation. Maintain an ordered set of non-full blocks keyed by (Reverse(held_bytes), block_index), updating it when blocks are added, pieces are taken or become reusable, and empty blocks are reclaimed. Allocation order, alignment, variable block sizes, ripe/oldest fallback, quarantine and growth/backoff remain unchanged. The release's 64 MiB block size and memory-retention limits are unchanged. ## How it was tested Original validation on Windows, Ryzen 7 9800X3D: - `cargo test --locked -p victory-gpu --lib pool:: -- --test-threads=1`: 32 passed, 5 ignored. Includes an independent copy of the original sorted selector over 20,000 operations and a mixed-size block lifecycle comparison. - Optimized CPU-only extraction of the production pool types plus the committed test module: both parity tests and the paired benchmark pass. The harness stubs host time/submission services and tracing; no D3D resources or game data are used. - Crowded fixture: 512 dummy 64 MiB blocks, 8,192 requests, five alternating repetitions. Sorted median 7,429 us; indexed median 608 us (~12.2x for this fixture), with identical placement digest `99a2f43328d0a325`. Both reference and indexed paths include index maintenance, so this isolates selection cost rather than measuring an untouched binary end to end. The committed benchmark can also be run through Cargo with `paired_crowded_pool_allocation_measurement -- --ignored --nocapture` in an optimized build. - Changed-file asset policy: 2 files pass. `git diff --check` passes. No gameplay FPS, RAM/VRAM saving, or full-workspace CI pass is claimed. Index maintenance adds metadata and update work; fragmented ranges may still require examining multiple non-full blocks. The original first-fit setting remains supported. ## Checked for overlap - [x] Overlap checked: #4082 removes the same sort with a linear fullest-fit scan. This is an alternative maintained-index approach with allocation-equivalence tests, offered separately so it can be compared/reviewed without the other changes in that PR. #3711 changes placement policy; this PR preserves the existing policy. Searched open PRs for occupancy, BTreeSet, fullest/index and allocation sorting. ## Current-main revalidation (2026-12-01) Rebased as one focused commit `ca4df4e1` 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 pool:: -- --test-threads=1`: **32 passed, 0 failed, 5 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 18:08:52 +00:00
github-bot force-pushed github-bot/gh-4219 from 80c4f55cfb to ca4df4e1a0 2026-12-01 04:14:07 +00:00 Compare
Author
Owner

@⁠Alilou92 on GitHub · 2026-12-01 18:31 UTC · original

Tested on Windows 11, Intel Core Ultra 7 265KF, NVIDIA GeForce RTX 5070 (12 Go), merged onto main 5fabb46e.

  • cargo test -p victory-gpu --lib pool: the pool tests pass, including both parity tests against the original sorted selector.
  • cargo test --release -p victory-gpu --lib paired_crowded_pool_allocation_measurement -- --ignored --nocapture: sorted median 7167 µs, indexed median 442 µs (x16.2), placement_digest=99a2f43328d0a325, the same digest as in your description.

Unrelated to this PR: host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue fails at uav_pool.rs:488 (!spare_has(bet4m_raw, 4 << 20)) in about one run in three when run alongside the other pool tests: 3 of 8 runs on main without this PR. It passes when run alone. spare_has compares raw buffer addresses in the shared UAV_SPARE, which the other GPU tests running at the same time also fill, so a freed address can come back as another test's buffer.

Nit: in reclaim's sweep, self.available.remove(&(Reverse(0), i)) assumes a whole block has held == 0. held is lowered with saturating_sub, so removing (Reverse(empty.held), i) would keep the index consistent even if held ever drifts.

**@⁠Alilou92** on GitHub · 2026-12-01 18:31 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4219#issuecomment-7321096134) Tested on Windows 11, Intel Core Ultra 7 265KF, NVIDIA GeForce RTX 5070 (12 Go), merged onto main 5fabb46e. - `cargo test -p victory-gpu --lib pool`: the pool tests pass, including both parity tests against the original sorted selector. - `cargo test --release -p victory-gpu --lib paired_crowded_pool_allocation_measurement -- --ignored --nocapture`: sorted median 7167 µs, indexed median 442 µs (x16.2), `placement_digest=99a2f43328d0a325`, the same digest as in your description. Unrelated to this PR: `host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue` fails at uav_pool.rs:488 (`!spare_has(bet4m_raw, 4 << 20)`) in about one run in three when run alongside the other pool tests: 3 of 8 runs on main without this PR. It passes when run alone. `spare_has` compares raw buffer addresses in the shared `UAV_SPARE`, which the other GPU tests running at the same time also fill, so a freed address can come back as another test's buffer. Nit: in `reclaim`'s sweep, `self.available.remove(&(Reverse(0), i))` assumes a whole block has `held == 0`. `held` is lowered with `saturating_sub`, so removing `(Reverse(empty.held), i)` would keep the index consistent even if `held` ever drifts.
github-bot closed this pull request 2026-12-01 18:50:27 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:45 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4219#issuecomment-7321483687) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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!4220
No description provided.