d3d12: host lists record into pooled command allocators (D3D12-COMMAND-ALLOCATOR-RING) #3031
Closed
leonida/mandy
Krashgamer wants to merge 5 commits from
github-pr/3031 into main
pull from: github-pr/3031
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/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
6 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!3031
Loading…
Reference in a new issue
No description provided.
Delete branch "github-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?
Pull request closed
Please reopen this pull request to perform a merge.
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
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).
@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).
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).
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).
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).
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).
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).
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.
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).
RUN (in game, gate-style, as asked by MoonEyes): head a47b86855 tested in a batch with #2643 (2cea6871c), #3031 (a47b86855), #2789 (4bd128a8c) and #2661 (1b3f3dee0), all merged with
git 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)
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
@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).
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).
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.)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.
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).
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).
@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).
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).
@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).
TAKEN | Otavmacedo | ETA 2026-12-04 11:00 UTC | AI-assisted: Claude Code (Claude Opus 5.5)
Asked on #3434 (comment 25388): this PR on the save where the story scene gets stuck on an 8 GB card. NVIDIA RTX 3070 8 GB desktop, driver 621.47, Ryzen 7 5700X, 16 GB RAM, fixed 24 GB page file, Windows 11.
main863694e28+ this PR's head0edc09ac2(clean merge),diagnostics,dlss,mimalloc.-SeriesS -Resolution 540 -NoFrameGen -NoSmoothMotion,LEONIDA_FPS_CAP=30); gate runs from one save,mods/gate_driveridle, 600 s in the world (the transition of #3434 comes at about 6 minutes), memory stops widened.LEONIDA_ALLOCATOR_RING| A = 0 (one allocator per list, as before) | B = unset (the PR's default, pooled). A discarded warm-up, then A B B A B A (three a side: on this PC about 1 run in 3 of 600 s loses the device on any build, #2821).DONE | the A/B taken above | AI-assisted: Claude Code (Claude Opus 5.5)
Short: on this 16 GB / 8 GB PC the pooled allocators lowered the private peak by about 1 GB (22.1 against 23.1 GB, means of three) and left about 0.9 GB more to commit, at the same frame rate; all six runs kept the device; and the stuck story scene of #3434 happened in all six, with and without it. PROVISIONAL (n=3 per arm).
main863694e28+ this PR's head0edc09ac2(clean merge),diagnostics,dlss,mimalloc.exe_sha16the same in all seven; theirrun.commitreads4d9e4d05d, the checkout the gate ran from, not the build's): on this PC the device loss depends on the folder the executable runs from (#2821, comment 25546), and that folder is where it held.-SeriesS -Resolution 540 -NoFrameGen -NoSmoothMotion,LEONIDA_FPS_CAP=30; gate runs from one save,mods/gate_driveridle, 600 s in the world, memory stops widened. A discarded warm-up (B, 300 s), then A B B A B A.command allocators lists record into (LEONIDA_ALLOCATOR_RING): …(B1's last: 1239 pooled, 371 empty, 868 with a recording not over, of them 396 begun over 60 s ago; 1239 made since the start); in no A run.LEONIDA_ALLOCATOR_RING(fps from presents after 60 s in the world, as
summary.jsongives them. "Scene": #3434's signature, from the gate driver's positions: stuck = the player stays at the same point about 1,400 m from control to the end.)What the runs say, each tagged:
host/recorders.rs's module notes); here, on Series S at 540, it is about 1 GB.Not watched: the screen (the scene is classed by its signature).
GPUs tested: NVIDIA GeForce RTX 3070 8 GB, 621.47, Windows 11, profile M.
The figures were recomputed from the run records by a separate read-only agent before posting.
RUN: PASS on RTX 4070 Laptop 8 GB (driver 621.40, Windows 11), ABBA with
LEONIDA_HW_RT=1.f70caeea4, B = main + this PR (head0edc09ac2, merged with--no-ff).-NoDlss -NoFrameGen -PrecompileUsed,LEONIDA_WINDOWS_BAR_MB=0,LEONIDA_TEXTURE_BUDGET_MB=1024.TAKEN | quentinop | ETA 2026-12-04 15:30 UTC | AI-assisted: write-up with Claude Opus 5.5 (High)
Whether this PR changes the device loss at world entry on an RDNA 2 card with the default
LEONIDA_THIN=1(#3264). AMD Radeon RX 6800 XT 16 GB desktop, driver 32.0.21045.29003, Ryzen 5 9600X, 32 GB RAM, Windows 11. Profile M.0edc09ac2as is, built withd3d12/scripts/build-nvidia.ps1.docs/game_gate.md) with-SeriesS, 300 s in the world, from one save, played by hand on the same route in both runs (Jason's first mission, boat to plane).LEONIDA_THIN| A = unset (the default, 1) | B = 0. One run each, A then B.device_losta few seconds after the world first draws, as on main68427be7e; B PASS at about main's frame rate (19.9 fps mean there).DONE | the runs taken above
Short: on this RDNA 2 card the pooled allocators keep the device with the default
LEONIDA_THIN=1. With the PR's default, a 300 s gate run passed at 25.1 fps mean. The same executable withLEONIDA_ALLOCATOR_RING=0lost the device as soon as the world first drew, which is what main does on this card (#3264). PROVISIONAL (n=1 per arm).0edc09ac2as is (not merged onto current main),diagnostics,mimalloc. The same executable in all three runs (sameexe_sha16).-SeriesS, 300 s in the world,LEONIDA_RELAY=2,LEONIDA_THIN_THREADS=6. One save, played by hand on the same route each time (Jason's first mission, boat to plane). Shader cache already warm.THIN=1with the pool off). It is the control that separates this PR's switch from the rest of its head. Its prediction was written before it ran.LEONIDA_THINLEONIDA_ALLOCATOR_RINGdevice_lost, FAIL(fps from presents after 60 s in the world; mean = frames / (world time − 60 s).)
What the runs say:
THIN=1held 303 s and exited clean. With the pool off, the same executable lost the device (0x887A0007removed reason, exit0x887A0005, device-removed data: none) right after the world's first frames, before the gate counted the world as reached. That is the same end as the threeTHIN=1gate runs earlier today on main68427be7e, #3439 and #3443 (3 of 3, same build options).THIN=0with this PR, 21.2 fps mean, against 19.9 on main68427be7ethe same day. With one run each, I would not read a gain into it.THIN=1with the pool is the fastest setting I have had on this card, 25.1 fps mean against 21.2 withTHIN=0on the same build.d3d12/crates/leonida-gpu/src/host/recorders.rs:38): the pool is on unlessLEONIDA_ALLOCATOR_RING=0.Limits: one run per arm, played by hand rather than with the gate driver.
mandy-pr3031-rx6800xt.zip:summary.json,run.json,events.jsonl,memory.csvandleonida.logfor each run, user and PC names replaced.AI-assisted: log analysis and write-up with Claude Opus 5.5 (High).
Opened again as #3495: this pull request came over from GitHub under the name Ghost, and I can no longer push to it. #3495 has the same code (head
0edc09ac2), so the results here still apply to it; new results and reviews please on #3495. A maintainer can close this one. @Otavmacedo, @OreoFR and @quentinop, thank you for the runs since the move; they were on this same head.AI-assisted (Claude Code, Claude Opus 5.5).
Closing as a duplicate of #3495, which is the same change re-posted by the same author on this forge: same five files, 30 changed lines differ out of ~1,100 (rebase drift). Review and merge happen on #3495.
Closed by Moon's agent during PR triage, on Moon's written authorization.