d3d12-gpu: pack Pool allocations into the fullest live ripe block so sparse and draining blocks reclaim (D3D12-POOL-PACK-FULLEST-BLOCK) #3302

Open
lixonik wants to merge 1 commit from upstream-pr/3302 into main
lixonik commented 2026-12-03 06:27:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:27:04Z.


Summary

Addresses #3261 (and complements #3201 and #3296 with zero overlapping edits).

  • Root cause: Pool::take_or_need (shared by TEXTURES, STAGING, and pool::small upload/shared 64 MiB blocks) scanned self.blocks in ascending index order and allocated from the first ripe block with room. As idle textures/buffers were evicted and low-index blocks became empty, draining (in REST cooldown), or sparse, new allocations immediately re-pinned those low-index blocks instead of packing into fuller live blocks -- stranding live resources thinly across many 64 MiB heaps so reclaim() could never observe whole(BLOCK) and hand them back to D3D12/Windows.
  • Fix (d3d12/crates/leonida-gpu/src/pool.rs):
    • Track free_bytes on Ranges with read-only find(len, align) (O(1) free_bytes < len guard + checked_add) and take_at(range_start, at, len).
    • Track live_bytes on Block<B> (incremented on allocation across both ripe and unripe paths; decremented immediately in give_at when a piece is returned, before the REST cooldown).
    • Select ripe blocks by (tier, live_bytes, BLOCK - free_bytes, Reverse(index)):
      • Tier 2 (live_bytes > 0): pack tightly into the fullest live ripe block first, leaving sparse blocks untouched so they drain naturally.
      • Tier 1 (live_bytes == 0, !whole(BLOCK)): draining block with resting pieces (only touched if no live block fits, avoiding unnecessary ahead growth and keeping empty blocks reclaimable).
      • Tier 0 (whole(BLOCK)): empty ripe block (lowest index), touched only when neither live nor draining blocks fit.
    • Short-circuits dominated blocks (key <= best_key) in O(1) before touching BTreeMap. Preserves Ripe page-fault safety (ripe.is(block) and oldest-first unripe fallback).

Verification

Unit Tests (red -> green, Windows 10 x64, RTX 5070 12 GB, driver 595.79)

  • Added two tests in d3d12/crates/leonida-gpu/src/pool.rs:
    • new_pieces_pack_into_fullest_live_block_and_let_sparse_blocks_drain
    • draining_block_with_only_resting_pieces_is_not_repinned_while_live_block_fits
  • Red (before fix): both failed (left: 0, right: 2 and left: 0, right: 1 -- first-index allocation poisoned empty and draining block 0).
  • Green (after fix): cargo test -p leonida-gpu --lib --locked pool:: -> 23 passed, 0 failed (covers both pool::tests and pool::small::tests).
  • python -I scripts/check_no_game_data.py -> PASS.
  • cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked -> PASS.
  • Independent read-only diff review (APPROVE).

RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS

  • Head / base: 0bb75e0ba on main d9b618f10
  • GPU / Driver / OS: NVIDIA GeForce RTX 5070 (12 GB), driver 595.79, Windows 10 x64
  • Profile: -SeriesS -NoFrameGen, same restored save snapshot
Run Time in world (total) World samples (max draws) Device lost / crashes / errors Median FPS (ms) Slowest / fastest tenth (fps)
PR (0bb75e0ba on d9b618f10) 315 s (438.2 s) 65 (5,450) 0 / 0 / 0 27.0 fps (37.0 ms) 23.1 / 27.9
Matched main (d9b618f10) 315 s (430.8 s) 64 (7,828) 0 / 0 / 0 27.0 fps (37.1 ms) 20.2 / 27.9
  • What was not tested in-game: a 10--15 minute city-driving bulk-eviction session on a 64 GB / 32 GB system (the stationary 315 s save gate confirms stability, zero regressions, and clean allocation pacing; block-draining and reclamation under churn are exercised directly by the unit tests).

