gpu/pool: drop retired blocks after the pool lock #175

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

@⁠SovietBearz0r on GitHub · 2026-12-05 20:51 UTC · original
SovietBearz0r:pool-retire-outside-lock → main · +127 −19 · 1 files · 1 commits · open

From the closed #32 review: "dropping retired pool allocations outside locks in pool.rs". Currently evicted pool blocks drop their D3D12 resources while the pool lock is held.

What

  • pool.rs: reclaim collects retired blocks' memory into a returned Vec, still counting released under the lock; rested forwards it; take_ripe writes it to the caller's vector. room(), staging() and texture() drop the vector after the guard is released, so resource destruction does not run under the pool lock.
  • take() is now the tests' helper (staging uses take_ripe directly); lock-discipline comments on room/take_ripe/rested/reclaim.
  • Accounting, spare counts and order are unchanged; no behaviour change beyond where destructors run.

Verification

  • cargo test -p victory-gpu --lib: 718 passed, 0 failed, 21 ignored (2 new: retired blocks counted/dropped after the lock; a take retires spares through the caller); clippy -D warnings clean; cargo check -p victory; policy 442 files.
  • Needs in-game: none specific — a normal play pass (world load/texture streaming) is enough to confirm no pool regression.
  • Note: while two heavy full suites ran concurrently, pool::tests::pieces_never_overlap_and_rest_before_they_are_used_again flaked on the unmodified tree too (it reads process-global pool spares and commit::low/pressed); unrelated pre-existing test fragility, worth a separate fix.
**@⁠SovietBearz0r** on GitHub · 2026-12-05 20:51 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/174) `SovietBearz0r:pool-retire-outside-lock` → `main` · +127 −19 · 1 files · 1 commits · open From the closed #32 review: "dropping retired pool allocations outside locks in `pool.rs`". Currently evicted pool blocks drop their D3D12 resources while the pool lock is held. ## What - `pool.rs`: `reclaim` collects retired blocks' memory into a returned `Vec`, still counting `released` under the lock; `rested` forwards it; `take_ripe` writes it to the caller's vector. `room()`, `staging()` and `texture()` drop the vector **after** the guard is released, so resource destruction does not run under the pool lock. - `take()` is now the tests' helper (staging uses `take_ripe` directly); lock-discipline comments on `room`/`take_ripe`/`rested`/`reclaim`. - Accounting, spare counts and order are unchanged; no behaviour change beyond where destructors run. ## Verification - `cargo test -p victory-gpu --lib`: **718 passed, 0 failed, 21 ignored** (2 new: retired blocks counted/dropped after the lock; a take retires spares through the caller); clippy `-D warnings` clean; `cargo check -p victory`; policy 442 files. - **Needs in-game**: none specific — a normal play pass (world load/texture streaming) is enough to confirm no pool regression. - Note: while two heavy full suites ran concurrently, `pool::tests::pieces_never_overlap_and_rest_before_they_are_used_again` flaked on the **unmodified** tree too (it reads process-global pool spares and `commit::low/pressed`); unrelated pre-existing test fragility, worth a separate fix.
Ports the retired-blocks change of the old amd-dev-prologue branch (80f9c04),
which the #32 review named as a wanted small PR: Pool::reclaim (and rested,
take_ripe) now only collect the blocks they retire and count them in released;
the callers drop them after releasing TEXTURES/STAGING, so letting a block's
memory go (driver and host work) does not run under the pool's lock.

staging() and texture() pass a retired vector declared before the guard, and
room() drops the vector after the guard. The accounting (released, spare) and
the order of retirement are unchanged; take() is now only the tests' helper,
staging() calls take_ripe directly.

Tests: retiring keeps the accounting and order and drops only after the lock,
and a take hands its retired blocks to the caller.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 20:53:46 +00:00
Author
Owner

@⁠SovietBearz0r on GitHub · 2026-12-05 21:48 UTC · original

In-game pass done (RX 9070 XT, diag build): clean 93.6 s run, exit 0, 0 errors, no device removals, normal pacing (46.7/42.4/40.6 fps on the spots). No pool regression/hang observed. Log: data\ingame-verify\logs\pool-retire.log.

**@⁠SovietBearz0r** on GitHub · 2026-12-05 21:48 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/174#issuecomment-7446018115) In-game pass done (RX 9070 XT, diag build): clean 93.6 s run, exit 0, 0 errors, no device removals, normal pacing (46.7/42.4/40.6 fps on the spots). No pool regression/hang observed. Log: `data\ingame-verify\logs\pool-retire.log`.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pool.rs
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.
git fetch -u origin '+refs/pull/175/head:github-bot/gh-174'
git switch 'github-bot/gh-174'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-174'
git switch 'github-bot/gh-174'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-174'
git switch 'github-bot/gh-174'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-174'
git switch 'main'
git merge --squash 'github-bot/gh-174'
git switch 'main'
git merge --ff-only 'github-bot/gh-174'
git switch 'main'
git merge 'github-bot/gh-174'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.