[pr-performance][memory] Pool: the card copies the title's pages from its physical-page sections itself (DARNER_POOL_COMMIT, DARNER_POOL_GPU, DARNER_POOL_OPEN_MB; off by default) #56

Open
Sobo wants to merge 1 commit from Sobo/Darner:pool into main
Contributor

DARNER_POOL_COMMIT=1 makes the sections of physical pages SEC_COMMIT on
Windows too, in pieces of at most 1 GiB, so the host can open them as
heaps, and checks once that it can. DARNER_POOL_GPU=1 opens the sections
whose pages a refresh reads (up to DARNER_POOL_OPEN_MB, 3072 unless
given) and, for card copies shaders never write, has the card copy the
pages from them through a snapshot taken by a copy queue, in place of
the CPU's copy. The heaps are let go before the process ends.

Co-Authored-By: Claude Opus 5.5 [email protected]
Fluxer-ID: 1577742832095989771

Contributor role (optional)

  • Fluxer ID: 1577742832095989771

What it changes

Three switches, all off by default:

  • DARNER_POOL_COMMIT=1: the title's physical-page sections are made SEC_COMMIT on Windows too, in pieces of at most 1 GiB (the host opened no heap over a 6 GiB section on an RTX 3090: invalid parameter). Only such a section can be opened as a host heap; a one-time "pool check" in the log says whether this PC can.
  • DARNER_POOL_GPU=1 (with POOL_COMMIT): for copies shaders never write, a refresh's bytes go up as copies the card makes itself from a buffer placed over the opened section, instead of the CPU copying them into the staging side first. If shaders are later declared to write such a copy, its CPU side takes all of title memory once (unpool).
  • DARNER_POOL_OPEN_MB=<MB> (default 3072): the most bytes of sections opened; each opened heap counts whole against the memory the PC shares with the card.

How it was tested

  • Tested revision: Darner main 4a92569fb (git.gtahub.st) with this patch applied. Build check: cargo clippy -p darner-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings and the same for -p darner-hle: clean. cargo test was not run (no Windows machine for the checks). The gameplay numbers below come from my own builds, which carried this change together with other local changes (same scene, settings and hardware before and after).
  • Hardware and setup: i7-10700K (8 cores, 16 threads), RTX 3090 24 GB, 32 GB RAM, Windows 11; page file 128 GB; NVIDIA shader cache 100 GB; shaders prepared with the preload, then darner warm --used --again with DARNER_WARM_SHARED=1.
  • Gameplay: Series X profile (and Series S where said), DLSS quality, FSR 3 frame generation 2x, ray tracing off.
  • Before and after (city drive, heavy seconds), DARNER_POOL_OPEN_MB 5120 -> 8192 (all 7.1 GB of sections open): refreshes on the submitting thread 28.3 -> 15.3 ms a frame; submitting thread 61.1 -> 46.2 ms a frame; frame time per 1,000 list calls 1.26 -> 1.12 ms; bytes the CPU copied as "no opened section holds it" 124-135 -> 64 MB a frame; bytes the card copied itself 106-138 -> 153 MB a frame; shared GPU memory 7.8 -> 9.4-9.7 GB.
  • A variant that also sent pages "taken before and written again" through the pool (POOL_AGAIN) made things worse (whole-buffer CPU copies after shader writes); it is not in this patch.
  • Coverage gaps: one PC only (RTX 30, 8-core Intel); AMD and other NVIDIA generations untested. Opened sections count against shared GPU memory (15.6 GB on a 32 GB PC): with other settings that also fill it, too high a cap can overflow it.

Checklist

  • 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 for the same problem. Open PRs that share files only: #37 (shadow.rs), #28 and #34 (lifecycle.rs), and many that touch host.rs or lib.rs.
