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
pull from: und3rlake/mandy:d3d12/texture-block-8mb
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
5 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!3466
Loading…
Reference in a new issue
No description provided.
Delete branch "und3rlake/mandy:d3d12/texture-block-8mb"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This branch is out-of-date with the base branch
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Summary
Implements
D3D12-TEXTURE-BLOCK-8MB(claimed in #3312):Per-pool block size & 8 MiB texture blocks (
d3d12/crates/leonida-gpu/src/pool.rs,d3d12/docs/switches.md)Pool<B>withblock_size: u64(Pool::new_sized) soTEXTURESusesLEONIDA_TEXTURE_BLOCK_MB(default8MiB, clamped to4..=64MiB) whileSTAGINGandpool::smallkeepBLOCK(64MiB).block_size/texture_block_bytes()acrosstake_or_need,reclaim,add,texture_room(),memory(),CreateHeap, andbook::block.LEONIDA_TEXTURE_BLOCK_MBind3d12/docs/switches.md.Fix D3D12 aliasing-barrier spec violation on committed fallback textures (
d3d12/crates/leonida-gpu/src/{resource,host,texture}.rs)a host state prelude did not record (0x80070057)(E_INVALIDARG) atlist.Close()when textures larger than the block size fall back toCreateCommittedResource: bothhost.rsandtexture.rspreviously emittedD3D12_RESOURCE_BARRIER_TYPE_ALIASINGwhenevercrate::pool::on()was true, even for committed resources, which D3D12 rejects.HostTexture(pooled: bool) and exposeHostTexture::may_alias()(self.pooled || self.tiled.is_some()), covering placed pool textures and reserved tiled textures while excluding committed resources.D3D12_RESOURCE_BARRIER_TYPE_ALIASINGemission sites (host.rsHostList::preludeandtexture.rsrecord_upload) withcopy.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), comparingLEONIDA_TEXTURE_BLOCK_MB=8(default) vsLEONIDA_TEXTURE_BLOCK_MB=64(previous behavior):8 MiB(default)64 MiB(previous)UNRIPE0/0/00/0/025.5/18.7/27.9fps (36world samples)25.5/16.4/26.6fps (38world samples)0.0fps median (+2.3fps p10)3000-4999draws/frame median25.3fps25.6fps-0.3fpspool.rs:931)3568 MB(446blocks)4736 MB(74blocks)-1168 MBpool.rs:963)3464 MB(58340alive)3948 MB(68019alive)blocks - live)104 MB(3.0%, incl.96 MBahead)788 MB(20.0%, incl.768 MBahead)-684 MB(-17.0 pp)> 8 MiBfillable textures)6of58346(60 MB,0.01%by count)0of680190errors11176 MB)6280 MB7587 MB-1307 MB454in560 ms(longest52.7 ms)89in442 ms(longest67.2 ms)+118 mstotal,-14.5 mspeak1034(2 mstotal,0.1 msmax)1017(1 mstotal,0.2 msmax)+1 msover 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— PASSpython -m unittest discover -s tests -p test_d3d12_switches.py—22/22PASSpython -I scripts/check_no_game_data.py— PASScargo test -p leonida-gpu --lib --locked pool:: -- --test-threads=1—23/23PASS (includestexture_block_size_defaults_to_8_mib_and_clampsandsmaller_texture_blocks_reclaim_independently_and_enforce_their_own_limit)cargo test -p leonida-gpu --lib --locked --features diagnostics pool:: -- --test-threads=1—23/23PASScargo test -p leonida-gpu --lib --locked committed_fallback_texture_does_not_claim_aliasing_barrier—1/1PASS (verified red → green against real D3D12list.Close(): unguarded aliasing barrier on a committed fallback texture returnsHRESULT(0x80070057), guarded path closes cleanly)cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings—0warningsAPPROVE).AI-assisted: yes
Independent local verification of this change (I changed no code).
2b69e8fc, merge base30c6830. All three new tests are absent on the base:git grep -F <test> 30c6830 -- <path>-> exit 1 for each.-- --exactand a privateCARGO_TARGET_DIR:pool::tests::texture_block_size_defaults_to_8_mib_and_clamps,pool::tests::smaller_texture_blocks_reclaim_independently_and_enforce_their_own_limitandresource::tests::committed_fallback_texture_does_not_claim_aliasing_barrier-> 1 passed / 817 filtered each.--libsuite on the head: 757 passed, 1 failed, 60 ignored. The single failure isdescriptor::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 base30c6830. 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.pyon 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.
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), withscripts/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.abba)pool.rs:963)0x80070057at a preludeabba: +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:
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.
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), onediagbinary (diagnostics,dlss,mimalloc,exe_sha16 = 419b627dd6dad62f), Series S, hardware DXR off, DLSS / FrameGen / Smooth Motion off, fullscreen,-PrecompileUsed,LEONIDA_PIPELINE_WORKERS=4,gate_drivermode=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.world+60s)a164 MiBPASSb18 MiBPASSb28 MiBPASSa264 MiBPASSObserved
PASS, clean exit (0x00000000), 0 gate warnings (the gate's own warning counter), 0 missed pipeline waits, 0 unripe cuts, 0leonida_gpu::poolwarnings.GATE CONTROLwas 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.8 MiBblocks 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).64 MiBblocks and 2,360 MiB for8 MiBblocks, a 680 MiB difference. The 3070 figure of ~172 MiB is also a texture-block allocation delta.8 MiBmade ~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 the8 MiBruns.preprose monotonically across the four consecutive runs (36.0 → 41.6 → 44.1 → 49.6 ms), whiletexstayed 0.8–1.3 ms andgpuwait stayed 0.0 ms. The ABBA pair means were 55.09 ms for A and 52.04 ms for B.d3d12_ab_compare.pyreported insufficient runs for a frame-time conclusion.Reserve hypothesis
Under 85% budget (
SPARES = 64),LEONIDA_RIPE_BLOCKS = 12targets12 × 64 = 768 MiBvs12 × 8 = 96 MiBof empty ahead blocks, a calculated 672 MiB difference. At budget (SPARES = 2), the clamp gives128vs16 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 MiBblocks. 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.
Test report from another machine (I changed no code). Not a review of the code.
2b69e8fcbmerged ontomain93b9d90a2: clean merge.cargo test -p leonida-gpu --lib --locked -- --test-threads=1, 4 runs: 3 passed (793 passed, 0 failed), 1 failed.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.pool::small::tests::small_buffers_are_placed_in_blocks_and_used_again_on_the_cardfailed (small.rs:562,unwraponNone); 792 passed. I could not reproduce it in the 3 runs after.main93b9d90a2passed the same command 4 of 4 times (790 passed), 3 of them under the same cap.mainon 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.--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).