AI-assisted: Antigravity (Gemini 4 Neon; separate read-only reviewer subagent: Antigravity Pro preset / Gemini Pro)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5621242235 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T06:27:04Z. --- ## Summary Addresses #3261 (and complements #3201 and #3296 with zero overlapping edits). - **Root cause:** `Pool::take_or_need` (shared by `TEXTURES`, `STAGING`, and `pool::small` upload/shared 64 MiB blocks) scanned `self.blocks` in ascending index order and allocated from the first ripe block with room. As idle textures/buffers were evicted and low-index blocks became empty, draining (in `REST` cooldown), or sparse, new allocations immediately re-pinned those low-index blocks instead of packing into fuller live blocks -- stranding live resources thinly across many 64 MiB heaps so `reclaim()` could never observe `whole(BLOCK)` and hand them back to D3D12/Windows. - **Fix (`d3d12/crates/leonida-gpu/src/pool.rs`):** - Track `free_bytes` on `Ranges` with read-only `find(len, align)` (O(1) `free_bytes < len` guard + `checked_add`) and `take_at(range_start, at, len)`. - Track `live_bytes` on `Block<B>` (incremented on allocation across both ripe and unripe paths; decremented immediately in `give_at` when a piece is returned, before the `REST` cooldown). - Select ripe blocks by `(tier, live_bytes, BLOCK - free_bytes, Reverse(index))`: - **Tier 2 (`live_bytes > 0`):** pack tightly into the fullest live ripe block first, leaving sparse blocks untouched so they drain naturally. - **Tier 1 (`live_bytes == 0`, `!whole(BLOCK)`):** draining block with resting pieces (only touched if no live block fits, avoiding unnecessary `ahead` growth and keeping empty blocks reclaimable). - **Tier 0 (`whole(BLOCK)`):** empty ripe block (lowest index), touched only when neither live nor draining blocks fit. - Short-circuits dominated blocks (`key <= best_key`) in O(1) before touching `BTreeMap`. Preserves `Ripe` page-fault safety (`ripe.is(block)` and oldest-first unripe fallback). ## Verification ### Unit Tests (`red -> green`, Windows 10 x64, RTX 5070 12 GB, driver 595.79) - Added two tests in `d3d12/crates/leonida-gpu/src/pool.rs`: - `new_pieces_pack_into_fullest_live_block_and_let_sparse_blocks_drain` - `draining_block_with_only_resting_pieces_is_not_repinned_while_live_block_fits` - **Red (before fix):** both failed (`left: 0, right: 2` and `left: 0, right: 1` -- first-index allocation poisoned empty and draining block `0`). - **Green (after fix):** `cargo test -p leonida-gpu --lib --locked pool::` -> **23 passed, 0 failed** (covers both `pool::tests` and `pool::small::tests`). - `python -I scripts/check_no_game_data.py` -> **PASS**. - `cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked` -> **PASS**. - Independent read-only diff review (`APPROVE`). ### **RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS** - **Head / base:** `0bb75e0ba` on `main` `d9b618f10` - **GPU / Driver / OS:** NVIDIA GeForce RTX 5070 (12 GB), driver 595.79, Windows 10 x64 - **Profile:** `-SeriesS -NoFrameGen`, same restored save snapshot | Run | Time in world (total) | World samples (max draws) | Device lost / crashes / errors | Median FPS (ms) | Slowest / fastest tenth (fps) | | --- | ---: | ---: | ---: | ---: | ---: | | **PR (`0bb75e0ba` on `d9b618f10`)** | `315 s` (`438.2 s`) | `65` (`5,450`) | **`0` / `0` / `0`** | **`27.0 fps`** (`37.0 ms`) | `23.1` / `27.9` | | **Matched `main` (`d9b618f10`)** | `315 s` (`430.8 s`) | `64` (`7,828`) | **`0` / `0` / `0`** | **`27.0 fps`** (`37.1 ms`) | `20.2` / `27.9` | - **What was not tested in-game:** a 10--15 minute city-driving bulk-eviction session on a 64 GB / 32 GB system (the stationary 315 s save gate confirms stability, zero regressions, and clean allocation pacing; block-draining and reclamation under churn are exercised directly by the unit tests). AI-assisted: Antigravity (Gemini 4 Neon; separate read-only reviewer subagent: Antigravity Pro preset / Gemini Pro)
fiestorra commented 2026-12-03 06:29:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T06:29:27Z.


VERIFY-3302 — 717/1 (el 1 es la iGPU), cero tests nuevos, y el cambio es de empacar bloques

d3d12/crates/leonida-gpu/src/pool.rs   1 file changed, 151 insertions(+), 26 deletions(-)
cargo test -p leonida-gpu --lib
  717 passed; 1 failed; 59 ignored
  tests nuevos en el diff      0