DARNER_POOL_COMMIT=1 makes the sections of physical pages SEC_COMMIT on Windows too, in pieces of at most 1 GiB, so the host can open them as heaps, and checks once that it can. DARNER_POOL_GPU=1 opens the sections whose pages a refresh reads (up to DARNER_POOL_OPEN_MB, 3072 unless given) and, for card copies shaders never write, has the card copy the pages from them through a snapshot taken by a copy queue, in place of the CPU's copy. The heaps are let go before the process ends. Co-Authored-By: Claude Opus 5.5 <[email protected]> Fluxer-ID: 1577742832095989771 <!-- Thanks for the pull request. Please label it (pr-fix, pr-feature, pr-performance, pr-diagnostics, pr-refactor, pr-docs or pr-tests, plus the area labels), or put the label in the title, like [pr-fix]. --> <!-- Use Fixes #N for a complete fix or Refs #N for a partial change. --> ## Contributor role (optional) - Fluxer ID: 1577742832095989771 ## What it changes Three switches, all off by default: - `DARNER_POOL_COMMIT=1`: the title's physical-page sections are made `SEC_COMMIT` on Windows too, in pieces of at most 1 GiB (the host opened no heap over a 6 GiB section on an RTX 3090: invalid parameter). Only such a section can be opened as a host heap; a one-time "pool check" in the log says whether this PC can. - `DARNER_POOL_GPU=1` (with POOL_COMMIT): for copies shaders never write, a refresh's bytes go up as copies the card makes itself from a buffer placed over the opened section, instead of the CPU copying them into the staging side first. If shaders are later declared to write such a copy, its CPU side takes all of title memory once (`unpool`). - `DARNER_POOL_OPEN_MB=<MB>` (default 3072): the most bytes of sections opened; each opened heap counts whole against the memory the PC shares with the card. ## How it was tested - Tested revision: Darner `main` 4a92569fb (git.gtahub.st) with this patch applied. Build check: `cargo clippy -p darner-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings` and the same for `-p darner-hle`: clean. `cargo test` was not run (no Windows machine for the checks). The gameplay numbers below come from my own builds, which carried this change together with other local changes (same scene, settings and hardware before and after). - Hardware and setup: i7-10700K (8 cores, 16 threads), RTX 3090 24 GB, 32 GB RAM, Windows 11; page file 128 GB; NVIDIA shader cache 100 GB; shaders prepared with the preload, then `darner warm --used --again` with `DARNER_WARM_SHARED=1`. - Gameplay: Series X profile (and Series S where said), DLSS quality, FSR 3 frame generation 2x, ray tracing off. - Before and after (city drive, heavy seconds), `DARNER_POOL_OPEN_MB` 5120 -> 8192 (all 7.1 GB of sections open): refreshes on the submitting thread 28.3 -> 15.3 ms a frame; submitting thread 61.1 -> 46.2 ms a frame; frame time per 1,000 list calls 1.26 -> 1.12 ms; bytes the CPU copied as "no opened section holds it" 124-135 -> 64 MB a frame; bytes the card copied itself 106-138 -> 153 MB a frame; shared GPU memory 7.8 -> 9.4-9.7 GB. - A variant that also sent pages "taken before and written again" through the pool (POOL_AGAIN) made things worse (whole-buffer CPU copies after shader writes); it is not in this patch. - Coverage gaps: one PC only (RTX 30, 8-core Intel); AMD and other NVIDIA generations untested. Opened sections count against shared GPU memory (15.6 GB on a 32 GB PC): with other settings that also fill it, too high a cap can overflow it. ## Checklist - [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 for the same problem. Open PRs that share files only: #37 (shadow.rs), #28 and #34 (lifecycle.rs), and many that touch host.rs or lib.rs.
DARNER_POOL_COMMIT=1 makes the sections of physical pages SEC_COMMIT on
Windows too, in pieces of at most 1 GiB, so the host can open them as
heaps, and checks once that it can. DARNER_POOL_GPU=1 opens the sections
whose pages a refresh reads (up to DARNER_POOL_OPEN_MB, 3072 unless
given) and, for card copies shaders never write, has the card copy the
pages from them through a snapshot taken by a copy queue, in place of
the CPU's copy. The heaps are let go before the process ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fluxer-ID: 1577742832095989771
Sobo changed title from Pool: the card copies the title's pages from its physical-page sections itself (DARNER_POOL_COMMIT, DARNER_POOL_GPU, DARNER_POOL_OPEN_MB; off by default) to WIP: Pool: the card copies the title's pages from its physical-page sections itself (DARNER_POOL_COMMIT, DARNER_POOL_GPU, DARNER_POOL_OPEN_MB; off by default) 2026-12-03 18:03:50 +00:00
Sobo changed title from WIP: Pool: the card copies the title's pages from its physical-page sections itself (DARNER_POOL_COMMIT, DARNER_POOL_GPU, DARNER_POOL_OPEN_MB; off by default) to [pr-performance][memory] Pool: the card copies the title's pages from its physical-page sections itself (DARNER_POOL_COMMIT, DARNER_POOL_GPU, DARNER_POOL_OPEN_MB; off by default) 2026-12-03 18:33:06 +00:00
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 'pool:Sobo-pool'
git switch 'Sobo-pool'

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 'Sobo-pool'
git switch 'Sobo-pool'
git rebase 'main'
git switch 'main'
git merge --ff-only 'Sobo-pool'
git switch 'Sobo-pool'
git rebase 'main'
git switch 'main'
git merge --no-ff 'Sobo-pool'
git switch 'main'
git merge --squash 'Sobo-pool'
git switch 'main'
git merge --ff-only 'Sobo-pool'
git switch 'main'
git merge 'Sobo-pool'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
TrustNo1/Darner!56
No description provided.