d3d12: use 8 MiB texture pool blocks by default and guard aliasing barriers (D3D12-TEXTURE-BLOCK-8MB) #3466

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u  "d3d12/texture-block-8mb:und3rlake-d3d12/texture-block-8mb"
git switch "und3rlake-d3d12/texture-block-8mb"
Open
leonida/mandy
und3rlake wants to merge 1 commit from und3rlake/mandy:d3d12/texture-block-8mb into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
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 'd3d12/texture-block-8mb:und3rlake-d3d12/texture-block-8mb'
git switch 'und3rlake-d3d12/texture-block-8mb'
First-time contributor

Summary

Implements D3D12-TEXTURE-BLOCK-8MB (claimed in #3312):

  1. Per-pool block size & 8 MiB texture blocks (d3d12/crates/leonida-gpu/src/pool.rs, d3d12/docs/switches.md)

    • Parameterize Pool<B> with block_size: u64 (Pool::new_sized) so TEXTURES uses LEONIDA_TEXTURE_BLOCK_MB (default 8 MiB, clamped to 4..=64 MiB) while STAGING and pool::small keep BLOCK (64 MiB).
    • Consistently apply block_size / texture_block_bytes() across take_or_need, reclaim, add, texture_room(), memory(), CreateHeap, and book::block.
    • Document LEONIDA_TEXTURE_BLOCK_MB in d3d12/docs/switches.md.
  2. Fix D3D12 aliasing-barrier spec violation on committed fallback textures (d3d12/crates/leonida-gpu/src/{resource,host,texture}.rs)

    • Live 8 MiB testing caught a host state prelude did not record (0x80070057) (E_INVALIDARG) at list.Close() when textures larger than the block size fall back to CreateCommittedResource: both host.rs and texture.rs previously emitted D3D12_RESOURCE_BARRIER_TYPE_ALIASING whenever crate::pool::on() was true, even for committed resources, which D3D12 rejects.
    • Track placed allocation provenance on HostTexture (pooled: bool) and expose HostTexture::may_alias() (self.pooled || self.tiled.is_some()), covering placed pool textures and reserved tiled textures while excluding committed resources.
    • Guard both D3D12_RESOURCE_BARRIER_TYPE_ALIASING emission sites (host.rs HostList::prelude and texture.rs record_upload) with copy.may_alias().

Paired Live Measurements (NVIDIA RTX 5070 12 GB, Windows 11)

Same diagnostic release build (-SeriesS, no frame generation, 315 s automated run from the same save), comparing LEONIDA_TEXTURE_BLOCK_MB=8 (default) vs LEONIDA_TEXTURE_BLOCK_MB=64 (previous behavior):

Metric 8 MiB (default) 64 MiB (previous) Delta
Errors / warnings / UNRIPE 0 / 0 / 0 0 / 0 / 0 clean
World frame rate (median / slowest 10% / fastest 10%) 25.5 / 18.7 / 27.9 fps (36 world samples) 25.5 / 16.4 / 26.6 fps (38 world samples) 0.0 fps median (+2.3 fps p10)
3000-4999 draws/frame median 25.3 fps 25.6 fps -0.3 fps
Texture pool blocks (pool.rs:931) 3568 MB (446 blocks) 4736 MB (74 blocks) -1168 MB
Live textures in blocks (pool.rs:963) 3464 MB (58340 alive) 3948 MB (68019 alive) —
Unused texture-pool overhead (blocks - live) 104 MB (3.0%, incl. 96 MB ahead) 788 MB (20.0%, incl. 768 MB ahead) -684 MB (-17.0 pp)
Committed fallback (> 8 MiB fillable textures) 6 of 58346 (60 MB, 0.01% by count) 0 of 68019 0 errors
VRAM in use at end (budget 11176 MB) 6280 MB 7587 MB -1307 MB
Texture blocks made (total / longest) 454 in 560 ms (longest 52.7 ms) 89 in 442 ms (longest 67.2 ms) +118 ms total, -14.5 ms peak
Pool lock waits (total / longest) 1034 (2 ms total, 0.1 ms max) 1017 (1 ms total, 0.2 ms max) +1 ms over 5 min

(Note: live runs were recorded on the same patch immediately prior to rebasing cleanly onto 30c683055; all unit, GPU, clippy, and switch-catalog checks were re-run after the rebase.)

Verification (NVIDIA RTX 5070 12 GB, Windows 11)

  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md — PASS
  • python -m unittest discover -s tests -p test_d3d12_switches.py — 22/22 PASS
  • python -I scripts/check_no_game_data.py — PASS
  • cargo test -p leonida-gpu --lib --locked pool:: -- --test-threads=1 — 23/23 PASS (includes texture_block_size_defaults_to_8_mib_and_clamps and smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit)
  • cargo test -p leonida-gpu --lib --locked --features diagnostics pool:: -- --test-threads=1 — 23/23 PASS
  • cargo test -p leonida-gpu --lib --locked committed_fallback_texture_does_not_claim_aliasing_barrier — 1/1 PASS (verified red → green against real D3D12 list.Close(): unguarded aliasing barrier on a committed fallback texture returns HRESULT(0x80070057), guarded path closes cleanly)
  • cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings — 0 warnings
  • Independent read-only code review completed (APPROVE).

AI-assisted: yes

### Summary Implements `D3D12-TEXTURE-BLOCK-8MB` (claimed in #3312): 1. **Per-pool block size & 8 MiB texture blocks (`d3d12/crates/leonida-gpu/src/pool.rs`, `d3d12/docs/switches.md`)** - Parameterize `Pool<B>` with `block_size: u64` (`Pool::new_sized`) so `TEXTURES` uses `LEONIDA_TEXTURE_BLOCK_MB` (default `8` MiB, clamped to `4..=64` MiB) while `STAGING` and `pool::small` keep `BLOCK` (`64` MiB). - Consistently apply `block_size` / `texture_block_bytes()` across `take_or_need`, `reclaim`, `add`, `texture_room()`, `memory()`, `CreateHeap`, and `book::block`. - Document `LEONIDA_TEXTURE_BLOCK_MB` in `d3d12/docs/switches.md`. 2. **Fix D3D12 aliasing-barrier spec violation on committed fallback textures (`d3d12/crates/leonida-gpu/src/{resource,host,texture}.rs`)** - Live 8 MiB testing caught `a host state prelude did not record (0x80070057)` (`E_INVALIDARG`) at `list.Close()` when textures larger than the block size fall back to `CreateCommittedResource`: both `host.rs` and `texture.rs` previously emitted `D3D12_RESOURCE_BARRIER_TYPE_ALIASING` whenever `crate::pool::on()` was true, even for committed resources, which D3D12 rejects. - Track placed allocation provenance on `HostTexture` (`pooled: bool`) and expose `HostTexture::may_alias()` (`self.pooled || self.tiled.is_some()`), covering placed pool textures and reserved tiled textures while excluding committed resources. - Guard both `D3D12_RESOURCE_BARRIER_TYPE_ALIASING` emission sites (`host.rs` `HostList::prelude` and `texture.rs` `record_upload`) with `copy.may_alias()`. ### Paired Live Measurements (NVIDIA RTX 5070 12 GB, Windows 11) Same diagnostic release build (`-SeriesS`, no frame generation, 315 s automated run from the same save), comparing `LEONIDA_TEXTURE_BLOCK_MB=8` (default) vs `LEONIDA_TEXTURE_BLOCK_MB=64` (previous behavior): | Metric | `8 MiB` (default) | `64 MiB` (previous) | Delta | | --- | --- | --- | --- | | Errors / warnings / `UNRIPE` | `0` / `0` / `0` | `0` / `0` / `0` | clean | | World frame rate (median / slowest 10% / fastest 10%) | `25.5` / `18.7` / `27.9` fps (`36` world samples) | `25.5` / `16.4` / `26.6` fps (`38` world samples) | `0.0` fps median (`+2.3` fps p10) | | `3000-4999` draws/frame median | `25.3` fps | `25.6` fps | `-0.3` fps | | Texture pool blocks (`pool.rs:931`) | `3568 MB` (`446` blocks) | `4736 MB` (`74` blocks) | `-1168 MB` | | Live textures in blocks (`pool.rs:963`) | `3464 MB` (`58340` alive) | `3948 MB` (`68019` alive) | — | | **Unused texture-pool overhead (`blocks - live`)** | **`104 MB` (`3.0%`, incl. `96 MB` ahead)** | **`788 MB` (`20.0%`, incl. `768 MB` ahead)** | **`-684 MB` (`-17.0 pp`)** | | Committed fallback (`> 8 MiB` fillable textures) | `6` of `58346` (`60 MB`, `0.01%` by count) | `0` of `68019` | `0` errors | | VRAM in use at end (budget `11176 MB`) | `6280 MB` | `7587 MB` | `-1307 MB` | | Texture blocks made (total / longest) | `454` in `560 ms` (longest `52.7 ms`) | `89` in `442 ms` (longest `67.2 ms`) | `+118 ms` total, `-14.5 ms` peak | | Pool lock waits (total / longest) | `1034` (`2 ms` total, `0.1 ms` max) | `1017` (`1 ms` total, `0.2 ms` max) | `+1 ms` over 5 min | *(Note: live runs were recorded on the same patch immediately prior to rebasing cleanly onto `30c683055`; all unit, GPU, clippy, and switch-catalog checks were re-run after the rebase.)* ### Verification (NVIDIA RTX 5070 12 GB, Windows 11) - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` — PASS - `python -m unittest discover -s tests -p test_d3d12_switches.py` — `22/22` PASS - `python -I scripts/check_no_game_data.py` — PASS - `cargo test -p leonida-gpu --lib --locked pool:: -- --test-threads=1` — `23/23` PASS (includes `texture_block_size_defaults_to_8_mib_and_clamps` and `smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit`) - `cargo test -p leonida-gpu --lib --locked --features diagnostics pool:: -- --test-threads=1` — `23/23` PASS - `cargo test -p leonida-gpu --lib --locked committed_fallback_texture_does_not_claim_aliasing_barrier` — `1/1` PASS (verified red → green against real D3D12 `list.Close()`: unguarded aliasing barrier on a committed fallback texture returns `HRESULT(0x80070057)`, guarded path closes cleanly) - `cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings` — `0` warnings - Independent read-only code review completed (`APPROVE`). AI-assisted: yes
Give Pool<B> a per-pool block_size so TEXTURES uses LEONIDA_TEXTURE_BLOCK_MB
(default 8 MiB, clamped to 4..=64 MiB) while STAGING and small-buffer pools
keep the 64 MiB BLOCK size. Smaller texture blocks cut unused pool overhead
(both ahead-allocated empty blocks and partially empty blocks kept alive by
a single resident texture).

Track placed texture ownership on HostTexture (pooled + may_alias()) and guard
both D3D12_RESOURCE_BARRIER_TYPE_ALIASING sites (host.rs and texture.rs) with
copy.may_alias() instead of crate::pool::on(). Textures larger than the block
size fall back to CreateCommittedResource, and D3D12 rejects aliasing barriers
on committed resources with E_INVALIDARG (0x80070057) at list.Close().

AI-assisted: yes
First-time contributor

Independent local verification of this change (I changed no code).

  • Head 2b69e8fc, merge base 30c6830. All three new tests are absent on the base: git grep -F <test> 30c6830 -- <path> -> exit 1 for each.
  • On the PR head, with module-qualified names, -- --exact and a private CARGO_TARGET_DIR: pool::tests::texture_block_size_defaults_to_8_mib_and_clamps, pool::tests::smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit and resource::tests::committed_fallback_texture_does_not_claim_aliasing_barrier -> 1 passed / 817 filtered each.
  • Full --lib suite on the head: 757 passed, 1 failed, 60 ignored. The single failure is descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in (assertion left == right: copied as it was made), and it fails the same way on the untouched merge base 30c6830. Pre-existing in this environment, unrelated to this diff; I do not count it either way. I did not repeat the author's in-game run.
  • git diff --check 30c6830 2b69e8fc -> clean. python -I scripts/check_no_game_data.py on the five changed files -> clean.

GPUs tested: none (CPU-only unit tests; no device-gated test was counted). Driver: n/a. No game data, assets or extracted shaders were used or attached.

AI-assisted: yes, Hy4 flash (verification only). No approval implied; this is a local test report.

Independent local verification of this change (I changed no code). - Head `2b69e8fc`, merge base `30c6830`. All three new tests are absent on the base: `git grep -F <test> 30c6830 -- <path>` -> exit 1 for each. - On the PR head, with module-qualified names, `-- --exact` and a private `CARGO_TARGET_DIR`: `pool::tests::texture_block_size_defaults_to_8_mib_and_clamps`, `pool::tests::smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit` and `resource::tests::committed_fallback_texture_does_not_claim_aliasing_barrier` -> 1 passed / 817 filtered each. - Full `--lib` suite on the head: 757 passed, 1 failed, 60 ignored. The single failure is `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` (`assertion left == right: copied as it was made`), and it fails the same way on the untouched merge base `30c6830`. Pre-existing in this environment, unrelated to this diff; I do not count it either way. I did not repeat the author's in-game run. - `git diff --check 30c6830 2b69e8fc` -> clean. `python -I scripts/check_no_game_data.py` on the five changed files -> clean. GPUs tested: none (CPU-only unit tests; no device-gated test was counted). Driver: n/a. No game data, assets or extracted shaders were used or attached. AI-assisted: yes, Hy4 flash (verification only). No approval implied; this is a local test report.
First-time contributor

A data point from a card that sits at its budget: RTX 3070 8 GB, driver 621.47, 16 GB of RAM, Windows 11. This PR's head (2b69e8fc), one exe, LEONIDA_TEXTURE_BLOCK_MB=64 (A) against =8 (B), with scripts/game-abba.ps1 (4 pairs, 600 s in the world each, -SeriesS -Dlss quality -NoFrameGen, standing) from a save where the card is over its budget for more than half of every run. The only change to the runner was raising the gate's memory stops (-StopOverBudgetSeconds 900 -StopPrivateMB 32000 -StopCommitLeftMB 1500): it does not pass them on, and the default 60 s over budget would stop every run on this card.

4 runs a side A: 64 MiB B: 8 MiB
World median frame time (abba) 40.05 ms 40.31 ms
Texture blocks at the last census line 2,304-2,368 MB (36-37 blocks) 2,128-2,224 MB (266-278 blocks)
Textures in blocks (pool.rs:963) 1,345-1,372 MB 1,328-1,341 MB
Blocks minus live textures 937-1,023 MB (mean 989) 799-883 MB (mean 845)
Seconds over the video memory budget 329, 345, 366, 397 (mean 359) 324, 324, 329, 331 (mean 327)
Video memory at most 7,350-7,645 MB 7,422-7,543 MB
Device lost / errors / 0x80070057 at a prelude 0 / 0 / 0 0 / 0 / 0

abba: +0.27 ms (B - A), standard error 0.14, 95 % [-0.17, +0.71], 3 of 4 pairs agree: no clear difference.

Before that, in a second save indoors where the card stays under its budget (3 runs a side, my own ABBA script, same exe and arms): texture blocks 1,856 MB in A and 1,648-1,664 MB in B, frame rate medians 21.06-21.93 fps in A and 21.17-21.81 fps in B, 0 s over budget on both sides.

What I read from it:

  • The saving holds here, but it is about 170-200 MB of texture blocks (means: 172 MB here, about 200 MB indoors), not the 1,168 MB of the 5070 table. With the card full, 8 MiB blocks still leave about 800-880 MB of blocks without live textures (845 MB on average, against 989 MB with 64 MiB). I have not looked at why.
  • B spent 32 s less over the budget on average, with a tighter spread, but its worst run (331 s) is above A's best (329 s). I would not claim it from four runs a side.
  • Frame time: no difference, and none expected here.
  • I also looked at both arms' screenshots at the same times (10 to 570 s): no difference that follows the arm. The one artifact I saw (at 480 and 570 s) shows in one A run and one B run alike, so it is not this change.

GPUs tested: NVIDIA GeForce RTX 3070 8 GB, driver 621.47, Windows 11. No game data, logs or screenshots attached.

AI-assisted: Claude Code (Claude Opus 5.5); numbers checked by a separate read-only Claude Opus 5.5 agent.

A data point from a card that sits at its budget: RTX 3070 8 GB, driver 621.47, 16 GB of RAM, Windows 11. This PR's head (`2b69e8fc`), one exe, `LEONIDA_TEXTURE_BLOCK_MB=64` (A) against `=8` (B), with `scripts/game-abba.ps1` (4 pairs, 600 s in the world each, `-SeriesS -Dlss quality -NoFrameGen`, standing) from a save where the card is over its budget for more than half of every run. The only change to the runner was raising the gate's memory stops (`-StopOverBudgetSeconds 900 -StopPrivateMB 32000 -StopCommitLeftMB 1500`): it does not pass them on, and the default 60 s over budget would stop every run on this card. | 4 runs a side | A: 64 MiB | B: 8 MiB | |---|---|---| | World median frame time (`abba`) | 40.05 ms | 40.31 ms | | Texture blocks at the last census line | 2,304-2,368 MB (36-37 blocks) | 2,128-2,224 MB (266-278 blocks) | | Textures in blocks (`pool.rs:963`) | 1,345-1,372 MB | 1,328-1,341 MB | | Blocks minus live textures | 937-1,023 MB (mean 989) | 799-883 MB (mean 845) | | Seconds over the video memory budget | 329, 345, 366, 397 (mean 359) | 324, 324, 329, 331 (mean 327) | | Video memory at most | 7,350-7,645 MB | 7,422-7,543 MB | | Device lost / errors / `0x80070057` at a prelude | 0 / 0 / 0 | 0 / 0 / 0 | `abba`: +0.27 ms (B - A), standard error 0.14, 95 % [-0.17, +0.71], 3 of 4 pairs agree: no clear difference. Before that, in a second save indoors where the card stays under its budget (3 runs a side, my own ABBA script, same exe and arms): texture blocks 1,856 MB in A and 1,648-1,664 MB in B, frame rate medians 21.06-21.93 fps in A and 21.17-21.81 fps in B, 0 s over budget on both sides. What I read from it: - The saving holds here, but it is about 170-200 MB of texture blocks (means: 172 MB here, about 200 MB indoors), not the 1,168 MB of the 5070 table. With the card full, 8 MiB blocks still leave about 800-880 MB of blocks without live textures (845 MB on average, against 989 MB with 64 MiB). I have not looked at why. - B spent 32 s less over the budget on average, with a tighter spread, but its worst run (331 s) is above A's best (329 s). I would not claim it from four runs a side. - Frame time: no difference, and none expected here. - I also looked at both arms' screenshots at the same times (10 to 570 s): no difference that follows the arm. The one artifact I saw (at 480 and 570 s) shows in one A run and one B run alike, so it is not this change. GPUs tested: NVIDIA GeForce RTX 3070 8 GB, driver 621.47, Windows 11. No game data, logs or screenshots attached. AI-assisted: Claude Code (Claude Opus 5.5); numbers checked by a separate read-only Claude Opus 5.5 agent.
First-time contributor

Independent game-gate data from a 12 GB card running under budget: NVIDIA GeForce RTX 4080 Laptop GPU (12 GB, driver 32.0.16.2147, Windows 11). RTX 3070 comparison.

Setup: same PR head (2b69e8fcbf), one diag binary (diagnostics,dlss,mimalloc, exe_sha16 = 419b627dd6dad62f), Series S, hardware DXR off, DLSS / FrameGen / Smooth Motion off, fullscreen, -PrecompileUsed, LEONIDA_PIPELINE_WORKERS=4, gate_driver mode=idle, 300 s standing in world per run. LEONIDA_TEXTURE_BLOCK_MB=64 (A) vs =8 (B) in A/B/B/A order. The pipeline cache was warm: 4,259 pipelines cached for a1, b1 and b2, and 4,260 for a2. Each run made 0–1 pipelines and reported 14 bad.

Run Arm Verdict World s Scored frames (world+60s) Median FPS (ms) p5 FPS p95 frame ms Max present gap Process VRAM median / peak, world+60s→stop (MiB; budget 11,227) Priv peak / commit min (MiB) Texture pool alloc / free (MiB) Blocks made (total / max ms) Lock waits (count / total ms)
a1 64 MiB PASS 303.3 4,786 21.22 (47.13) 16.71 59.83 2.484 s 8,685 / 8,962 22,701 / 8,645 3,008 / 1,111 61 (357 / 48.4) 704 / 10
b1 8 MiB PASS 303.6 4,418 19.50 (51.28) 12.67 78.91 1.441 s 7,965 / 8,212 22,177 / 9,258 2,248 / 492 295 (454 / 24.4) 1,109 / 11
b2 8 MiB PASS 304.9 4,434 18.94 (52.80) 12.88 77.66 0.997 s 8,009 / 8,471 22,239 / 9,118 2,472 / 388 322 (494 / 17.0) 812 / 9
a2 64 MiB PASS 303.3 3,618 15.86 (63.05) 11.55 86.62 3.363 s 8,676 / 8,970 23,178 / 8,191 3,072 / 1,394 62 (270 / 19.0) 734 / 5

Observed

  • Gate result: 4/4 PASS, clean exit (0x00000000), 0 gate warnings (the gate's own warning counter), 0 missed pipeline waits, 0 unripe cuts, 0 leonida_gpu::pool warnings. GATE CONTROL was verified on every run. Thousands of runtime warnings were still logged, principally descriptor/draw diagnostics. Two 1920x1080 screenshots per run (8 total) were visually checked: non-black, no missing or corrupted textures.
  • Process VRAM: the median and peak cover world+60s through stop. 8 MiB blocks lowered the median by ~694 MiB (8,680.5 → 7,987). The mean of the per-run VRAM peaks fell from 8,966 to 8,341.5 MiB. The corresponding arm means show private peak down ~732 MiB (22,939.5 → 22,208) and minimum free commit up ~770 MiB (8,418 → 9,188).
  • Texture-pool allocation: the mean of the two terminal values per arm was 3,040 MiB for 64 MiB blocks and 2,360 MiB for 8 MiB blocks, a 680 MiB difference. The 3070 figure of ~172 MiB is also a texture-block allocation delta.
  • Block creation: 8 MiB made ~5× as many blocks (295–322 vs 61–62). Total creation time was ~160 ms higher over the run (mean 474 vs 313.5 ms). Max single-block time was 17–24 ms vs 19–48 ms. Pool lock waits were 9–11 ms total in the 8 MiB runs.
  • Frame time: CPU prep rose monotonically across the four consecutive runs (36.0 → 41.6 → 44.1 → 49.6 ms), while tex stayed 0.8–1.3 ms and gpu wait stayed 0.0 ms. The ABBA pair means were 55.09 ms for A and 52.04 ms for B. d3d12_ab_compare.py reported insufficient runs for a frame-time conclusion.

Reserve hypothesis

Under 85% budget (SPARES = 64), LEONIDA_RIPE_BLOCKS = 12 targets 12 × 64 = 768 MiB vs 12 × 8 = 96 MiB of empty ahead blocks, a calculated 672 MiB difference. At budget (SPARES = 2), the clamp gives 128 vs 16 MiB, a 112 MiB difference. The runs did not isolate how much the ahead target contributed.

Single laptop, single standing scene, four runs. Free space inside texture blocks stayed at 388–492 MiB with 8 MiB blocks. Textures placed at 4 KiB alignment share blocks with 64 KiB-aligned textures, so a surviving small texture can pin a block. The 4 KiB placement predicate allows some textures larger than 64 KiB. A separate small-texture pool was outside this test.

AI-assisted: yes. Gemini 4 Neon drafted the original report, Claude Sonnet 5.5 revised it, and GPT Sol reviewed the evidence and wording. Benchmarks and screenshot checks ran locally on the GPU above.

Independent game-gate data from a 12 GB card running **under budget**: NVIDIA GeForce RTX 4080 Laptop GPU (12 GB, driver `32.0.16.2147`, Windows 11). [RTX 3070 comparison](https://git.leonida.now/leonida/mandy/pulls/3466#issuecomment-26534). **Setup:** same PR head (`2b69e8fcbf`), one `diag` binary (`diagnostics,dlss,mimalloc`, `exe_sha16 = 419b627dd6dad62f`), Series S, hardware DXR off, DLSS / FrameGen / Smooth Motion off, fullscreen, `-PrecompileUsed`, `LEONIDA_PIPELINE_WORKERS=4`, `gate_driver` `mode=idle`, 300 s standing in world per run. `LEONIDA_TEXTURE_BLOCK_MB=64` (A) vs `=8` (B) in A/B/B/A order. The pipeline cache was warm: 4,259 pipelines cached for a1, b1 and b2, and 4,260 for a2. Each run made 0–1 pipelines and reported 14 bad. | Run | Arm | Verdict | World s | Scored frames (`world+60s`) | Median FPS (ms) | p5 FPS | p95 frame ms | Max present gap | Process VRAM median / peak, world+60s→stop (MiB; budget 11,227) | Priv peak / commit min (MiB) | Texture pool alloc / free (MiB) | Blocks made (total / max ms) | Lock waits (count / total ms) | |---|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:| | `a1` | `64 MiB` | `PASS` | 303.3 | 4,786 | 21.22 (47.13) | 16.71 | 59.83 | 2.484 s | 8,685 / 8,962 | 22,701 / 8,645 | 3,008 / 1,111 | 61 (357 / 48.4) | 704 / 10 | | `b1` | `8 MiB` | `PASS` | 303.6 | 4,418 | 19.50 (51.28) | 12.67 | 78.91 | 1.441 s | 7,965 / 8,212 | 22,177 / 9,258 | 2,248 / 492 | 295 (454 / 24.4) | 1,109 / 11 | | `b2` | `8 MiB` | `PASS` | 304.9 | 4,434 | 18.94 (52.80) | 12.88 | 77.66 | 0.997 s | 8,009 / 8,471 | 22,239 / 9,118 | 2,472 / 388 | 322 (494 / 17.0) | 812 / 9 | | `a2` | `64 MiB` | `PASS` | 303.3 | 3,618 | 15.86 (63.05) | 11.55 | 86.62 | 3.363 s | 8,676 / 8,970 | 23,178 / 8,191 | 3,072 / 1,394 | 62 (270 / 19.0) | 734 / 5 | ### Observed - **Gate result:** 4/4 `PASS`, clean exit (`0x00000000`), **0 gate warnings** (the gate's own warning counter), 0 missed pipeline waits, 0 unripe cuts, 0 `leonida_gpu::pool` warnings. `GATE CONTROL` was verified on every run. Thousands of runtime warnings were still logged, principally descriptor/draw diagnostics. Two 1920x1080 screenshots per run (8 total) were visually checked: non-black, no missing or corrupted textures. - **Process VRAM:** the median and peak cover world+60s through stop. `8 MiB` blocks lowered the median by **~694 MiB** (8,680.5 → 7,987). The mean of the per-run VRAM peaks fell from 8,966 to 8,341.5 MiB. The corresponding arm means show private peak down ~732 MiB (22,939.5 → 22,208) and minimum free commit up ~770 MiB (8,418 → 9,188). - **Texture-pool allocation:** the mean of the two terminal values per arm was **3,040 MiB** for `64 MiB` blocks and **2,360 MiB** for `8 MiB` blocks, a **680 MiB** difference. The 3070 figure of ~172 MiB is also a texture-block allocation delta. - **Block creation:** `8 MiB` made ~5× as many blocks (295–322 vs 61–62). Total creation time was ~160 ms higher over the run (mean 474 vs 313.5 ms). Max single-block time was 17–24 ms vs 19–48 ms. Pool lock waits were 9–11 ms total in the `8 MiB` runs. - **Frame time:** CPU `prep` rose monotonically across the four consecutive runs (`36.0 → 41.6 → 44.1 → 49.6 ms`), while `tex` stayed 0.8–1.3 ms and `gpu` wait stayed 0.0 ms. The ABBA pair means were 55.09 ms for A and 52.04 ms for B. `d3d12_ab_compare.py` reported insufficient runs for a frame-time conclusion. ### Reserve hypothesis Under 85% budget (`SPARES = 64`), `LEONIDA_RIPE_BLOCKS = 12` targets `12 × 64 = 768 MiB` vs `12 × 8 = 96 MiB` of empty ahead blocks, a calculated **672 MiB** difference. At budget (`SPARES = 2`), the clamp gives `128` vs `16 MiB`, a 112 MiB difference. The runs did not isolate how much the ahead target contributed. Single laptop, single standing scene, four runs. Free space inside texture blocks stayed at 388–492 MiB with `8 MiB` blocks. Textures placed at 4 KiB alignment share blocks with 64 KiB-aligned textures, so a surviving small texture can pin a block. The 4 KiB placement predicate allows some textures larger than 64 KiB. A separate small-texture pool was outside this test. *AI-assisted: yes. Gemini 4 Neon drafted the original report, Claude Sonnet 5.5 revised it, and GPT Sol reviewed the evidence and wording. Benchmarks and screenshot checks ran locally on the GPU above.*
First-time contributor

Test report from another machine (I changed no code). Not a review of the code.

  • Head 2b69e8fcb merged onto main 93b9d90a2: clean merge.
  • RTX 3060 Ti 8 GB, driver 610.88, Intel i7-13700KF, Windows 11, 32 GB RAM.
  • cargo test -p leonida-gpu --lib --locked -- --test-threads=1, 4 runs: 3 passed (793 passed, 0 failed), 1 failed.
  • The new tests (texture_block_size_defaults_to_8_mib_and_clamps, smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit, committed_fallback_texture_does_not_claim_aliasing_barrier) passed in all 4 runs.
  • The failing run: pool::small::tests::small_buffers_are_placed_in_blocks_and_used_again_on_the_card failed (small.rs:562, unwrap on None); 792 passed. I could not reproduce it in the 3 runs after.
  • About the machine: every run was inside a Windows job object capped at 6 GB of committed memory, and the PC had 6 to 7 GB of free commit. main 93b9d90a2 passed the same command 4 of 4 times (790 passed), 3 of them under the same cap.
  • That test has failed on main on this PC before, once, while Windows was short on commit, so I read this failure as the machine's and not this change's. I cannot prove it.
  • Not run: the real-card (--ignored) tests, clippy, the clean-room check, any in-game run.

GPUs tested: RTX 3060 Ti 8 GB, driver 610.88. No game files were used.

AI-assisted: yes (Claude Code, Claude Fable 5.2; verification only).

Test report from another machine (I changed no code). Not a review of the code. - Head `2b69e8fcb` merged onto `main` `93b9d90a2`: clean merge. - RTX 3060 Ti 8 GB, driver 610.88, Intel i7-13700KF, Windows 11, 32 GB RAM. - `cargo test -p leonida-gpu --lib --locked -- --test-threads=1`, 4 runs: **3 passed (793 passed, 0 failed), 1 failed**. - The new tests (`texture_block_size_defaults_to_8_mib_and_clamps`, `smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit`, `committed_fallback_texture_does_not_claim_aliasing_barrier`) passed in all 4 runs. - The failing run: `pool::small::tests::small_buffers_are_placed_in_blocks_and_used_again_on_the_card` failed (`small.rs:562`, `unwrap` on `None`); 792 passed. I could not reproduce it in the 3 runs after. - About the machine: every run was inside a Windows job object capped at 6 GB of committed memory, and the PC had 6 to 7 GB of free commit. `main` `93b9d90a2` passed the same command 4 of 4 times (790 passed), 3 of them under the same cap. - That test has failed on `main` on this PC before, once, while Windows was short on commit, so I read this failure as the machine's and not this change's. I cannot prove it. - Not run: the real-card (`--ignored`) tests, clippy, the clean-room check, any in-game run. GPUs tested: RTX 3060 Ti 8 GB, driver 610.88. No game files were used. AI-assisted: yes (Claude Code, Claude Fable 5.2; verification only).
Sign in to join this conversation.
No description provided.