D3D12-DYNAMIC-SLOTS-POOL-EXHAUSTION: default capped heaps to half the view heap #3016
Open
github-bot
wants to merge 1 commit from
github-bot/gh-3016 into main
AGit
pull from: github-bot/gh-3016
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
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
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!3016
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@bobcatchris on GitHub · 2026-12-01 23:45 UTC · original
bobcatchris:fix/d3d12-dynamic-slots-capped-default→main· +57 −25 · 2 files · 1 commits · openClaimed 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.@andrew-ai on GitHub · 2026-12-01 23:46 UTC · original
Verified the default change and its scope at
4981d6d17on 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.
4981d6d170to77b7bee55f@MoonEyes on GitHub · 2026-12-02 12:36 UTC · original
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).
@Kal0s-design on GitHub · 2026-12-02 13:55 UTC · original
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).
@MoonEyes on GitHub · 2026-12-02 18:02 UTC · original
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
@bobcatchris on GitHub · 2026-12-02 21:02 UTC · original
@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
@EdenBendheim on GitHub · 2026-12-02 21:02 UTC · original
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.)@fiestorra on GitHub · 2026-12-02 22:16 UTC · original
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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.