D3D12.X: a title allocator takes a free spare another one put aside #2725

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

@⁠veyn-sudo on GitHub · 2026-11-26 08:58 UTC · original
veyn-sudo:pr/share-spare-allocators → main · +44 −3 · 1 files · 1 commits · open

When the title resets a command allocator while lists still hold recordings on its PC allocator, alloc_pool puts that one aside and goes on with another: one this title allocator put aside earlier that is free again, or a new one. A title that resets many allocators so makes a PC allocator for almost every one of them and keeps it, although others lie free. This lets a title allocator take a free spare of the same list type that another one put aside.

Part of #2688 (workstream 6: memory that grows in the world). Related: #2138 drops free spares beyond two per title allocator, and #2707 resets idle ones so their memory comes back. Both deal with spares already made; this makes fewer of them. #2707 also changes title_reset_in, so whichever merges second needs a rebase.

What is in it

  • crates/xcl/src/hle/d3d12x/alloc_pool.rs: title_reset_in looks for a free spare of the same type among the other title allocators' when it has none of its own, and takes it over (it then goes with this title allocator's forget). Never another title allocator's own allocator: that one goes with the title's Release. Test: a_free_spare_another_title_allocator_put_aside_is_taken (also: not one in use, not one of another type).

Tested

  • RTX 2070 SUPER (driver 617.14), i7-9700K, 32 GB, Windows 11 26300, Rust 1.99.0, debug for the tests, release for the title.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on ad9172c0: 1436 passed, 0 failed, 47 ignored; 25 SKIPPED lines (21 no wave64, 3 f16 forms refused, 1 no heap windows).
  • A retail title's world on a local tree (main + #1453 + other open PRs, XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1), with a temporary count of the spares: before, at 162 s, 315 title allocators had 327 PC allocators made, 287 of them free, and the process's non-local video memory grew 1.3 → 3.0 GB in 40 s. With this, 282 made at 191 s (flat after 160 s), non-local memory flat at about 2.6 GB from 160 s on, and the run went from 169 s to 194 s before the memory guard stopped it.

Regression run

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 404998dc
seconds: 60
exit: 0x0
frames shown: 1556 (PresentX 1556)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14673 MB

this PR:

xcl-smoke v1
commit: ad9172c015a8b33aa90ca002704ea4d3db212b40
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 404998dc
seconds: 60
exit: 0x0
frames shown: 1585 (PresentX 1585)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14372 MB

Not tested

  • AMD and Intel; the title without #1453 (without it, more spares stay held by retired split segments and fewer are free to share).

AI use

  • Claude Code with Claude Opus 5.5 wrote the code and the test, ran everything on my PC and wrote this description.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WStEFektfHt5AEbK6Wupac

**@⁠veyn-sudo** on GitHub · 2026-11-26 08:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/2725) `veyn-sudo:pr/share-spare-allocators` → `main` · +44 −3 · 1 files · 1 commits · open When the title resets a command allocator while lists still hold recordings on its PC allocator, `alloc_pool` puts that one aside and goes on with another: one this title allocator put aside earlier that is free again, or a new one. A title that resets many allocators so makes a PC allocator for almost every one of them and keeps it, although others lie free. This lets a title allocator take a free spare of the same list type that another one put aside. Part of #2688 (workstream 6: memory that grows in the world). Related: #2138 drops free spares beyond two per title allocator, and #2707 resets idle ones so their memory comes back. Both deal with spares already made; this makes fewer of them. #2707 also changes `title_reset_in`, so whichever merges second needs a rebase. **What is in it** - `crates/xcl/src/hle/d3d12x/alloc_pool.rs`: `title_reset_in` looks for a free spare of the same type among the other title allocators' when it has none of its own, and takes it over (it then goes with this title allocator's `forget`). Never another title allocator's own allocator: that one goes with the title's Release. Test: `a_free_spare_another_title_allocator_put_aside_is_taken` (also: not one in use, not one of another type). **Tested** - RTX 2070 SUPER (driver 617.14), i7-9700K, 32 GB, Windows 11 26300, Rust 1.99.0, debug for the tests, release for the title. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `ad9172c0`: 1436 passed, 0 failed, 47 ignored; 25 `SKIPPED` lines (21 no wave64, 3 f16 forms refused, 1 no heap windows). - A retail title's world on a local tree (`main` + #1453 + other open PRs, `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1`), with a temporary count of the spares: before, at 162 s, 315 title allocators had 327 PC allocators made, 287 of them free, and the process's non-local video memory grew 1.3 → 3.0 GB in 40 s. With this, 282 made at 191 s (flat after 160 s), non-local memory flat at about 2.6 GB from 160 s on, and the run went from 169 s to 194 s before the memory guard stopped it. **Regression run** main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 2070 SUPER title: 404998dc seconds: 60 exit: 0x0 frames shown: 1556 (PresentX 1556) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14673 MB ``` this PR: ``` xcl-smoke v1 commit: ad9172c015a8b33aa90ca002704ea4d3db212b40 gpu: NVIDIA GeForce RTX 2070 SUPER title: 404998dc seconds: 60 exit: 0x0 frames shown: 1585 (PresentX 1585) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14372 MB ``` **Not tested** - AMD and Intel; the title without #1453 (without it, more spares stay held by retired split segments and fewer are free to share). **AI use** - Claude Code with Claude Opus 5.5 wrote the code and the test, ran everything on my PC and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WStEFektfHt5AEbK6Wupac
A title that resets many allocators while lists hold their recordings made a PC allocator for
each and kept it: in a retail title's world 315 title allocators had 327 made, of which about 290
were free, and the process's non-local video memory grew with them, 1.3 to 3 GB in 40 s. A title
allocator with no free one of its own now takes one of the same type that another put aside (never
that one's own allocator, which goes with the title's Release).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WStEFektfHt5AEbK6Wupac
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:58:41 +00:00
This pull request can be merged automatically.
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 origin '+refs/pull/2725/head:github-bot/gh-2725'
git switch 'github-bot/gh-2725'

Merge

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