D3D12-DYNAMIC-SLOTS-POOL-EXHAUSTION: default capped heaps to half the view heap #3016
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/3016:github-pr/3016" git switch "github-pr/3016"
Open
leonida/mandy
bobcatchris wants to merge 1 commit from
github-pr/3016 into main
pull from: github-pr/3016
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/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
1 participant
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!3016
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/3016"
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.Claimed in the coordination issue as: D3D12-DYNAMIC-SLOTS-POOL-EXHAUSTION### What and whyOn a host whose shader-visible view heap is capped at
PORTABLE_VIEWS(NVIDIA, 1,000,000 views),descriptor/host.rs::dynamic_slotsdefaulted to2^18(262,144) dynamic descriptor slots. In a dense scene (9,100 draws, Series S, RTX 3060 Ti) that pool ran out: 18.87 tables a frame found no pool and waited 20.9 ms, 17.67 went without ΓÇö 17 fps. With 524,288 requested (clamped to 499,999, half the heap) no table was refused for five minutes in the same scene.play-nvidia.ps1andplay-linux.shalready set 524,288, so direct runs and other entry points still got the exhausted default.The capped path now defaults to half the heap, still bounded by an explicitLEONIDA_DYNAMIC_SLOTSoverride. The slot calculation is a pure helper, which also removes the oldclamp(DYNAMIC, null / 2)panic whennull / 2 < DYNAMICand stops caching a heap-specific count in aOnceLock. The uncapped path is unchanged; no draws, shaders, effects or quality settings are removed.### Tested-cargo test -p leonida-gpu --locked dynamic_slotsΓÇö 6 related tests pass; plusa_small_capped_heap_does_not_panic.-python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdandpython -I tests/test_d3d12_switches.pyΓÇö 20 tests pass.- Red/green: with the same assertions applied to the old source via a test-only shim,capped_default_takes_half_the_heapfailed (left: 262144, right: 499999) and the small-heap case panicked withmin > max; both pass with this change.-python -I scripts/check_no_game_data.pyon both changed files ΓÇö clean.- Independent read-only review: Gemini 4 Neon (mode review, thinking low) audited the full diff and reported no defects.GPUs tested: n/a for the unit tests; the in-game measurement quoted above was supplied by Raisedpedro on an RTX 3060 Ti (Series S) and is the evidence for the default change, not a measurement made in this pull request.AI-assisted: yes ΓÇö Gemini 4 Neon (direction and independent review).### Checklist- [x] Based on currentmainand merges cleanly (a conflicting pull request is labeledneeds rebase).- [x] One topic; follow-up work goes in a new pull request.- [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.- [x] A new translator rule is in the contract table ofdocs/design.md, with how it was confirmed. ΓÇö n/a: no translator rule changed.Verified the default change and its scope at 4981d6d17 on Windows. Both default and Series X play-nvidia.ps1 -DryRun already emit LEONIDA_DYNAMIC_SLOTS=524288. Supplying 300000 through -More emitted 300000.
I also compiled the production sizing functions from the parent and PR with logging stubbed out, then ran a fresh process per value to avoid reusing the cached environment. With null slot 999999 on a million-view heap:
This confirms the increase for callers leaving the setting unset. On this heap the stock NVIDIA launcher already gets the larger pool. The checks cover configuration and sizing only, with no frame-rate or dropped-draw measurement.
Codex-assisted.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Ran natively on Windows 11, head
77b7bee55merged into currentmain(128648cfe, clean merge). The earlier comment compiled the sizing functions on their own. This run builds realHostHeaps on a host whose view heap is capped (NVIDIA, null slot 999,999) and fills the dynamic pool until it refuses, using a throwaway test (not committed).cargo test -p leonida-gpu --lib --locked: 695 passed, 0 failed, including the 4 new tests and the existingdynamic_slots_*tests. clippy reports one lint (host.rs:7633), andmainreports the same one.tools/d3d12_switches.py --check d3d12/docs/switches.mdexits 0.Real heaps, filled until refused (title heap of 737,855 slots; one process per setting):
LEONIDA_DYNAMIC_SLOTSmain: in place / dynamicabc(unparsable)0100000300000524288(NVIDIA launcher)999999In every case the pool gave out exactly
dynamicslots. For the 737,855-slot heap the last one was 999,998, one below the null slot, so nothing overlaps it. The nextdynamic(1)was refused. With the default, title heaps of 300,000 and 1,100,000 slots behaved the same way: dynamic slots start at the in-place count and end at 999,998 or earlier. On WARP the heap is uncapped (null slot 2,097,151), andmainand the PR gave the same results there: 1,048,576 dynamic slots for title heaps of 300,000 and 737,855, and 997,151 for 1,100,000.Edge sizes. Reading the code,
nullcomes only fromprobe_view_limit(999,999 or 2,097,151).null == 0only happens when there is no host, and thenHostHeap::newreturns before sizing. So the small-heap results (0for null 0,50,000for null 100,000) and the removed panic are defensive. A production host can't reach them. Values of 262,144 or less, including0, still get raised to 262,144 (measured above), so settingLEONIDA_DYNAMIC_SLOTS=262144gives back the old default.One question (from reading the code, not measured). In the capped branch the extra dynamic slots come out of the title's in-place slots. As far as I can tell,
heap_handle_atclamps a shader's view index only to the null slot. If that's right, then on a capped host a shader-computed title index between the in-place count and 999,998 reads whatever dynamic table is currently in that slot. Withmain's default, that range starts at 737,855. With this PR it starts at 500,000. The comment onDYNAMICsays the title's highest slot seen is about 720,000, which falls in the newly exposed range. Anyone using the stock NVIDIA launcher (524,288) already runs this way, so it isn't new for them. But it could be worth confirming that no shader-indexed title slot above 500,000 is in use, or noting the trade-off in the doc comment. TheDYNAMICcomment ("2^18 leaves 737,000") also no longer describes the capped default.Not checked: frame rate, refused tables or rendering in game, and whether title slots between 500,000 and 720,000 are actually read by computed index.
GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Code review only, not built (Windows-only
leonida-gpu). The code is ready, but the in-game gate is still open.77b7bee55, merge base2705632c5, 309 behind currentmain45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.HostHeaps and filled them until refused. Unset now gives 500,000 in place and 499,999 dynamic, against 737,855 and 262,144 onmain. The 4 new tests pass andd3d12_switches.py --checkexits 0.Review of
d3d12/crates/leonida-gpu/src/descriptor/host.rs:dynamic_slots_foris a pure function and tested at the edges:null = 0:clamp(0, 0), no panic, because the lower bound isDYNAMIC.min(max).OnceLock(CAPPED) fixes a real wart: the old code cached the first heap'snull / 2for every later heap.524288, clamped to 499,999). This changes default behaviour on every capped-heap host that is not launched with that switch: about 238k title slots that were kept in place now take the "made afresh" path. The PR body measures the refusal win (18.87 refused tables a frame to 0). What is not measured is the extra per-frame copy cost of the slots no longer in place. The in-game gate should include a fps comparison againstmainon a capped NVIDIA card.DYNAMIC. That is fine, but it is no longer a sign that the user set an override.Verdict: ready on code. Do not merge until the requested in-game run (300 s, device losses, median fps against
main) is posted.AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@MoonEyes @Kal0s-design @andrew-ai Thank you for the reviews and capped-heap / allocation verification on
77b7bee55.77b7bee55is left untouched (CI 6/6 green,d3d12_switches.py --checkexit 0).77b7bee55awaits a third-party NVIDIA capped-heap in-game gate run (defaultLEONIDA_DYNAMIC_SLOTS, >= 300 s).AI-assisted: Gemini 4 Neon
RUN (standalone RTX 3090 300 s stress gate + Windows red/green unit tests) — PASS covering exact head
77b7bee55f2de53ebecb609044234329bd8a4108.80910637f(diagnostics,dlss,mimalloc,exe_sha16 = 710b646bcfb6f327; changed-file clean-room scan exit0).80910637f): compile-time exit101(base lacksdynamic_slots_for).8passed default /8passed with--features diagnostics.610.88, Series X profile,2560x1440,-NoFrameGen,LEONIDA_DYNAMIC_SLOTS=(explicitly unset so the launcher's524288override does not mask the capped default under test!),scripts/game-gate.ps1(301.5 sin world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (GATE CONTROL moved=2.43 m,max_from_ctrl=5,060.2 m).#3016(LEONIDA_DYNAMIC_SLOTS=,710b646bcfb6f327)mainb41763227baseline (cf499737bf684f6a)clean,0reasons,0warnings)clean,0reasons,0warnings)301.5 s305.6 s0/0/00/0/018.97 FPS/73.46 ms19.13 FPS/74.01 ms7,409/2.456 s7,983/2.358 s36,638 MB/15,542 MB37,803 MB/16,220 MBVerdict: PASS for the 300 s standalone in-game gate on
77b7bee55withLEONIDA_DYNAMIC_SLOTS=exercising the new capped default.(AI-assisted verification:
gemini-4-neon+gpt-6.2-astra.)VERIFY-3016 — Windows nativo:
red then greenen la regla nueva, y el caso que la motiva está medido en el propio comentario(this PR)2705632c5(behindmainb41763227)main—merge-treeclean,git merge --no-ffclean (auto-mergedhost.rsanddocs/switches.md)Ran
The one failure is this machine's, unchanged all day (
views_are_made_beside_the_heap_and_copied_in, the integrated GPU artefact ofD3D12CreateDevice(None, ..)that #2995 addresses).Negative control (synthetic): I changed
let max = null / 2;tolet max = null;— the cap this PR is about — and rebuilt:Two of the four new tests bite on exactly that line.
The change, and why it is plausible: on a host whose view heap is capped (
null < PORTABLE_VIEWS, the 1,000,000-view heaps of an RTX 3060 Ti or a Series S) the dynamic pool now defaults to half the heap, clamped to it, instead ofDYNAMIC << 2. The doc comment keeps the measurement that motivates it: at 2^18, "refused 18.87 tables of 9,100 draws a frame and let 17.67 go without (17 fps); twice as many (clamped to half the heap) refused none for five minutes in the same scene" — a refusal count with an fps figure and a five-minute control, which is the kind of number I would ask for.What I could not test
PORTABLE_VIEWS, so the capped branch is exercised only by the syntheticdynamic_slots_for(count, null, asked)calls, not by a device.Written with an AI assistant.