gpu(memory,descriptor): reclaim builder view pages, evict read-only arena pages, and cap placed-view shapes #512

Open
hingeowl wants to merge 1 commit from hingeowl/Darner:pr/memory-builder-reclaim into Main
Contributor

What it changes

  • The problem on main: builder root-view pages can leak when their packed structure is freed, read-only by-address arena pages accumulate without eviction, and inline ViewShapes / ownerless placed-view entries grow unbounded during long streaming flights.
  • Ported from ReTerryDavis/ReVIctory (cc6549d0c50a9a8d1e371f21c1d84751a45a96c1, 2d5c5adbd9ff9cf1906871e265a61d9fc890aec8, 1d5151a14647f494b01213a301268b53fc454b4):
    • Reclaims builder root-view pages when their packed structure is freed (memory.rs).
    • Adds opt-in DARNER_MEMORY_EVICT_FRAMES / DARNER_MEMORY_EVICT_ABOVE_MB to evict idle read-only by-address arena pages and fault them back on demand (memory.rs).
    • Caps inline ViewShapes at 262,144 (DARNER_PLACED_SHAPE_CAP, DARNER_VIEW_EVICT=0 to disable) and sweeps idle ownerless placed/constant entries in bounded slices from sync_heaps (descriptor.rs).

How it was tested

  • Tested revision: b83e29e (based on main c8258f9)
  • Commands and results:
    • cargo xtask policy — pass
    • cargo clippy --workspace --all-targets --locked -- -D warnings — pass
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — pass
    • cargo test -p darner-gpu --locked — pass
  • Changes a default: yes for builder view page reclamation and ViewShapes cap (DARNER_VIEW_EVICT=0 disables); read-only arena eviction (DARNER_MEMORY_EVICT_FRAMES / DARNER_MEMORY_EVICT_ABOVE_MB) is opt-in.
  • A/B result: not yet benchmarked standalone in isolation; validated in-game on cam-city60 (RTX 4090 + Ryzen 9 7950X3D, Series X, HW RT) as part of our integration branch.
  • Gates run on that revision: cargo xtask policy, both workspace clippy gates, cargo test -p darner-gpu --locked.
  • Hardware dependence: likely general (reduces host memory growth during long sessions).
  • Coverage gaps: standalone A/B memory/FPS run not yet recorded for this commit in isolation.

Checklist

  • I ran this change in the game.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found
  • Replaces or overlaps: none found
## What it changes - The problem on main: builder root-view pages can leak when their packed structure is freed, read-only by-address arena pages accumulate without eviction, and inline `ViewShapes` / ownerless placed-view entries grow unbounded during long streaming flights. - Ported from `ReTerryDavis/ReVIctory` (`cc6549d0c50a9a8d1e371f21c1d84751a45a96c1`, `2d5c5adbd9ff9cf1906871e265a61d9fc890aec8`, `1d5151a14647f494b01213a301268b53fc454b4`): - Reclaims builder root-view pages when their packed structure is freed (`memory.rs`). - Adds opt-in `DARNER_MEMORY_EVICT_FRAMES` / `DARNER_MEMORY_EVICT_ABOVE_MB` to evict idle read-only by-address arena pages and fault them back on demand (`memory.rs`). - Caps inline `ViewShapes` at 262,144 (`DARNER_PLACED_SHAPE_CAP`, `DARNER_VIEW_EVICT=0` to disable) and sweeps idle ownerless placed/constant entries in bounded slices from `sync_heaps` (`descriptor.rs`). ## How it was tested - Tested revision: `b83e29e` (based on `main` `c8258f9`) - Commands and results: - `cargo xtask policy` — pass - `cargo clippy --workspace --all-targets --locked -- -D warnings` — pass - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — pass - `cargo test -p darner-gpu --locked` — pass - Changes a default: yes for builder view page reclamation and `ViewShapes` cap (`DARNER_VIEW_EVICT=0` disables); read-only arena eviction (`DARNER_MEMORY_EVICT_FRAMES` / `DARNER_MEMORY_EVICT_ABOVE_MB`) is opt-in. - A/B result: not yet benchmarked standalone in isolation; validated in-game on `cam-city60` (RTX 4090 + Ryzen 9 7950X3D, Series X, HW RT) as part of our integration branch. - Gates run on that revision: `cargo xtask policy`, both workspace `clippy` gates, `cargo test -p darner-gpu --locked`. - Hardware dependence: likely general (reduces host memory growth during long sessions). - Coverage gaps: standalone A/B memory/FPS run not yet recorded for this commit in isolation. ## Checklist - [x] I ran this change in the game. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found - Replaces or overlaps: none found
Port memory and descriptor reaping improvements from ReVIctory:
- Reclaim builder root-view pages when their packed structure is freed (prevents 3 GiB arena leak).
- Add opt-in DARNER_MEMORY_EVICT_FRAMES / DARNER_MEMORY_EVICT_ABOVE_MB to evict idle read-only by-address arena pages and fault them back on demand.
- Cap inline ViewShapes at 262,144 (DARNER_PLACED_SHAPE_CAP, DARNER_VIEW_EVICT=0 to disable) and sweep idle ownerless placed/constant entries in bounded slices from sync_heaps.

