GPU: honor the staging spare limit when returned ranges become reusable #1343

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

@⁠ghptc on GitHub · 2026-11-28 17:42 UTC · original
ghptc:fix/staging-allocation-spare-limit → main · +91 −29 · 1 files · 1 commits · open

The budget sweep allows one idle staging block under host pressure and zero under critical commit pressure. When returned ranges finish resting between sweeps, the next allocation reloads the texture spare limit. It can keep empty 64 MiB upload buffers beyond the staging budget until a later sweep gets the mutex.

Publish the staging limit before trying the pool lock. Each pool reads its own limit when allocating. With a zero limit, reserve a reusable range for the current request before dropping the other empty blocks. Texture allocations retain their existing trim order and ripe-block selection.

Measured on an RTX 5070

A synthetic fixture on Proton Experimental and NVIDIA 620.73.04 filled four 64 MiB D3D12 upload buffers through the production pool. It returned seven of the eight half-blocks, supplied the critical spare limit while they were resting, then advanced the allocator clock to the existing rest deadline and requested the other half of the still-live block. The growth callback refused new allocations.

After the request Main (two processes) Patch (two processes)
Blocks owning real upload buffers 3, 3 1, 1
Bytes in empty blocks 128, 128 MiB 0, 0 MiB
Successful reuses / new allocations per run 1 / 0 1 / 0

These bytes count D3D12 resources still owned by the pool. The fixture supplies the pressure state directly. Physical runs used a 1 GiB high watermark, 2 GiB hard cap and zero swap. The allocator regression failed on the base with two unexpected idle blocks. All 11 pool tests passed on the proposed source, including whole-block reuse at zero budget, recovery, delayed return and ripe texture selection. Reproduce the submitted regressions with cargo test --locked -p victory-gpu --lib pool::tests:: -- --test-threads=1 on Windows.

The duplicate check included the host texture sweep, the optional texture spare scaling, driver calls outside the pool lock, and reusable texture-budget accounting. Those changes address different paths. #394 · #784 · #816 · #1214

The diagnostic-feature cross-check and staged asset policy passed locally. Upstream Windows CI stopped at the same Clippy findings on the PR and its base, in victory-shader/src/emit/mod.rs:2768 and victory-gpu/src/shadow.rs:1708. PR check · Base check

**@⁠ghptc** on GitHub · 2026-11-28 17:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1343) `ghptc:fix/staging-allocation-spare-limit` → `main` · +91 −29 · 1 files · 1 commits · open The budget sweep allows one idle staging block under host pressure and zero under critical commit pressure. When returned ranges finish resting between sweeps, the next allocation reloads the texture spare limit. It can keep empty 64 MiB upload buffers beyond the staging budget until a later sweep gets the mutex. Publish the staging limit before trying the pool lock. Each pool reads its own limit when allocating. With a zero limit, reserve a reusable range for the current request before dropping the other empty blocks. Texture allocations retain their existing trim order and ripe-block selection. ### Measured on an RTX 5070 A synthetic fixture on Proton Experimental and NVIDIA 620.73.04 filled four 64 MiB D3D12 upload buffers through the production pool. It returned seven of the eight half-blocks, supplied the critical spare limit while they were resting, then advanced the allocator clock to the existing rest deadline and requested the other half of the still-live block. The growth callback refused new allocations. | After the request | Main (two processes) | Patch (two processes) | |---|---:|---:| | Blocks owning real upload buffers | 3, 3 | 1, 1 | | Bytes in empty blocks | 128, 128 MiB | 0, 0 MiB | | Successful reuses / new allocations per run | 1 / 0 | 1 / 0 | These bytes count D3D12 resources still owned by the pool. The fixture supplies the pressure state directly. Physical runs used a 1 GiB high watermark, 2 GiB hard cap and zero swap. The allocator regression failed on the base with two unexpected idle blocks. All 11 pool tests passed on the proposed source, including whole-block reuse at zero budget, recovery, delayed return and ripe texture selection. Reproduce the submitted regressions with `cargo test --locked -p victory-gpu --lib pool::tests:: -- --test-threads=1` on Windows. The duplicate check included the host texture sweep, the optional texture spare scaling, driver calls outside the pool lock, and reusable texture-budget accounting. Those changes address different paths. [#394](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/394) · [#784](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/784) · [#816](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/816) · [#1214](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/1214) The diagnostic-feature cross-check and staged asset policy passed locally. Upstream Windows CI stopped at the same Clippy findings on the PR and its base, in `victory-shader/src/emit/mod.rs:2768` and `victory-gpu/src/shadow.rs:1708`. [PR check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46171882557/job/141061909056) · [Base check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46157117122)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 17:46:35 +00:00
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/1343/head:github-bot/gh-1343'
git switch 'github-bot/gh-1343'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1343'
git switch 'github-bot/gh-1343'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1343'
git switch 'github-bot/gh-1343'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1343'
git switch 'main'
git merge --squash 'github-bot/gh-1343'
git switch 'main'
git merge --ff-only 'github-bot/gh-1343'
git switch 'main'
git merge 'github-bot/gh-1343'
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!1343
No description provided.