Repository navigation
Conversation
…commands named waits On an RX 6800 XT with LEONIDA_RELAY=2 the host device is lost (0x887A0007, nothing in the air) in the first heavy scene, at some 1,270 host lists alive. land() kept the lists of the last bury_lag() (64) flights, and each list's allocator keeps its command buffers (1 MB and 64 KB per list) in the driver's 2 GB aperture segment, which fills up and the kernel marks the device failed. The lists go back to the pool as soon as their flight has landed (list::recycle_landed). What their commands named (the Detached state and uploads, and HostList::take_held: deferred work, host textures, twins, refreshes still being found) goes through host::retire and waits the bury lag, as any other object let go. The reaper thread uses recycle_landed too; the send_late fallback and the synchronous path stay on recycle. After kyokyotosh/VIctory-6700XT f173347 (GPL-3.0), via PastiiJay/klbf-lab ProjectLeonida#127. AI-assisted. Not yet built or run on a GPU.
…t is nearly full The driver keeps its command buffers in a system-memory (aperture) segment that DXGI's budgets leave out (2 GB on RDNA2 cards in klbf-lab ProjectLeonida#127 and the 6700 XT's FINDINGS). When host lists are made faster than flights give them back, it runs full and the device is lost. host/segments.rs reads the segments with D3DKMTQueryStatistics, logs them once when the device is created, and tight() says whether an aperture segment is above LEONIDA_SEGMENT_TIGHT percent (85 by default, 0: never), looked at every 100 ms at most. send_late settles the flights then when no idle host list is left. After kyokyotosh/VIctory-6700XT 018d372 (GPL-3.0), via PastiiJay/klbf-lab ProjectLeonida#127. AI-assisted. Not yet built or run on a GPU.
…ost lists go Looking at the segment only when no host list was idle came too late: lists kept idle were already holding their command memory in the 2 GB aperture segment. Now tight is looked at on every send, and while it holds, list::trim_idle leaves 64 idle host lists and lets the rest go with their allocators. The threshold is 80 percent by default and has hysteresis: it stops being tight 10 points below (70 percent), because near the limit the video memory manager pages and the card waited a second a frame. The threshold decision is a pure function (is_tight) with unit tests, as is the trim's split. The trim is not counted in ALLOCATOR_TRIMS, which reports LEONIDA_ALLOCATOR_TRIM's own lets-go. After kyokyotosh/VIctory-6700XT e3c0703 (GPL-3.0), via PastiiJay/klbf-lab ProjectLeonida#127. AI-assisted. Not yet built or run on a GPU.
…as long as the list Every host list that ever needed texture transitions kept a prelude (a second allocator and command list) for its whole life, even while idle. On an RX 6700 XT that was 952 preludes for 1,476 host lists, near 1 GB of the 2 GB aperture segment whose filling loses the device (VIctory-6700XT FINDINGS-6700XT.md); klbf-lab ProjectLeonida#127 reports the same on an RX 6800 XT. HostList::prelude is now a Mutex<Option<ListPrelude>>: the list takes one from PRELUDES the first time it is submitted with transitions (take_prelude) and HostList::reset, which only runs once the submissions have finished, gives it back (give_prelude). At most 128 stay idle, and trim_preludes cuts them to 16 while the aperture segment is tight, next to trim_idle. The pool keeps each allocator's creation instant, so LEONIDA_ALLOCATOR_TRIM's refresh of preludes (allocator_refresh with which = 1) sees the real age. LEONIDA_LAZY_PRELUDE=0 still makes one with the list. The preludes-made counter now counts real creations, not first uses. After kyokyotosh/VIctory-6700XT 63a773e (GPL-3.0), via PastiiJay/klbf-lab ProjectLeonida#127. AI-assisted. Not yet built or run on a GPU.
…the d3d12 README The device loss on RDNA2 cards in the first heavy scene had no mention anywhere a user would look for a switch to turn the new behaviour off or tune it. AI-assisted.
… RX 6800 XT, klbf-lab ProjectLeonida#127 on an RX 6900 XT The doc comments put klbf-lab ProjectLeonida#127 on an RX 6800 XT; it measured an RX 6900 XT, and the 1,270 host lists alive at the loss are this tree's own run (relay 2, 2026-11-29).
…light went black
On an RX 6800 XT with relay 2 and the launcher's default settings the lighting rose and fell
with where the camera looked and ended black (the automatic exposure seems to read a late
value). The same build and place with LEONIDA_RELAY_COPY=0: the light right at 17 to 20 fps
(relay 0 is right too, at 8 fps). Measured 2026-11-30 on that card only.
play-nvidia.ps1 now drops LEONIDA_RELAY_COPY from its defaults when the card name matches
Radeon RX 6000; the card name is read once and shared with the frame generation check.
-More @{LEONIDA_RELAY_COPY='1'} is applied after and still wins.
AI-assisted.
|
I reproduced a launcher edge case with mixed Radeon and NVIDIA adapters. With both an RTX 4070 SUPER and RX 6800 XT in the controller inventory,
This checks launcher settings with synthetic inputs. Aperture pressure and rendering were outside the probe. AI-assisted with OpenAI Codex. |
|
Independent verification on native Windows 11 Pro (
AI-assisted: Antigravity (Gemini 4 Neon) |
…IDIA: the card it plays on decides now
|
Thanks, you were right: the launcher judged by every controller in the PC, not by the card the game plays on. Fixed in 077d608, as you suggested, by moving the decision to the runtime:
What was tested:
Left as it is: the frame-generation default a few lines below ( AI-assisted (Claude Code). |
|
Game-run A/B on Windows AMD RDNA2 (RX 6600 8 GB), the profile this PR is about. tested: #2670 on RX 6600 8 GB (Windows, AMD 32.0.21045.29003), better: story load + device lost at ~180 s / play for ~290 s, closed by hand, no device lost. The caveat: B started with every pipeline A and the warm step had made, and made none in play, while A still made 69 in play. Both device losses on Contribution : EI S.O.S INFO LUDO |
|
The cleaner pair, as offered above: A and B from the same emptied caches (Leonida's tested: #2670 on RX 6600 8 GB, better: device lost ~240 s after the story pack opened / no device lost through ~380 s, closed by hand. Same caches state this time, so the cache caveat of my first comment does not apply here. Still Contribution : EI S.O.S INFO LUDO |
…e card's memory neared its limit, while the submitting thread freed 448 idle lists and 112 preludes; now a thread of its own frees them (LEONIDA_TRIM_ASYNC=0: as before)
|
Added aace3e2: while an aperture segment is tight, the trim this PR adds froze the line of submissions and the title's present for 150-260 ms. What happened.
The change. The same objects are taken out under the same locks, by the same decision. Only their drop moves to a thread of its own,
Measured on an RX 6800 XT (driver 32.0.21045.29003), Ryzen 9 5950X, Series S profile, relay 2, FSR 3.1:
Tests. AI-assisted. |
|
Checked the release-thread behavior with a real D3D12 buffer at AI-assisted with OpenAI Codex (GPT-6). |
KelboLive
left a comment
There was a problem hiding this comment.
Independent check on Windows (Ryzen 9 7950X3D, RTX 4070 Ti SUPER, rustc 1.98.1) at aace3e264.
cargo test --locked -p leonida-gpu --lib -- --test-threads=4: 559 passed, 0 failed, 47 ignored; the author'sviews_are_made_beside_the_heap_and_copied_infailure passes here, so it is not a regression from this PR. Merged onto current main (tree18cdc655): 641 passed, 0 failed, 59 ignored,merge-treeclean,check_no_game_dataanddiff --checkclean, both launcher scripts parse.- The claim holds in the code: landed flights are recycled at once with
take_heldretired (host.rs:5030-5047,list.rs:398-408,:8599-8606), the aperture is polled at most every 100 ms (segments.rs:115-124), 80/70 hysteresis is enforced with strict>and safe at 0 (:95-101,:149-199), and the 64-list/16-prelude trims fire only while tight (list.rs:353-365,host.rs:1726,:1745). - Mutation: removing the ten-point hysteresis reddens
it_stays_tight_ten_points_below_the_percentanda_percent_under_ten_does_not_wrap_when_it_was_tight(7 → 5 passed, 2 failed). The guard is covered.
One gap worth closing, because it is the actual fix: the lifetime change has no test that would go red if landed lists were held again. A test that counts a landed flight returning its list to the pool (drop/recycle counter) would cover recycle_landed/take_held, which is the part that stops the aperture filling — the segment polling and hysteresis are well covered by comparison.
As the body says, the device-loss and perf claims are RX 6800 XT-only; this machine cannot reproduce them, and the code-level evidence above is what can be checked without that card.
|
Test report on RDNA 2 (RX 6600 8 GB), PR head Setup: AMD Radeon RX 6600 8 GB (driver 32.0.21045.29003), Ryzen 5 3600, 32 GB RAM, Windows 11 build 26300. What I saw (5 sessions today, about 2 h of play in total, longest 51 min):
Relay stage: stage 2 in every session ( Guard off (A/B): same build, same save, Reading: on this RX 6600 with current AI-assisted (Claude). EI S.O.S INFO LUDO |
Claimed in the coordination issue as: D3D12-RDNA2-APERTURE-SEGMENT (#2570 (comment))
What and why
On an RDNA2 card with the default play settings (
LEONIDA_RELAY=2) the host device is removed at the first heavy scene (the opening cinematic):0x887A0007, DRED breadcrumbs empty, "nothing of ours was running on the card", with about 1,250-1,270 host lists alive. It happened in every run, andmainalone does it 72 s in even withLEONIDA_BURY_LAG=16.LEONIDA_RELAY=0survives, at about 8 fps.This is the failure of PastiiJay/klbf-lab#127. The video memory manager's 2 GB aperture segment, which DXGI's budgets leave out, holds the driver's command buffers (1 MB and more per command list).
land()kept the lists of the lastbury_lag()flights, and every host list kept its own prelude for life, so the segment ran full and the scheduler marked the device faulted.The fix is ported by hand from kyokyotosh/VIctory-6700XT (GPL-3.0, as this tree), one commit each, attributed in the messages and the doc comments:
f173347: the host lists of landed flights go back to the pool at once (list::recycle_landed). What their commands named (Held: the wholeDeferred, the texture states, twins and refreshes being found, and theDetached's descriptor state and uploads) waitsbury_lag()throughretire. Both the reaper thread and the path without it use it.018d372:host/segments.rsreads the adapter's segments withD3DKMTQueryStatistics(Wdk_Graphics_Direct3Dfeature). They are logged once at device creation and looked at every 100 ms at most. While an aperture segment holds more thanLEONIDA_SEGMENT_TIGHTpercent of its limit,send_latelands the flights in the air.e3c0703: it is looked at on every send, with hysteresis: tight from 80 % by default, clear below 70 % (0: never). While tight, idle host lists are trimmed to 64, with their bytes taken out of the pool's count. The threshold is a pure function (is_tight) with unit tests.63a773e: preludes come from a pool. One is taken when a list is first submitted with transitions and given back at its reset; 128 are kept idle, 16 while tight. The pool keeps each allocator's creation instant, soLEONIDA_ALLOCATOR_TRIMstill sees its real age.LEONIDA_LAZY_PRELUDE=0still makes one with the list.There is one more change, in the launcher. With the fix and relay 2 on the same card, the lighting rose and fell with where the camera looked and went black, which looks like the automatic exposure reading a late value. The same build in the same place with
LEONIDA_RELAY_COPY=0looked right at 17-20 fps.d3d12/scripts/play-nvidia.ps1setsLEONIDA_RELAY_COPY=1for every card; it now leaves it out on Radeon RX 6000 cards.-More @{LEONIDA_RELAY_COPY='1'}still puts it back (checked with-DryRun). Only the RX 6800 XT is measured.Tested
RX 6800 XT, one run each, Series S profile,
-Log, pipelines already cached:main452d1d1b6, relay 2,LEONIDA_BURY_LAG=16LEONIDA_RELAY_COPY=0(the last commit's default here)cargo test -p leonida-gpu: 556 passed, 1 failed, 47 ignored. The failure,descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, fails the same way onmain452d1d1b6. The newhost::segments::tests::*andlist::tests::a_trim_keeps_the_first_and_takes_the_restpass.cargo check -p leonida-gpuand--features diagnostics: ok.cargo clippy -p leonida-gpu --features diagnostics: no new warnings in the changed lines.cargo build --locked --profile diag -p leonida --features diagnostics,mimalloc: ok.python -I scripts/check_no_game_data.pyon the changed files: pass. The branch is onmain452d1d1b6and merges cleanly withmain0eab02a8b.GPUs tested: AMD Radeon RX 6800 XT, Adrenalin 32.0.21045.29003, Windows 11 (Ryzen 9 5950X, 32 GB)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)