Upstream-Repository: https://github.com/ReTerryDavis/ReVIctory
Upstream-Commit: cc6549d0c50a9a8d1e371f21c1d84751a45a96c1
Upstream-Commit: 2d5c5adbd9ff9cf1906871e265a61d9fc890aec8
Upstream-Commit: 1d5151a14647f494b01213a301268b53fc454b4
Integration-Base: f666dbf
Validation: cargo test --locked -p darner-gpu --lib memory (78 passed) and descriptor::tests (21 passed)
TrustNo1 changed title from [pr-performance][memory] gpu(memory,descriptor): reclaim builder view pages, evict read-only arena pages, and cap placed-view shapes to gpu(memory,descriptor): reclaim builder view pages, evict read-only arena pages, and cap placed-view shapes 2026-12-06 03:27:48 +00:00
Owner

Test needed — commit b83e29e2; what to check:

  • The problem on main: builder root-view pages can leak when their packed structure is freed, read-only by-address arena pages accumulate without eviction, and inline ViewShapes / ownerless placed-view entries grow unbounded during long streaming flights.
  • Ported from ReTerryDavis/ReVIctory (cc6549d0c50a9a8d1e371f21c1d84751a45a96c1, 2d5c5adbd9ff9cf1906871e265a61d9fc890aec8, 1d5151a14647f494b01213a301268b53fc454b4):
    • Reclaims builder root-view pages when their packed structure is freed (memory.rs).
    • Adds opt-in DARNER_MEMORY_EVICT_FRAMES / DARNER_MEMORY_EVICT_ABOVE_MB to evict idle read-only by-address arena pages and fault them back on demand (memory.rs).
    • Caps inline ViewShapes at 262,144 (DARNER_PLACED_SHAPE_CAP, DARNER_VIEW_EVICT=0 to disable) and sweeps idle ownerless placed/constant entries in bounded slices from sync_heaps (descriptor.rs).

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `b83e29e2`; what to check: - The problem on main: builder root-view pages can leak when their packed structure is freed, read-only by-address arena pages accumulate without eviction, and inline `ViewShapes` / ownerless placed-view entries grow unbounded during long streaming flights. - Ported from `ReTerryDavis/ReVIctory` (`cc6549d0c50a9a8d1e371f21c1d84751a45a96c1`, `2d5c5adbd9ff9cf1906871e265a61d9fc890aec8`, `1d5151a14647f494b01213a301268b53fc454b4`): - Reclaims builder root-view pages when their packed structure is freed (`memory.rs`). - Adds opt-in `DARNER_MEMORY_EVICT_FRAMES` / `DARNER_MEMORY_EVICT_ABOVE_MB` to evict idle read-only by-address arena pages and fault them back on demand (`memory.rs`). - Caps inline `ViewShapes` at 262,144 (`DARNER_PLACED_SHAPE_CAP`, `DARNER_VIEW_EVICT=0` to disable) and sweeps idle ownerless placed/constant entries in bounded slices from `sync_heaps` (`descriptor.rs`). Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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 'pr/memory-builder-reclaim:hingeowl-pr/memory-builder-reclaim'
git switch 'hingeowl-pr/memory-builder-reclaim'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'hingeowl-pr/memory-builder-reclaim'
git switch 'hingeowl-pr/memory-builder-reclaim'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'hingeowl-pr/memory-builder-reclaim'
git switch 'hingeowl-pr/memory-builder-reclaim'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'hingeowl-pr/memory-builder-reclaim'
git switch 'Main'
git merge --squash 'hingeowl-pr/memory-builder-reclaim'
git switch 'Main'
git merge --ff-only 'hingeowl-pr/memory-builder-reclaim'
git switch 'Main'
git merge 'hingeowl-pr/memory-builder-reclaim'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
TrustNo1/Darner!512
No description provided.