d3d12: a lost device ends the run with 75 and a marker, not a crash #3151
Open
KelboLive wants to merge 2 commits from
upstream-pr/3151 into main
pull from: upstream-pr/3151
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!3151
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3151"
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 KelboLive on 2026-12-02T14:20:28Z.
What and why
A lost D3D12 device currently kills the process.
PresentandResizeBuffersresults are discarded, resource/heap creation treatsDXGI_ERROR_DEVICE_REMOVEDas a refusal, andhost::failcallsTerminateProcess(0x887A0005)— so a driver/PnP stop looks like a crash and the launcher can only report a failure.This makes the loss a defined, recoverable event:
Present,ResizeBuffers, resource and heap creation now classifyDXGI_ERROR_DEVICE_REMOVED/_RESET;host::failuses the new exit 75 only whenGetDeviceRemovedReasonactually reports a loss. OOM and other GPU failures keep the legacy0x887A0005, so they are not mistaken for a loss.<Data>/device-lost.txtatomically (temp →sync_all→ rename), capped at 4 KiB, and logsdevice lost: reason=… hresult=0x… luid=….leonida-device-lost/1,code=75,reason,hresult,unix,pid, plusluid,adapter,frame,what. Free text is percent-encoded.LEONIDA_TEST_DEVICE_LOST_AFTER=<frames>forces the same path for tests, gated totest/diagnosticsbuilds; release binaries ignore it.LEONIDA_DEVICE_LOST_FILE=<Data>\device-lost.txt(with a<parent of data_dir>fallback), so the launcher and runtime agree on the location. The marker is cleared at run start.The launcher side (separate PR) reads the marker and restarts at most twice (10 s, 60 s), cancellable, and never restarts a title crash.
Evidence
On Windows 11, RTX 4070 Ti SUPER:
cargo test -p leonida-gpu --locked lost→ 16 passed, 3 ignored.cargo test -p leonida-gpu --locked -- --test-threads=1→ 705 passed, 59 ignored.cargo test -p leonida -p leonida-hle --lockedpass.tools/d3d12_switches.py --checkpasses (683 names; 643 with comments);check_no_game_datais clean.read_device_lost(verified against the launcher branch).Scope / notes
texture::alias_cast_tests::…flake is pre-existing (2 of 4 runs on cleanmain) and is not this change.host.rs/queue.rs/resource.rsoverlap open #2670/#2847/#2765; the edits are surgical, expect textual rebases.GPUs tested: RTX 4070 Ti SUPER, driver 621.01 (marker and exit path only; no game run)
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:49:42Z.
Review: COMMENTED
Concurrent device-loss notifications can exit with 75 before the marker is published. In
lost.rs,WRITTEN.swap(true, …)claims the write beforefile()andwrite_to(). The next caller returnsfalseimmediately. Inhost::device_lost, that caller still reaches the terminating callback orlost::end(75). The launcher can receive the retry exit code without the marker it needs.I reproduced this on
4e9f179amerged ontomainacc350745under Wine 11.22. A child process paused its firstdevice_lostcall just after it took the writer claim, then calleddevice_lostagain on another thread. The submitted implementation exited with 75 and left no marker. With a local synchronization guard covering the marker write through rename, the same test exited with 75 and retained the first report. All 10 targeted tests passed in that local variant. Please make marker publication finish before any parallel caller is allowed to terminate.All nine stock
lost::tests and 49 CLI tests passed. The widerlostfilter also matched a write-watch test that failed separately on both revisions under Wine. Git also reports a merge conflict with #3146 (ebc0253f) inmodules/d3d12x.rs. The merged callback should flush the pipeline book before either exit path. Synthetic tests only. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T15:03:13Z.
Verified PR #3151 (
4e9f179a8) merged cleanly ontomain(acc350745) on Windows 10 x64 (RTX 5070 12 GB, driver 595.79, Rust 1.98.1):python -I scripts/check_no_game_data.pyPASS.python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdPASS.cargo test -p leonida-gpu --features diagnostics --lib --locked lost::-- 9 passed, 0 failed.LEONIDA_TEST_DEVICE_LOST_AFTER=20,diag+diagnostics,dlss,mimalloc, Series S, RTX 5070):leonida.exe run ... --execute --console series-sdirectly exited cleanly at frame 20 withExitCode = 75(no crash dialog) and wrote the expected marker file:ERROR leonida_gpu::host: device lost: reason=DXGI_ERROR_DEVICE_REMOVED hresult=0x887A0005 ... frame=20 what="LEONIDA_TEST_DEVICE_LOST_AFTER=20".One concrete finding (launcher exit-code propagation)
scripts/play-d3d12.ps1->d3d12/scripts/play-nvidia.ps1, the marker file is written properly, butplay-nvidia.ps1returns exit code0instead of75becaused3d12/scripts/play-nvidia.ps1:966-968callsStart-Process -FilePath $leonida ... -NoNewWindow -Waitwithout-PassThruand without propagating$proc.ExitCode(e.g.$p = Start-Process ... -PassThru; exit $p.ExitCode). If callers/harnesses invokeplay-d3d12.ps1expecting exit code75, propagating$p.ExitCodethere closes that gap.host_gpu_failedind3d12/crates/leonida-hle/src/modules/d3d12x.rs.Verdict: PASS on the core exit-75 + marker behavior (note this was a targeted 20-frame injection run, not a 300 s render-path stability run).
AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T15:10:54Z.
I reproduced the exit-code finding with the exact two launch tails from
4e9f179a, executed in PowerShell 7.5.4 on Linux against a synthetic child returning0,3, or75. I ran each case with and without-Logand checked that stderr still went to the same destination.For a child returning
75, the unchanged scripts returned0from both entry points. Adding-PassThruandexit $proc.ExitCodetoplay-nvidia.ps1made its direct invocation return75, butplay-d3d12.ps1still returned0when launched with-File. Addingexit $LASTEXITCODEimmediately after the inner call preserved the child status through both levels, in all six status/log combinations. The launcher invokes the outer entry point, so both boundaries matter. PowerShell exit-code semanticsThe fixture exercised the launch wrappers only. The native Windows injection run above supplies the runtime evidence. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:55:51Z.
Ran natively on Windows 11, head
4e9f179a8merged into currentmain(3c106eb2f, clean merge). Debug test builds. This adds a real device removal (not the env injection) and a native measurement of the double-report race raised above.Suites on the merge
cargo test -p leonida-gpu --lib -- lostcargo test -p leonida-gpucargo test -p leonida-gpu --features diagnosticscargo test -p leonida -p leonida-hlecargo clippy -p leonida-gpu -p leonida-hle -p leonida --all-targets(also with--features leonida/diagnostics)unused_mutinhost.rsis elsewhere)A real removed device
Throwaway tests, not pushed. A child process makes the host device, calls
ID3D12Device5::RemoveDevice(), then goes through the PR's code.GetDeviceRemovedReasonthen returns0x887A0005.host::fail(...)reason=DXGI_ERROR_DEVICE_REMOVED,hresult=0x887A0005,luidandadapterfilled,frame=0host::fail(...)adapteris the WARP adapter)pool::small::buffer(a heap creation)what=host small-buffer heap creation ...pool::small::bufferThe same child on
main(3c106eb2f), card and WARP alike.pool::small::bufferon the removed deviceNonetwice, the run would go onhost::fail(...), withon_failureset to whathost_gpu_faileddoes onmain0x887A0005So the classification works with a real removal, and
process::exitdid not hang after it here. These children had noon_failureset, so the realhost_gpu_failedwas not part of this table.The double report, native rate
Child processes where threads call
host::device_lostfor the same loss, marker in a fresh temp folder each time, no pause injected. The second table sets anon_failurethat does whathost_gpu_faileddoes before exiting (two lines to stderr and two appends to a crash-log file, thenlost::end), as a stand-in for the app's callback.on_failure)One 2-thread run (in an earlier batch of 200) also left a
device-lost.txt.tmp-<pid>behind. With the second report delayed after the first (requested sleep, 100 runs each, noon_failure):So on this machine the write (create, write,
sync_all, rename) takes a few ms, and a second report inside that window ends the process with 75 and no marker. Whether two threads really report within a few ms of each other in a game run is my reading, not measured. A removed device fails every call made on it, so the presenter and the list threads can easily hit it together. A loser that waits for the writer to finish before it exits (or parks and lets the writer end the process) would close it.When the marker cannot be written
Single report, exit code always 75.
clear()and the rename both fail).tmp-1beside it.tmp-1stays (clear_atlists""and fails).tmp-1.tmp-1removedThe stale-marker case means a launcher can read an older run's marker after a 75. Checking
pidagainst the child it started would catch it.Marker size
20,000 random markers (
whatup to 3,000 characters of ASCII, quotes,%,=, newlines, CJK and emoji;adapterup to 127 UTF-16 units; maximumluid,pid,unixandframe). The largest was 3,818 bytes, none over 4,096, and everyadapterandwhatdecoded back to the input (a prefix of it forwhat). The 1,024-byte cut onwhatalways kept it under 4 KiB, so this never reached the shrink loop. The PR's own test covers that branch.From reading only
Without
LEONIDA_DEVICE_LOST_FILE,run.rswrites<data_dir>/device-lost.txt. Both play scripts set<parent of data_dir>/device-lost.txt. So a launcher that startsleonida.exedirectly, without the variable, looks one folder too high. Andrun.rsnow exits with any nonzero title status, so a title returning 75 gives 75 with no marker. Both are probably fine if the launcher always sets the variable and checks the marker, but no test covers them.Not checked: the play scripts (they use
-ExecutionPolicy Bypass, not run), a real driver reset or TDR,PresentandResizeBufferson a removed device (no swap chain in these tests), the realon_failurecallback ind3d12x.rs(only the stand-in above), and the launcher side.GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T16:21:34Z.
Verified here: it applies, the new module's tests pass, and the app's tests still pass.
The one that matters most is
the_injection_reaches_exit_75_and_writes_the_marker: it means the loss can be provoked without a GPU - and that is exactly what makes this testable at all. The marker's 1024-byte cut on a character boundary and the atomic clear are the two properties a launcher reading the file would be hurt by if they were wrong, and both have a test that passes.Why I looked at this one: a real run of the title this week lost its device - frame times flat at 35.7 ms, then three and a half minutes of medians from 145 to 1,899 ms after 22:03:50, with the log noting the recovery. On
mainthat is a killed process with a truncated log; this turns it into exit 75 and a marker that names the adapter and what happened, which is the difference between "it crashed" and a report someone can act on.What I did not test: a real device removal - the injection switch is as close as this machine gets without the title, and I used it rather than claiming the real path.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-02T16:42:29Z.
Temporarily closing to free the single-PR slot for a high-severity fix (PSV0 validator rejection). The branch is preserved at
stability/device-loss-exit(0d399d6cf), rebased on current main with all checks green locally; I will reopen this PR once the slot frees. No change in intent or scope.Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:39:11Z.
VERIFY-3151 — Windows nativo:
red then green, y el código de salida es el de verdad0d399d6cf—leonida-gpu/src/lost.rs(+74 inhost.rs),apps/leonida/src/run.rs(+34)Ran at the head
Negative control (synthetic): I removed one code from
is_loss(DXGI_ERROR_DRIVER_INTERNAL_ERROR), rebuilt and ran:It bites, and that is the right shape: the predicate is a list of four codes (
DEVICE_REMOVED,DEVICE_HUNG,DEVICE_RESET,DRIVER_INTERNAL_ERROR), and the test enumerates all four plus the ones that must not count — a list is exactly what a mutation can shorten.What the change is: a lost device ends the run with exit 75 and a marker, instead of crashing — and the second test ties it to the launcher's view: the process exit code is the title's, so a launcher or a game-gate can tell "the game ended" from "the device went away". That number is the whole point: without a distinct code, a device loss reads as a normal exit and every script that checks
$LASTEXITCODEsays the run was fine.What I could not test
DXGI_ERROR_DEVICE_REMOVEDon purpose is a run with a fault injection; the tests driveis_losswith the codes.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-03T10:47:32Z.
Review: COMMENTED
Independent current-head RTX 3090 compatibility check — PASS (normal path + synthetic exit/marker)
Tested
0d399d6cf1b015f321d685cc1d5a149c9318a667cleanly merged locally onto maind9b618f10150f275c30088e4769c1acbf1d8d689(merge5d2645e0d). Main advanced during the build to9a7c22f30with a CI-workflow-only diff; the newer merge tree also applied cleanly. No upstream content changed.Windows 11 build 26200, RTX 3090 24 GB, NVIDIA 610.88, Ryzen 9 5900X / 32 GiB RAM; Rust 1.98.1, diag build with
diagnostics,dlss,mimalloc, executable SHA-25671a15c5e3c4f8636e2d66f591eb5b78c4d528efbe7bd9f56e027776215db3887(verified before/after).Ordinary play, no loss injection: stock game gate, Series S stretch,
-NoFrameGen -NoPrecompile, isolated warm cache and save, idle outdoors following a verified control probe and native placement.No stale/false marker was present at start or after the normal run, no temporary marker remained, and the effective runtime settings had no injection switch. Native control moved 1.43 m; 24 later idle placement checks stayed within 0.2 m of the test spot. World time includes loading/placement; about 247 s were after control, not five full minutes at that spot. Boot was slow (403 s to the gate's world detection).
Separately, no game/driver fault:
cargo test -p leonida-gpu --features diagnostics --lib --locked lost::passed 9/9, including the existing child-process injection test. I ran that existing synthetic child again and directly observed exit 75, fresh 156-byte complete marker withleonida-device-lost/1,code=75,reason=DXGI_ERROR_DEVICE_REMOVED,hresult=0x887A0005, and its synthetic-injection description; no temporary file remained. Frame 0 is expected in the hostless harness. The title-exit regression (the_title_exit_code_is_the_process_exit_code) also passed (1/1). Clean-room and switch-table checks passed. No real device reset, fault injection into the driver, or retail exit-75 launcher propagation was exercised here.This is a one-run non-faulting compatibility check plus synthetic exit/marker proof, not a matched performance comparison or validation of recovery from actual hardware loss. Independent numerical recomputation agreed with the evidence. AI-assisted (GPT-6.2 Sol tester and separate GPT-6.2 Sol numeric check).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T12:20:58Z.
Current-head check of
8894c581onb053a181. The Windows MSVC synthetic child under Wine exited 75, wrote a complete marker and emitted the canonicaldevice lost: reason=… hresult=…line. All ninelost::testspassed.Gate follow-up for the new diagnostic. I replayed the exact line and exit status through
tools/game_gate.pywith generated frame data andgame_exitedimmediately afterstop_requested. When the new line is the only loss diagnostic, the gate reportsPASSwithcrash.kind=noneandexit.kind=other. The same applies to a launcher-only exit event with #3218’s fallback. The normal HLE callback also emitsLeonida: host GPU failure. Including that older line makes the stock gate correctly reportFAIL / device_lost, whileexit.kindis stillother.A local control that also recognizes the new line reports
FAIL / device_lostin the fallback case and correctly labels the corroborated exit 75. It leaves an uncorroborated 75 asotherbecause a title can return that status itself. All 38 gate tests passed with #3218 in the local control. Synthetic gate fixtures and runtime injection only.AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T12:46:34Z.
RUN (in game, third party, batch of four pull requests), each head merged with
git merge --no-ffonto main6e9799050, in one build: #26424b4d99a82, #31518894c5812, #33230c836e32e, #332402f37bcf8. 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.4 fps on other runs in the last day: 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. The precompile before the world took 529 s, against about 110 s for main alone: the translator change in #3324 left the pipeline cache cold. Switches that are off by default (for example #3323's own-pass timing) were not turned on: this run covers their default path only. #2642 targets Wine and was run on Windows only. #3151 changes what happens on a lost device; no device was lost, so that path was not exercised.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-03T16:09:18Z.
Fixed in
5524fdcdc.The cause was exactly as you described:
WRITTENwas anAtomicBoolswapped beforewrite_to, so a second caller returnedfalseand could reachlost::end(75)while the first was still writing. It is now aMutex<bool>held for the whole publication: a losing caller blocks until the marker is renamed into place, then returnsfalse.use_fileresets it under the same lock, and I kept the lock orderWRITTEN → FILEin both functions to avoid an inversion.Regression test:
a_concurrent_caller_returns_only_after_the_marker_existsruns two threads per iteration (64 iterations); a caller that did not write asserts the marker already exists at the moment it returns. I reproduced the red by temporarily restoring the claim-before-write order with a 20 ms pause after the claim — the test fails there, and passes with the fix.lost::is now 17/0/3 and the serialleonida-gpusuite is 726/0/59.Two notes on the rest of your review:
modules/d3d12x.rsas you said. Whichever lands second needs to rebase that callback; I did not touch it here.The rebased head is
5524fdcdcon current main withswitches.mdregenerated (732 names). CI is restarting on it.Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-03T17:07:58Z.
Rebased onto current main (
fba6f09ce) at804ac5d7b.Resolved the
modules/d3d12x.rsconflict with #3146 as you suggested:flush_on_gpu_failure()now runs before either exit path, then the 75 path logs and callslost::end(75), then the legacyTerminateProcess(DXGI_ERROR_DEVICE_REMOVED)for other GPU failures. This also answers your pipeline-book note for the merged callback.lost::17/0/3, serialleonida-gpu735/0/59,d3d12_switches.py --checkclean. CI is restarting on the new head.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.