d3d12: host lists record into pooled command allocators (D3D12-COMMAND-ALLOCATOR-RING) #3031
Open
Krashgamer wants to merge 5 commits from
upstream-pr/3031 into main
pull from: upstream-pr/3031
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
ProjectLeonida/mandy!3031
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3031"
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?
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-02T02:43:30Z.
Claimed in the coordination issue as: D3D12-COMMAND-ALLOCATOR-RING (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7330840193)
What and why
Every host list and every list prelude had a command allocator of its own: some 2,500 in the world (1,474 host lists alive, plus their preludes). On NVIDIA an allocator keeps the memory of its largest recording through
Reset, and what an allocator lets go stays in the driver's pool (Windows does not get it back). So the process held the sum of every allocator's peak. That is also whyLEONIDA_ALLOCATOR_TRIM=1measured nothing (findings.md): a replaced allocator's memory went back to the driver, and the new one grew again.Device test on an RTX 3080 (no game):
CopyBufferRegion, each on its own allocatorResetof every allocatorThe allocators hold the memory.
This change:
CreateCommandList1).host/recorders.rs) and has it to itself. When the recording is over (its list was reset after its run, or let go behind the submissions running,host::retire), the allocator is reset outside the pool's lock and goes back to the pool.-RayTracingthat hung the card (DXGI_ERROR_DEVICE_HUNG) in 5 of 15 runs, against 0 of 10 with an allocator per list. Of those 10, two ran this branch withLEONIDA_ALLOCATOR_RING=0, and eight ran a build of another branch on main whose own switch was unset. With one recording per allocator: 0 of 12 (see Tested). The cause inside the driver was not found; the pool keeps to the simplest contract instead.LEONIDA_ALLOCATOR_RING=0gives each list and each prelude an allocator of its own again ("home" slots), as before.LEONIDA_ALLOCATOR_TRIMkeeps only its idle-list part; the allocator replacement is gone (it did nothing).Tested
Game gate, Series X, 300 s in the world, the same save, RTX 3080 10 GB, 32 GB RAM. Main
5b1fff821against this change on it, alternating, two runs each. This change was measured at9903ba336, the commit before the last review fixes listed below; those touch only list retirement, where a released allocator is let go, comments and tests. Columns (private= private bytes at most):-HardwareRT(one complete run each)* With
-HardwareRTboth main and this change stay over the card's memory budget for about 190 of the 300 s; the gate's over-budget stop was turned off for these runs (a first round with it on stopped main and this change alike at ~175 s).-RayTracing(the title's own structure builder, where the first version hung): 4 gate runs of this head, all PASS, 0 device lost (fps 11.6-15.1, private 30.8-31.4 GB); with 8 runs of an equivalent earlier build, 0 of 12 hung.Measured by others: OtavMacedo, RTX 3070 8 GB, 16 GB RAM, Series X, 4 pairs of two builds (
4e59d46e8on the same base against the base alone, 12 gate runs, all PASS): private bytes at most -752 MB (-3.0 %, 95 % interval -1,232 to -271), least left to commit +718 MB, frame time no clear difference. They saw longer gaps between frames in the last two runs with the change (up to 4.6 s), not read as caused by it; worth watching near arrival (https://github.com/ProjectLeonida/mandy/pull/3031#issuecomment-7378647676).Other results:
-RayTracing, 4 pairs), so not part of this change.Without the game:
cargo test -p leonida-gpu --features diagnostics --libon WARP with the debug layer (LEONIDA_D3D12_WARP=1 LEONIDA_D3D12_DEBUG=1): 789 passed.check_no_game_data.py: passed.d3d12_switches.py --check: passed.Red/green for
host::batch_scratch_tests::lists_recorded_in_turn_share_allocators. The test records, runs and retires 200 lists in turn, then counts the allocators they took:LEONIDA_ALLOCATOR_RING=0, with the test's switch guard taken out: "200 lists recorded in turn took 200 allocators", and the test fails.lists_record_in_pooled_allocators_and_runchecks that recordings alive at once have allocators of their own. The recorder module has unit tests for the bookkeeping:The change was reviewed by independent reviewer agents before this pull request and before this update. Findings fixed in the update:
HostList::retirecloses a list still recording before its allocator can reset (it only asserted in debug builds).GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.1088 (610.88), Windows 11 Pro 26200; Intel i7-10700K, 32 GB RAM
AI-assisted: yes, Claude Code (Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T06:15:37Z.
Windows 11, MSVC toolchain 1.98.1. Head
1ac80bcd3merged into currentmain0ae5a2664: the merge is clean. Unit tests only, no game.cargo test -p leonida-gpu --features diagnostics --lib:mainLEONIDA_D3D12_WARP=1)LEONIDA_ALLOCATOR_RING=0descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync; two reruns were clean, so I'd call it flaky)LEONIDA_D3D12_DEBUG=1LEONIDA_D3D12_DEBUG=1LEONIDA_ALLOCATOR_RING=0--test-threads=1indirect::andhost::card_stepsSo with the debug layer on, the failures need the ring on and the whole lib running in parallel. They came back on every parallel run I made: two on WARP and one on hardware. The tests that fail on WARP:
host::card_steps::tests::the_card_copies_what_is_recordedhost::card_steps::tests::the_card_gathers_what_is_recordedindirect::tests::a_record_written_behind_a_batchs_pass_is_clamped_behind_its_writerindirect::tests::host_list_batchesindirect::tests::host_list_budget_starts_empty_at_each_submissionindirect::tests::host_list_reuses_and_grows_scratch_across_submissionsindirect::tests::host_list_window_executions_need_no_barrier_of_their_ownEach fails on "the debug layer found an error". All of them report the same two messages, which name the same two buffers and the same two command lists:
My guess is that one recording picks up a state another test's list left behind. The tests that fail would then just be the ones that read the device's debug messages. I didn't find which recording that is. One thing I noticed while reading
host/recorders.rs:RINGis one process-wide ring, andRing::takelends the next open or empty slot without looking at which device made its allocator. A test process creates more than one device. That may have nothing to do with it, but it's where I'd look first.The description's debug-layer check ran the game for 120 s, not this unit suite, so this may be new to you. It doesn't show up without the debug layer.
Not checked: the game, and anything outside
leonida-gpu --lib.GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-02T06:35:49Z.
@Kal0s-design thank you, that was a real one, and the cause was my new test, not the ring.
host::batch_scratch_tests::lists_recorded_in_turn_share_allocatorscopieda -> bandb -> ain turn inside one list, with no barrier. The first read promotesatoCOPY_SOURCEfor the rest of the list, so the copy back into it is invalid. That gives exactly the two messages you quoted, with two buffers and two lists. The debug layer puts them in the device's message queue, and every test that checkshost.log_messages()on that device picked them up. That's why the failures needed the whole lib in parallel, and why they went away withLEONIDA_ALLOCATOR_RING=0: the test returns early when the switch is off. I bisected it with your filters:indirect:: host::batchreproduced it, andindirect::withhost::minusbatch_scratch_testsdidn't.Fixed in
1d6777868: the copies now go one way. The test checks the allocator count, which doesn't depend on direction, and it still holds (≤ 50 of 200).LEONIDA_D3D12_DEBUG=1, wholeleonida-gpu --features diagnostics --libin parallel: 745 passed, twice. Before the fix, the same command failed 4–7.On the devices: every allocator in the ring comes from
host().device(the four call sites arebegin/home_slot, called with the host's device), and lists are only ever made there. The tests that create their own device (trainer,WarpHarness) use their own allocators and never touch the ring. With a single host device per process, a device check intakewould never fire, so I left it out.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T06:59:20Z.
RUN
Independent verification of
#3031(1ac80bcd3) merged cleanly ontomain(f37c4a87d) on Windows 10 Pro 22H2 (build 19045), AMD Ryzen 9 5950X, 64 GiB RAM, NVIDIA GeForce RTX 5070 12 GB (driver621.40), MSVC toolchain (1.98.1).In-game Series X comparison (
LEONIDA_MEMORY_MAP=1,-NoFrameGen, same binary1ac80bcd3+f37c4a87d, same save, 90 s in world each)LEONIDA_ALLOCATOR_RING=0LEONIDA_ALLOCATOR_RING=1(PR default)copystat)residency)15,678 MBphys free)18,066 MBphys free)1024 MBprivate regions (last map)32 MBwrite-combined regions (last map)Allocator census at end of
RING=1run:180 shared, 4 another list may record in, 18 empty, 162 with recordings not over (begun over 1 s ago 67, 10 s 64, 60 s 62); since the start 180 made, 37711 resets, 547674 recordings begun in an allocator another list had closed in.Unit tests & D3D12 debug layer (
cargo test -p leonida-gpu --features diagnostics --locked --lib -- --skip depth_bounds_pipeline_loads_and_filters_draws)check_no_game_data.py&d3d12_switches.py --check: PASS.RING=1): 754 passed, 0 failed (host::recorders::tests::*5/5 andlists_recorded_in_turn_share_allocators1/1 PASS).LEONIDA_D3D12_DEBUG=1+--test-threads=1(RING=1): 754 passed, 0 failed (0 debug-layer errors).LEONIDA_D3D12_DEBUG=1parallel (RING=0): 753 passed, 1 failed (only the known pre-existing parallel racedescriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync; 0 debug-layer errors).LEONIDA_D3D12_DEBUG=1parallel (RING=1): 749 passed, 5 failed -- reproduces@Kal0s-design's exact finding (ID3D12CommandList::CopyBufferRegion: Resource state (0x800: D3D12_RESOURCE_STATE_COPY_SOURCE) (assumed at first use) ... Missing State: 0x400: D3D12_RESOURCE_STATE_COPY_DEST) across the 5indirect::tests::*tests.Code note supporting
@Kal0s-design's observation:static RING: Mutex<Ring>ind3d12/crates/leonida-gpu/src/host/recorders.rs:94does not tagSlotwith the owningID3D12Devicepointer (Ring::takeat:146-158andRecording::beginat:237-249hand out any open/empty slot regardless of device). Scoping ring slots by device identity (or owning the ring perHost) would isolate multi-device test processes cleanly.Verdict: In-game memory reduction is strongly confirmed on a second NVIDIA architecture (RTX 5070 /
621.40: -3,459 MB peak private bytes, 0 errors), while@Kal0s-design's parallelLEONIDA_D3D12_DEBUG=1test failure reproduces deterministically.AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T07:12:28Z.
Thanks, and sorry for pointing at the devices. The cause was the test, as you found. I checked
1d6777868the same way, on top of currentmain229d352ee. Onlyd3d12/docs/switches.mdconflicts in that merge, so the Rust side is what's tested here:LEONIDA_D3D12_DEBUG=1, wholeleonida-gpu --features diagnostics --libin parallel: 778 passed, 0 failed, twice. At1ac80bcd3the same command failed 7.The
switches.mdconflict with the newmainwill need a rebase, though GitHub already shows it as conflicting.GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-02T07:28:00Z.
Rebased onto
main229d352ee. The only conflict wasd3d12/docs/switches.md, regenerated withtools/d3d12_switches.py; the code is unchanged. Head is nowa47b86855. WARP +LEONIDA_D3D12_DEBUG=1, wholeleonida-gpu --features diagnostics --libin parallel: 778 passed.Thanks @lixonik for the in-game run on the RTX 5070 / 64 GB, and @Kal0s-design for re-checking the fix.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-02T11:24:53Z.
Please don't merge yet: with ray tracing on (
-RayTracing), this PR's default makes device removals likely. Investigating; I'll post the cause and a fix here.All earlier verification, mine and yours, ran without real ray tracing: the launcher's default has every ray miss (
LEONIDA_BVH_MISS=1). With-RayTracing, Series X, RTX 3080 10 GB, 300 s in the world per run, on this head (a47b86855) or main:LEONIDA_ALLOCATOR_RING=0Without ray tracing nothing changes from the numbers above in this thread: 0 removals in all runs.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:38:43Z.
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).
Imported from ubiquitarianism/leonida. Originally posted by tillo88 on 2026-12-02T15:49:24Z.
In-game numbers for this PR (head
a47b86855) merged ontomainat229d352, on a replay bench with no frame cap, against 12 runs of plainmainat the same commit. All 4 PR runs (two jobs, about four hours apart, with base runs between them) were faster than every base run:main229d352Setup: Ryzen 7 9800X3D, RTX 5070 Ti 16 GB (driver 621.40), 32 GB RAM, Windows 11; mandy built with
build-nvidia.ps1(diag profile), started withplay-d3d12.ps1 -NoFrameGen(Series X profile, dynamic resolution and upscaler, ray tracing off),LEONIDA_FPS_CAP=0. Route: the same start-of-game save each run, prison cutscene, plane cutscene and first boat section (~6.5 min), driven by recorded controller input. Means are over the 5 s windows with the route running; one warm-up run per job is not counted.Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-02T15:54:38Z.
Thanks @tillo88, that matches what we see with ray tracing off (no device losses, a little faster).
With ray tracing on (
-RayTracing), lists that share one allocator lead to GPU hangs (see the warning above). A switch-only test points at the sharing itself: with one recording per allocator, 0 of 4 runs hung, against 1 of 4 with sharing. So the next version keeps the pool of allocators but gives each recording one to itself, and releases prelude recordings once their submission ran. It is being measured now; I will post its numbers here (both ray-tracing modes and none).AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T17:07:42Z.
RUN (in game, gate-style, as asked by MoonEyes): head
a47b86855tested in a batch with #2643 (2cea6871c), #3031 (a47b86855), #2789 (4bd128a8c) and #2661 (1b3f3dee0), all merged withgit merge --no-ffontomain23a51c494(no conflict; the only file the four share isd3d12/docs/switches.md). Built withdiagnostics,mimalloc, targetx86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).Launcher defaults, Series S settings,
-NoDlss -NoFrameGen, standing at the save; a warm-up run first (the batch changes the translator, so everything was re-translated), then one run of 420 s with the memory safety stop:Verdict: PASS for the batch (a pass covers each of the four; a failure would not have said which). Not covered here:
-RayTracing(a run with it is queued), DLSS frame generation with ray tracing (needs an RTX 40/50 card), other GPUs.AI-assisted: Claude Code (Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:02:26Z.
Not built (Windows-only
leonida-gpu). Not ready: the author has asked for it not to be merged.a47b86855, merge base229d352ee, 188 behind currentmain45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.-RayTracing.1d6777868.Blocking finding, from the author (Krashgamer, 11:24 and 15:54): with
-RayTracing, the defaultLEONIDA_ALLOCATOR_RING=1caused 3 of 6 device removals, against 0 of 6 onmainand 0 of 2 with the ring off. They were hangs with 21 unfinished submissions, 100 to 220 s into the world. A switch-only experiment points at several recordings sharing one allocator. The author is preparing a new version with one allocator per recording. None of the posted in-game passes covers ray tracing, so none of them clears this.Review notes (
host/recorders.rs,list.rs):Verdict: defects (device removals with ray tracing, confirmed by the author). Wait for the new head and re-run the gate with
-RayTracing.AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-02T19:32:42Z.
@MoonEyes the new head is up:
8df1bfce7(one recording per pooled allocator), rebased onmain5b1fff821, which merges cleanly into today'smain. Gate runs of this head:8df1bfce7onmain5b1fff821, builtdiagnostics,mimalloc(build-nvidia.ps1).-RayTracing(where the first version hung)All four PASS. With the 8 runs of the earlier equivalent build, 0 of 12 hung, against 5 of 15 with the shared version. (
mainwith-RayTracingon this PC: 11.5-14.8 fps, 32.6 GB private.)Against
main5b1fff821, alternating, all PASS, no device loss:-HardwareRT(one complete run each): private / fpsThe description is updated with the design change, these numbers and the review fixes.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by icdmkg2 on 2026-12-02T20:22:12Z.
Third-party Windows verification of #3031 (
D3D12-COMMAND-ALLOCATOR-RING) on head8df1bfce78df1bfce714bdfd21f9a8ddcc3231d7dfa2357c0merged cleanly (git merge --no-ff) ontoorigin/mainb41763227.621.24(32.0.16.2124), AMD Ryzen 7 H 260 w/ Radeon 780M, 32 GB RAM, Windows 1110.0.26300.9974,rustc 1.98.1.Results (MEASURED)
python -I scripts/check_no_game_data.py(all 5 touched files)0python -I tools/d3d12_switches.py --check d3d12/docs/switches.md0python -I tests/test_d3d12_switches.py20/20OKpython -I scripts/red_green.py 3031 --mutate767passed,0failed inleonida-gpu; red:red does not build(cannot find module or crate recorders, expected for newhost/recorders.rs)LEONIDA_ADAPTER=5060cargo test -p leonida-gpu --features diagnostics --locked --lib -- recorders:: lists_record --nocapture6 passed, 0 failed(200 lists recorded in turn: private bytes grew 71 MB)LEONIDA_ADAPTER=5060+LEONIDA_D3D12_DEBUG=1(same filter,--features diagnostics)6 passed, 0 failed(200 lists recorded in turn: private bytes grew 71 MB)LEONIDA_ADAPTER=5060+LEONIDA_ALLOCATOR_RING=0cargo test -p leonida-gpu --features diagnostics --locked --lib -- host::tests:: --skip depth_bounds_pipeline_loads_and_filters_draws68 passed, 0 failed, 1 ignored(fallback home-slot path)LEONIDA_D3D12_WARP=1+LEONIDA_D3D12_DEBUG=1(samerecorders:: lists_recordfilter,--features diagnostics)6 passed, 0 failed(200 lists recorded in turn: private bytes grew 6 MB)LEONIDA_ADAPTER=5060cargo test -p leonida-gpu --features diagnostics --test replay --locked1 passed, 0 failedCode review notes (READ IN CODE)
host/recorders.rs: one recording per pooled allocator (!slot.usedassertion inbegin_in),ID3D12CommandAllocator::Resetand forgotten allocator drops execute outside theRINGmutex whileslot.resettingguards the slot.host.rsDrop for HostList: closes any still-open recording before retiringrecordingsbehind in-flight submissions and forgetting home slots.AI-assisted: Gemini 4 Neon (High) via Antigravity (test execution, diff review, and write-up).
Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T21:02:32Z.
RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch) — PASS covering exact head
8df1bfce714bdfd21f9a8ddcc3231d7dfa2357c0.git merge --no-ffontomainb41763227(diagnostics,dlss,mimalloc,exe_sha16 = c47eeb717f761d9d; changed-file clean-room scan exit0; standalone buildexe_sha16 = 7b41ce21b88a6c45also compiled and passed targeted checks cleanly). Allocator pooling was active by default (LEONIDA_ALLOCATOR_RINGon).14PRs):#3200d1a91afd1,#319880a627bb1,#319193b47ac9d,#3189c182fc392,#3176ae0075d9a,#3168337388052,#31641065952da,#3146ebc0253ff,#312464600ef0c,#3069311d33a40,#30318df1bfce7,#3029e49404808,#3054ff53fd8b9,#3010d645712a3.610.88, Series X profile,2560x1440,-NoFrameGen,scripts/game-gate.ps1(301.3 sin world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (GATE CONTROL moved=2.51 m,max_from_ctrl=5,053.9 m).c47eeb717f761d9d)mainb41763227baseline (cf499737bf684f6a)clean,0reasons,0warnings)clean,0reasons,0warnings)301.3 s(4,504frames)305.6 s0/0/00/0/020.10 FPS/69.76 ms19.13 FPS/74.01 ms8,048/5.222 s7,983/2.358 sVerdict: PASS for the 300 s in-game stability gate on
8df1bfce7. (Single combined-batch stability check, not an isolatedLEONIDA_ALLOCATOR_RING=1vs0FPS gain measurement.)(AI-assisted verification:
gemini-4-neon+gpt-6.2-astra.)Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:23:15Z.
VERIFY-3031 — Windows nativo: las cuatro pruebas de las grabaciones pasan, y el control muerde
(this PR)5b1fff821(behindmainb41763227)main—merge-treeclean,git merge --no-ffclean (auto-mergedfindings.mdandswitches.md)Ran
Negative control (synthetic): I put a resetting slot back into the free list (
self.empty.push(at)right afterslot.resetting = true), rebuilt and ran:Two of the four bite, and the second one trips the
debug_assertinbegin_inrather than an assertion of the test — the invariant is defended twice, which is the right shape for state shared between the title's thread and the runtime's.What the change is, from the new module:
host/recorders.rsgives each recording a pooled command allocator of its own until it is over, takes a slot out of circulation while it resets, keeps a home slot with its owner, and refuses to hand a still-open recording's allocator to a reset. The 601 changed lines inhost.rsare the wiring I did not review line by line — I read the module and its tests, not that diff.What I could not test
host.rsrework: merged and compiled, not reviewed.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T03:43:38Z.
RUN (in game, batch of three pull requests), each head merged with
git merge --no-ffonto main516c9eaab, in one build: #30314e59d46e8, #3284f9c588760, #32868c56cb6b9. 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.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;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. #3031 was in an earlier batch on another head; this run covers its current head. #3284 changes what is written to the pipeline book; whether a later start reuses it was not checked. #3286's card selection only matters when the PC has more than one card to pick from, and its build-script change was not exercised: this run covers the default path on one dedicated card.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by OtavMacedo on 2026-12-03T12:39:38Z.
In-game two-build ABBA of this pull request on profile M: 8 GB card, 16 GB PC. One variable: head
4e59d46e8(its merge base is516c9eaab) on top of the same base, against the base alone. Numbers recomputed fromsummary.json/memory.csvby a separate agent.Paired, B−A (MEASURED, 4 pairs, all 4 the same sign for the memory rows):
Ranges over the 8 measured runs, A / B:
One thing to watch, not a finding:
AI-assisted: Claude Code (Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-03T12:55:01Z.
@OtavMacedo thank you, that is the size of PC and card I could not measure, and a cleaner comparison than mine. I have added it to the description. About the gaps near arrival: I will compare the longest gaps of my own runs with and without it and post them if they say anything, since both arms of yours have them.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T13:43:40Z.
I checked the pending-submission case on
149231a4merged ontob053a181. A synthetic test queued eight copy lists behind a private D3D12 fence viaHost::execute_late, then opened a ninth list while the fence was held. Its allocator differed from all eight pending allocators. After releasing the fence, all eight GPU readbacks matched.After the normal reaper returned the lists, the next batch used all eight original allocator slots with
LEONIDA_ALLOCATOR_RING=1. The per-list control (0) reused zero. All 12 runs passed (three per mode per adapter, AMD Raphael/RADV and RTX 4070 SUPER, Wine 11.22 / VKD3D-Proton 3.1.0). I usedLEONIDA_LATE_WAIT=3andLEONIDA_BURY_LAG=0. The test waits for the pool to return the slots after the fence because recycling runs asynchronously. The four existing recorder unit tests also passed.AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-12-03T13:55:27Z.
@merzleckeier thank you. That covers the case I worry about most (a list that is not over yet keeps its allocator to itself) on two more adapters, and the 0 against 8 reuse shows that the switch does what it says. Nothing to change on my side.
AI-assisted (Claude Code, Claude Opus 5.5).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.