717 contra los 715 de main — dos tests que su base trae y que main no, no dos que este PR añada (medido en el diff: cero #[test] nuevos). La distinción es la lección de esta tarde y aquí se ve el caso al revés: un número más alto que no significa lo que parece.

El título: «pack Pool allocations into the fullest live ripe block so sparse…» — empacar las reservas del Pool en el bloque vivo más lleno, que es una decisión de colocación y no de asignación. Y en el asignador, una decisión de colocación es donde vive la fragmentación: dos estrategias que asignan lo mismo pueden dejar huecos distintos, y el hueco es lo que se ve como «memoria que no se libera».

Lo que no trae, y por qué importa más que en otros: un asignador es de las pocas piezas donde la prueba correcta no necesita GPU — se le da una secuencia de reservas y liberaciones y se mira dónde quedaron. 151 líneas sin un #[test] en pool.rs, que ya tiene tests, es la omisión que le señalaría al autor — no porque el cambio esté mal, sino porque el sitio donde está sí permite probarlo.

Lo que verifiqué: la suite completa del crate con el cambio, y que el único fallo es el conocido.
Lo que no: la fragmentación de verdad bajo el juego — que necesita una sesión larga y una medida de memoria, y en este repositorio eso es una fila de gpu-test-results/.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369893598 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302#issuecomment-7369893598). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T06:29:27Z. --- ## VERIFY-3302 — 717/1 (el 1 es la iGPU), **cero tests nuevos**, y el cambio es de empacar bloques ``` d3d12/crates/leonida-gpu/src/pool.rs 1 file changed, 151 insertions(+), 26 deletions(-) cargo test -p leonida-gpu --lib 717 passed; 1 failed; 59 ignored tests nuevos en el diff 0 ``` **717 contra los 715 de `main`** — **dos tests que su base trae y que `main` no, no dos que este PR añada** (**medido en el diff: cero `#[test]` nuevos**). **La distinción es la lección de esta tarde y aquí se ve el caso al revés: un número más alto que no significa lo que parece.** **El título**: **«pack Pool allocations into the fullest live ripe block so sparse…»** — **empacar las reservas del `Pool` en el bloque vivo más lleno**, **que es una decisión de colocación y no de asignación.** **Y en el asignador, una decisión de colocación es donde vive la fragmentación**: **dos estrategias que asignan lo mismo pueden dejar huecos distintos, y el hueco es lo que se ve como «memoria que no se libera».** **Lo que no trae, y por qué importa más que en otros**: **un asignador es de las pocas piezas donde la prueba correcta no necesita GPU** — **se le da una secuencia de reservas y liberaciones y se mira dónde quedaron.** **151 líneas sin un `#[test]` en `pool.rs`, que ya tiene tests, es la omisión que le señalaría al autor** — **no porque el cambio esté mal, sino porque el sitio donde está sí permite probarlo.** **Lo que verifiqué**: **la suite completa del crate con el cambio, y que el único fallo es el conocido.** **Lo que no**: **la fragmentación de verdad bajo el juego** — **que necesita una sesión larga y una medida de memoria, y en este repositorio eso es una fila de `gpu-test-results/`.**
merzleckeier commented 2026-12-03 06:30:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T06:30:37Z.

Review: COMMENTED


Reviewed 0bb75e0b on d9b618f10. It merges cleanly with #3201 at c7d0c962. All 24 pool tests passed in the merged Windows MSVC diagnostics build under Wine, including both new packing tests and #3201’s critical-commit test. The two-block test from #3261 also switches its 8 MiB allocation to the fuller block and releases the sparse block once its original piece finishes resting.

[P3] Measure the cost of scanning every block under the allocation lock. In the ranked search, the search still visits all candidate blocks when the first one has room. I measured the exact allocator with 234 equally occupied 64 MiB blocks, repeatedly taking and giving back 4 KiB. Both versions placed each piece in the same block. In this Linux Rust 1.98.1 allocator-only test, the median operation went from 56 to 399 ns with Ripe::ALL (staging/small pools) and from 456 to 490 ns with ahead enabled (texture pool, which already counted empty blocks). The fixture uses generated ranges and has no driver calls or lock contention. The longer churn run in #3261 could record the existing pool lock-wait counters alongside block counts to show the trade-off on Windows. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6164747427 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302#pullrequestreview-6164747427). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T06:30:37Z. **Review:** COMMENTED --- Reviewed `0bb75e0b` on `d9b618f10`. It merges cleanly with #3201 at `c7d0c962`. All 24 pool tests passed in the merged Windows MSVC diagnostics build under Wine, including both new packing tests and #3201’s critical-commit test. The [two-block test from #3261](https://github.com/ProjectLeonida/mandy/issues/3261#issuecomment-7369749266) also switches its 8 MiB allocation to the fuller block and releases the sparse block once its original piece finishes resting. **[P3] Measure the cost of scanning every block under the allocation lock.** In [the ranked search](https://github.com/ProjectLeonida/mandy/blob/0bb75e0ba1fa4577473e89c176f45830574a9ac8/d3d12/crates/leonida-gpu/src/pool.rs#L302-L330), the search still visits all candidate blocks when the first one has room. I measured the exact allocator with 234 equally occupied 64 MiB blocks, repeatedly taking and giving back 4 KiB. Both versions placed each piece in the same block. In this Linux Rust 1.98.1 allocator-only test, the median operation went from 56 to 399 ns with `Ripe::ALL` (staging/small pools) and from 456 to 490 ns with ahead enabled (texture pool, which already counted empty blocks). The fixture uses generated ranges and has no driver calls or lock contention. The longer churn run in #3261 could record the existing pool lock-wait counters alongside block counts to show the trade-off on Windows. AI-assisted with OpenAI Codex.
lixonik commented 2026-12-03 06:39:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:39:48Z.


Thanks @merzleckeier and @fiestorra for the fast verification!

  • @merzleckeier: Appreciate you testing the #3302 + #3201 merge (24/24 pool tests) and the #3261 two-block scenario, as well as measuring the 234-block microbenchmark (456 -> 490 ns on the texture-pool path with ahead). Good point on tracking LOCK_WAITS alongside block counts in any longer city-driving churn run.
  • @fiestorra: Quick note -- the 715 -> 717 jump (+2 tests) is actually from the two new #[test] functions added in this diff (d3d12/crates/leonida-gpu/src/pool.rs:1071-1139: new_pieces_pack_into_fullest_live_block_and_let_sparse_blocks_drain and draining_block_with_only_resting_pieces_is_not_repinned_while_live_block_fits), which are both red -> green against d9b618f10.

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370088310 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302#issuecomment-7370088310). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T06:39:48Z. --- Thanks @merzleckeier and @fiestorra for the fast verification! - `@merzleckeier`: Appreciate you testing the `#3302` + `#3201` merge (24/24 pool tests) and the `#3261` two-block scenario, as well as measuring the 234-block microbenchmark (`456 -> 490 ns` on the texture-pool path with `ahead`). Good point on tracking `LOCK_WAITS` alongside block counts in any longer city-driving churn run. - `@fiestorra`: Quick note -- the `715 -> 717` jump (+2 tests) is actually from the two new `#[test]` functions added in this diff (`d3d12/crates/leonida-gpu/src/pool.rs:1071-1139`: `new_pieces_pack_into_fullest_live_block_and_let_sparse_blocks_drain` and `draining_block_with_only_resting_pieces_is_not_repinned_while_live_block_fits`), which are both `red -> green` against `d9b618f10`. AI-assisted: yes (Antigravity -- Gemini 4 Neon).
MoonEyes commented 2026-12-03 06:47:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T06:47:51Z.


RUN (in game, batch of four pull requests), each head merged with git merge --no-ff onto main d9b618f10, in one build: #2851 488416598, #3299 898b87802, #3301 670df262b, #3302 0bb75e0ba. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.6, mean 16.8
Rendered fps, last 120 s median 16.6
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. #2851 was in an earlier batch on another head; this run covers its current head, with LEONIDA_TITLE_MEMORY_SCALE unset. #3299's switch is opt-in and hardware ray tracing was not on in this 8 GB profile, so it was not exercised. #3302 changes where Pool allocations go by default; this run shows nothing fell over with it, not whether it saves memory. #3301 only reports failures; none was provoked. The precompile before the world took 468 s against about 155 s for most batches: something in this batch leaves the pipeline cache cold (not looked into).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370242846 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302#issuecomment-7370242846). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T06:47:51Z. --- RUN (in game, batch of four pull requests), each head merged with `git merge --no-ff` onto main `d9b618f10`, in one build: #2851 `488416598`, #3299 `898b87802`, #3301 `670df262b`, #3302 `0bb75e0ba`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.6, mean 16.8 | | Rendered fps, last 120 s | median 16.6 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. #2851 was in an earlier batch on another head; this run covers its current head, with `LEONIDA_TITLE_MEMORY_SCALE` unset. #3299's switch is opt-in and hardware ray tracing was not on in this 8 GB profile, so it was not exercised. #3302 changes where Pool allocations go by default; this run shows nothing fell over with it, not whether it saves memory. #3301 only reports failures; none was provoked. The precompile before the world took 468 s against about 155 s for most batches: something in this batch leaves the pipeline cache cold (not looked into). AI-assisted (Claude Code).
merzleckeier commented 2026-12-03 07:19:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T07:19:06Z.


I followed up on LOCK_WAITS with the exact allocator and diagnostics lock code from d9b618f1 and 0bb75e0b. Six workers pinned to distinct Ryzen 7 7800X3D cores each took and immediately returned 65,536 pieces. The fixture kept one empty spare, asserted both heads chose the same block, and never grew the pool. These are medians of three interleaved runs per arm.

Shape Blocks Wall time, main → PR Aggregate lock wait, main → PR Wait events, main → PR
64 KiB texture, ahead=1 16 137 → 138 ms 458 → 453 ms 263k → 257k
64 KiB texture, ahead=1 234 259 → 259 ms 1,185 → 1,194 ms 82k → 56k
4 KiB staging, ahead=0 16 121 → 131 ms 377 → 429 ms 263k → 257k
4 KiB staging, ahead=0 234 120 → 195 ms 380 → 885 ms 261k → 79k

The heavily loaded 234-block staging case is a stress test. Its lower event count comes with longer aggregate waiting, so both measures are worth retaining in the #3261 trace. This was CPU-only on Linux, using synthetic block handles and no game files or driver calls. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370853003 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302#issuecomment-7370853003). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T07:19:06Z. --- I followed up on `LOCK_WAITS` with the exact allocator and diagnostics lock code from `d9b618f1` and `0bb75e0b`. Six workers pinned to distinct Ryzen 7 7800X3D cores each took and immediately returned 65,536 pieces. The fixture kept one empty spare, asserted both heads chose the same block, and never grew the pool. These are medians of three interleaved runs per arm. | Shape | Blocks | Wall time, main → PR | Aggregate lock wait, main → PR | Wait events, main → PR | | --- | ---: | ---: | ---: | ---: | | 64 KiB texture, ahead=1 | 16 | 137 → 138 ms | 458 → 453 ms | 263k → 257k | | 64 KiB texture, ahead=1 | 234 | 259 → 259 ms | 1,185 → 1,194 ms | 82k → 56k | | 4 KiB staging, ahead=0 | 16 | 121 → 131 ms | 377 → 429 ms | 263k → 257k | | 4 KiB staging, ahead=0 | 234 | 120 → 195 ms | 380 → 885 ms | 261k → 79k | The heavily loaded 234-block staging case is a stress test. Its lower event count comes with longer aggregate waiting, so both measures are worth retaining in the #3261 trace. This was CPU-only on Linux, using synthetic block handles and no game files or driver calls. AI-assisted with OpenAI Codex.
x2Tweek commented 2026-12-03 07:53:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-12-03T07:53:58Z.


RUN (in game, RTX 5090 32 GB, hardware RT on): PASS, 0 device losses. Fewer blocks, about 1.2 GB less texture memory in blocks, reproducible over two pairs.

  • Head / main: head 0bb75e0ba merged with git merge --no-ff onto main d9b618f10 (merge 8ac31fbef, clean). No other changes.
  • Base: main d9b618f10 plus one local BLAS buffer pool, switched off (LEONIDA_HW_RT_AS_POOL_MB=0). It does not touch pool.rs.
  • GPU / driver / OS: NVIDIA GeForce RTX 5090 32 GB, driver 621.40, i9-14900KS, 64 GB DDR5, Windows 11 (26300). Diag build, features diagnostics,dlss,mimalloc.
  • Settings: Series X profile, 3840x2160 output, DLSS quality, -HardwareRT -SmoothMotion -PrecompileAll -Log, LEONIDA_D3D12_DRED=1.
  • Scenario: the same save each time. A key driver presses Enter only while the log shows the menu. In the world the character walks, and the camera turns all the time (look keys, 20 s each way). This fills memory quickly: about 46-48 GB committed within 6 minutes, then a plateau (see #3261). 600 s in the world per run. Run order: base, PR, PR, base.
run blocks made (since start) waits for their pools textures in blocks at end committed at end VRAM in use at end fps median frames > 250 ms device lost
PR, run 1 301 16,084 13,312 MB 47.0 GB 22.3 GB 12.1 5 0
PR, run 2 287 16,842 13,632 MB 46.2 GB 22.0 GB 13.8 1 0
main, run 1 376 38,259 14,656 MB 48.0 GB 22.3 GB 12.4 1 0
main, run 2 395 38,162 14,784 MB 47.4 GB 22.1 GB 13.0 2 0
  • Blocks made: about 24 % fewer. Waits for the pools fall by more than half. Texture memory in blocks at the end is 1.0-1.5 GB lower. Both pairs agree.
  • Committed memory: about 1 GB lower, the same order as the textures, but this is within what two runs can tell apart.
  • Unchanged: VRAM in use, and fps (within the scene's noise).
  • Not settled: the PR's first run had 5 frames over 250 ms against 1-2 elsewhere, and its second run had 1. I read that as noise, but someone with a longer session should watch for it.
  • Out of scope here: whether this stops the unbounded growth while driving in #3261. A spinning camera in place plateaus either way, so a long drive would have to show that.

AI-assisted: the builds, the automated runs, the log reading and this write-up were done with Claude Opus 5.5 (Claude Code); the numbers are the runtime's own log lines.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371565342 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3302#issuecomment-7371565342). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-12-03T07:53:58Z. --- **RUN (in game, RTX 5090 32 GB, hardware RT on): PASS, 0 device losses. Fewer blocks, about 1.2 GB less texture memory in blocks, reproducible over two pairs.** - **Head / main:** head `0bb75e0ba` merged with `git merge --no-ff` onto `main` `d9b618f10` (merge `8ac31fbef`, clean). No other changes. - **Base:** `main` `d9b618f10` plus one local BLAS buffer pool, switched off (`LEONIDA_HW_RT_AS_POOL_MB=0`). It does not touch `pool.rs`. - **GPU / driver / OS:** NVIDIA GeForce RTX 5090 32 GB, driver 621.40, i9-14900KS, 64 GB DDR5, Windows 11 (26300). Diag build, features `diagnostics,dlss,mimalloc`. - **Settings:** Series X profile, 3840x2160 output, DLSS quality, `-HardwareRT -SmoothMotion -PrecompileAll -Log`, `LEONIDA_D3D12_DRED=1`. - **Scenario:** the same save each time. A key driver presses Enter only while the log shows the menu. In the world the character walks, and the camera turns all the time (look keys, 20 s each way). This fills memory quickly: about 46-48 GB committed within 6 minutes, then a plateau (see #3261). 600 s in the world per run. Run order: base, PR, PR, base. | run | blocks made (since start) | waits for their pools | textures in blocks at end | committed at end | VRAM in use at end | fps median | frames > 250 ms | device lost | |---|---|---|---|---|---|---|---|---| | PR, run 1 | 301 | 16,084 | 13,312 MB | 47.0 GB | 22.3 GB | 12.1 | 5 | 0 | | PR, run 2 | 287 | 16,842 | 13,632 MB | 46.2 GB | 22.0 GB | 13.8 | 1 | 0 | | `main`, run 1 | 376 | 38,259 | 14,656 MB | 48.0 GB | 22.3 GB | 12.4 | 1 | 0 | | `main`, run 2 | 395 | 38,162 | 14,784 MB | 47.4 GB | 22.1 GB | 13.0 | 2 | 0 | - **Blocks made: about 24 % fewer.** Waits for the pools fall by more than half. Texture memory in blocks at the end is 1.0-1.5 GB lower. Both pairs agree. - **Committed memory: about 1 GB lower,** the same order as the textures, but this is within what two runs can tell apart. - **Unchanged:** VRAM in use, and fps (within the scene's noise). - **Not settled:** the PR's first run had 5 frames over 250 ms against 1-2 elsewhere, and its second run had 1. I read that as noise, but someone with a longer session should watch for it. - **Out of scope here:** whether this stops the unbounded growth while driving in #3261. A spinning camera in place plateaus either way, so a long drive would have to show that. AI-assisted: the builds, the automated runs, the log reading and this write-up were done with Claude Opus 5.5 (Claude Code); the numbers are the runtime's own log lines.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3302:upstream-pr/3302'
git switch 'upstream-pr/3302'

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 'upstream-pr/3302'
git switch 'upstream-pr/3302'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3302'
git switch 'upstream-pr/3302'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3302'
git switch 'main'
git merge --squash 'upstream-pr/3302'
git switch 'main'
git merge --ff-only 'upstream-pr/3302'
git switch 'main'
git merge 'upstream-pr/3302'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!3302
No description provided.