mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[GH-ISSUE #1537] finding: on main the world-start device loss is the 64 MiB title-window cap (LEONIDA_TITLE_WINDOWS_MB); raising it gets past it #32
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#32
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @DadaCap on GitHub (Nov 25, 2026).
Original GitHub issue: https://github.com/ubiquitarianism/leonida/issues/1537
finding: on
mainthe device loss at the world start goes away whenLEONIDA_TITLE_WINDOWS_MB(andLEONIDA_ARENA_MB) are raised; the default 64 MiB of title windows runs out just before it, and from then on shader addresses that name title memory reach the GPU untranslated.Where:
runtime/shims/d3d12_vulkan_device.cpp,DeviceState::resolve_title_memory:title_window_cap = 64ull << 20, and past itlog_once("title memory named by a shader address is past LEONIDA_TITLE_WINDOWS_MB, left untranslated; ...")returns the title's own virtual address as the shader address.Measured (
main3ff2a2adcbuilt unchanged, native Windows 11, 64 GB, RTX 5080 16 GB, NVIDIA 621.24, own 1.0.2.1; keyboard pad with A every 5 s from 30 s;LEONIDA_SKIP_INT3=1, localhistory.bcph):LEONIDA_DEVICE_FAULT=1in three of them); two with a library from my branch's translator, two with one frommain's (26,503 main, 1,786 library, 10 exe, 22 FSPX, 52 BVH)library/lib_cs_01405(255 1 1 or 247 1 1). The title then takes its fatal path (int3 at+0x2474606, access violation 0.1 s later).LEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096,main's library+0x23cf683from+0x2215c35/+0x2215eca).So the stop that
docs/linux_proton.mddescribes as "culling compute at world start reads buffers ... where the memory behind them is not mapped" is, on this machine, the window cap: with a higher cap the same dispatches run. I raised both switches together and did not separate them; the default arena (256 MiB) was also full in these runs ("does not fit the GPU address arena", 49 to 63 lines per run).What comes next with the cap raised (same two runs):
nvidia-smi, one run), so this is not GPU work.VirtualQuerycalls per refresh, and the title texture refresh another 40 to 69 ms a pass.PipelineState::build_computeinside the driver (a compute pipeline compile), 30 of 30 samples, and one driver compiler thread is busy. Whether a title thread waits on that for the 30 s the watchdog allows I could not show: my sampler does not unwind the title's frames reliably.Why it matters: a tester on
maincan get past the device loss today with the two switches. For the code, two separate things: the default cap is below what the world start needs (1.4 GB here), and an address the layer cannot translate is handed to the GPU as it is, where one read loses the device; a null or zero-filled range in its place would cost a wrong frame instead of the device. I have not written either change and am not claiming one here; whoever owns the title windows will know which is right.Needs: game files, and enough RAM for the larger windows (the process peaked at 19.9 GB private in these runs). Not measured: each switch alone, another GPU vendor, and anything past the watchdog. Counters, switch names and addresses of the executable only; no game data. AI-assisted (Claude Code).
Posted as an issue because #14 has reached 2,500 comments and takes no more; once there is a new coordination issue I will link this from it.
@DadaCap commented on GitHub (Nov 25, 2026):
One more run, which narrows the second row: with the title's hang watchdog kept kicked as well (
LEONIDA_TITLE_WATCHDOG=0on top of the two switches) the run gets further and then does lose the device, on another program and another kind of access.library/lib_cs_01468. The dispatch oflib_cs_01405that faulted with the default cap went through.So the order of stops on this machine is: the 64 MiB window cap (read fault in
lib_cs_01405), then the title's 30 s watchdog, and behind that a write through an address the layer did not translate (lib_cs_01468). One run for the third; I have not looked at which descriptor it is. AI-assisted (Claude Code).@DadaCap commented on GitHub (Nov 25, 2026):
Two more observations from the same runs, each a separate subject; I put them here only because #14 is full.
1. Two BCPack requests fail at every boot (6 of 6 runs, same two requests): BC7, destination in physical pages,
E_DSTORAGE_DECOMPRESSION_ERROR(0x89240030) withreason=missing-endpoint, both indata/ttdb/props/octa_imposters.ttpf: offset 455285504 (9,423 into 12,288 bytes) and offset 76014336 (19,699 into 24,576 bytes). The profile was built unchanged bytools/build_dstorage_history.pyfrom my 1.0.2.1 copy; the runtime reportsBC7 endpoint/index fields 4228/6144 8160/8192for it. So the fit from the player's own pools leaves endpoint fields that these two chunks need. The title carries on after them. For whoever owns the BCPack predictor (RT-BCPACK-DECODER); the offsets should reproduce on any 1.0.2.1 copy.2. The run with the watchdog kicked does not always end in the device loss. Of three such runs, one lost the device (the
lib_cs_01468write above), one ran into my time limit first (I had a test suite running beside it, my mistake), and one ended with process exit 0xC0000005 at 385 s with no exception record in the trace and no device loss, at 4,689 submissions. In the runs I looked at,lib_cs_01468gets four or five buffer descriptors in its one table (s4), all backed by imported title memory (storage=importinLEONIDA_COMPUTE_INPUTS), and they look sane in the dispatches before; I did not catch the faulting dispatch with the probe on. So the third stop is not pinned down, and I am leaving it here rather than guess.AI-assisted (Claude Code).
@quartz-heron-58 commented on GitHub (Nov 25, 2026):
A second machine, and one of your two switches on its own: on an RTX 4080 the default arena alone loses the device much earlier, before any input, and
LEONIDA_ARENA_MB=4096by itself removes that.Setup: main
3ff2a2adcbuilt unchanged, native Windows 11 build 26300, 32 GB, RTX 4080 16 GB, NVIDIA 621.24, own 1.0.2.1, shaders from main's translator (26,503 main, 1,796 library). The build has no SDL3, so nothing is pressed in any run: this is only what the title does by itself in the first four minutes.LEONIDA_LAZY_PSO=1 LEONIDA_SKIP_INT3=1. Each run is stopped by me at 240 s if it gets there.LEONIDA_DEVICE_FAULT=1LEONIDA_ARENA_MB=4096 LEONIDA_TITLE_WINDOWS_MB=4096LEONIDA_ARENA_MB=4096onlyThe window-cap line ("past LEONIDA_TITLE_WINDOWS_MB") was not printed in the default runs, and once in the arena-only run, without a loss in the 240 s. So this early stop goes with the full 256 MiB arena, not with the window cap, and it is not the stop at about 300 s you describe: these runs never reach the story load.
This also corrects the reading I posted in #14 (comment 7151745666). There I reported that
LEONIDA_DEVICE_FAULT=1makes this loss go away, 2 of 2 each way. That measurement stands, but the arena is full in those runs as well (63 lines each), so the diagnostics switch does not remove the cause; it changes whether the same condition ends in a loss within 240 s. Why, I have not looked at.Memory with the arena at 4096, for the 32 GB case: private bytes 7.8 GB at 10 s, 9.9 GB at 121 s, 13.4 GB at 181 s and flat to 231 s; free physical memory never below 13.6 GB.
Not measured: anything with input, the window switch on its own, more than one run for each of the last two rows, the fault report for the default-arena loss (it does not happen with the report on). Counters, switch names and log line counts only. AI-assisted: yes (Claude Code)
@Tetn5 commented on GitHub (Nov 25, 2026):
I'd like to help out and ask if I can take on the
DeviceState::resolve_title_memorycap / untranslated-address fallback fix inruntime/shims/d3d12_vulkan_device.cpp(tracked here because #14 is at the 2,500-comment cap).Before writing a patch, do maintainers have a preference between:
resolve_title_memoryruns pastLEONIDA_TITLE_WINDOWS_MB(avoiding untranslated virtual addresses reaching the GPU and causing device loss),LEONIDA_TITLE_WINDOWS_MBcap, orIf anyone already has a branch in progress for this, please let me know and I'll gladly step aside. (AI-assisted via Antigravity.)
@lixonik commented on GitHub (Nov 25, 2026):
Thanks for recording this while #14 was full. I added the finding and a link to this report in #1608, the continuation of #14. If this was only a temporary coordination issue, would you consider closing it? If you are still using it to track the device loss or any of the follow-up findings, please keep it open.
@QemmHD commented on GitHub (Nov 25, 2026):
Confirmed on a third machine, with a 12 GB card: Windows 11, RTX 4070 SUPER (NVIDIA 621.24), main
c7e82e26e(it includes #1064 and #1232, which don't change this), plus #1558 for the earlier NVIDIA landing stop.LEONIDA_TITLE_WINDOWS_MB=1024: no device loss, 0 refused ExecuteCommandLists. The windows grow to 8,192 windows / 841 MiB by 225 s, still growing, so the default needs to be well over 13× larger here.I'll test #1631 on the same boot with the default cap and report back there.
AI-assisted (Claude Code, Claude Opus 5.5).
@DadaCap commented on GitHub (Nov 25, 2026):
@lixonik thank you for indexing it in #1608. I would keep this one open as the record of the device loss until #1631 (or a higher default cap) lands, and close it then; nothing else depends on it, since the other observations are linked from #1608 now.
@quartz-heron-58 @QemmHD thank you for the second and third machine. The arena alone on the 4080 and the 841 MiB of windows at 225 s on the 4070 SUPER are the two things I had not separated. The WRITE_INVALID stop in #1608 matches what I saw once the watchdog was kept kicked (a write, pipeline-library compute, lib_cs_01468 on the queue).
AI-assisted (Claude Code).
@kurrutako commented on GitHub (Nov 25, 2026):
A fourth machine, the smallest NVIDIA card so far and an older driver: Windows 11 (build 26300), RTX 5070 12 GB, NVIDIA 621.01, Ryzen 7 7800X3D, 64 GB, own 1.0.2.1 (all 108 sizes match
game/xbox-1.0.2.1.json; SHA-256 checked on the 52 files under 200 MB, the executable included). Shaders translated at3de22a190(26,503 / 26,503 main passspirv-val, 52/52 BVH, 12/12 exe;--wave64-emulateauto → on); runtime rebuilt atbcaa13dad(includes #1558).--first-run-uiprofile, 2560x1440 swapchain,LEONIDA_DEVICE_FAULT=1, fresh overlay and save folder each run.3de22a190(before #1558)exe+0x131a2adafter 39 s, right afterslot 133 depth texture refused (hr=0x80070057, placement): format 118 2560x1440x1bcaa13dadpast LEONIDA_TITLE_WINDOWS_MB ... MiB copied so far: 63, then device lost at 426 s (vkDeviceWaitIdle, title texture upload); last dispatches on the direct queue arelibrary/lib_cs_02993andlibrary/lib_cs_00031; then int3 atexe+0x2474606bcaa13dadLEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_KEYBOARD_PAD=alwaysaddress[1] type=2(WRITE_INVALID) at an address in the title's process range (far above the arena), last dispatches on a compute queue arelibrary/lib_cs_00927(18,1,1); then int3 atexe+0x2474606So on this card too: #1558 removes the first NVIDIA stop, the default 64 MiB cap is reached and the device is lost after it, and with the cap raised (and the watchdog kicked) the loss moves to a write to an untranslated title address on a compute queue, as in your watchdog-off run, on a different library program. Input reached the title in runs 2 and 3 (keyboard pad and an Xbox One pad); run 2 stayed on the account-selection page.
Counts, offsets and program names only, no game data. AI-assisted.
@QemmHD commented on GitHub (Nov 25, 2026):
Thanks @kurrutako, that's the same sequence as on the 4070 SUPER. One caution on run 3: on my side a store trace over all 4,976 translated programs that store (details in #1608) showed that no translated shader forms that WRITE_INVALID address. The compute queue's last dispatch is just where that queue had finished its list. The fault is the last 4 KiB page of a 448-page span on a 2 MiB boundary, with a constant instruction pointer across runs and a direct queue that hadn't reached a marked command. That points at a write the layer or driver makes itself at the start of a submission. The leading suspect is the per-submission zero fill / storage-image initialize in
vulkan_backend.h, which runs before any checkpoint marker. I'm testing that now.Also worth a re-run: main just took #1723 (
ed94fbef9, the post-story-load memory/queue/Vulkan integration: an indirect clamp, zero-size V#s for unbacked inline tables, twins that aren't imported), which may move this stop.AI-assisted (Claude Code, Claude Opus 5.5).
@HasiKe commented on GitHub (Nov 25, 2026):
Confirmed on a second NVIDIA card: GeForce RTX 2070 SUPER (8 GB), driver 616.56, Windows 11, 64 GB RAM, own 1.0.2.1, runtime from
c7e82e26e(includes #1021),LEONIDA_CONSOLE_D16S8=native, localhistory.bcph, keyboard pad driven by a recordedLEONIDA_INPUT_SCRIPT(noLEONIDA_SKIP_INT3).VK_LAYER_LUNARG_crash_diagnostic+VK_EXT_device_fault:Invalid Readat a title-range address, in avkCmdDispatch(28 to 241 groups) on the dedicated compute family. A local handle log maps the pipeline tolibrary/lib_cs_01405. Then the title's int3 at+0x2474606.LEONIDA_ARENA_MB=4095onlyLEONIDA_TITLE_WINDOWS_MB=512only+0x4dcbc9d(111 s) in the otherLEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096+0x23cf683(write 0x0), the watchdog stop you describe.So on this card the 512 MiB cap is not enough either; it needs the full ~1.7 GB. PR #1728's V# guard (tested on its
4ebe44664) does not prevent the loss, which fits a raw global load:lib_cs_01405's index entry listsPhysicalStorageBufferAddresses.I also posted this as a finding in #1608 before I found this issue. That entry is a duplicate of this one and I have marked it so.
Counters, switch names and executable offsets only; no game data. AI-assisted (Claude Code).
@HasiKe commented on GitHub (Nov 25, 2026):
Same order of stops on the RTX 2070 SUPER (driver 616.56,
c7e82e26e,LEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096, scripted keyboard pad):+0x23cf683. 29 compute pipelines take 2 to 9 s each at the world start, among themlib_cs_02147(9.4 s) and3InstanceCulling_CS_Tree_BatchCull(7.0 s).vk_pipeline_checkinto the samepipeline_cache.binbeforehand (0 failed) did not help: the runtime built the same 29 again. The checker's pipelines probably use a different layout from the title's root signatures, so the cache entries do not match. Treat that as a hypothesis.LEONIDA_TITLE_WATCHDOG=0on top: device lost at about 500 s, then the int3 at+0x2474606. This dump'sVK_EXT_device_faultgives only an "Unknown Instruction Pointer" range and no read or write address, so I cannot say whether it is yourlib_cs_01468write.AI-assisted (Claude Code); no game data.
@BubsMcgee commented on GitHub (Nov 25, 2026):
Status check: the runtime half of this is fixed on main.
ba626820ebacks a title address past the cap (or with the arena full) with the persistent geometry copy, or writes its view zero-size, so the raw VA no longer reaches the GPU; #1631 (merged) addedd3d12_title_window_cap, the test for that path withLEONIDA_TITLE_WINDOWS_MB=0. What is left of the finding is the default cap itself (64 MiB against the ~1.4 GB the world start used, at a ~19.9 GB process peak) — a memory tradeoff, not the device-loss bug — and the elevated-cap runs still stop at the watchdog (+0x23cf683from+0x2215c35), which is the address #1915 reports.@DadaCap commented on GitHub (Nov 25, 2026):
Closing as I said I would: #1631 is merged and, as BubsMcgee sums up, an address past the cap (or with the arena full) is backed by a geometry copy or written as a zero-size view, so the raw address no longer reaches the GPU. What is left of the finding is the default cap (64 MiB) against what the world needs, a memory choice; in my world runs
LEONIDA_TITLE_WINDOWS_MB=4096withLEONIDA_ARENA_MB=4095took the "got no GPU copy" count from 131,072 to 128 and made acceleration-structure builds resolve that did not, at the price of the copies #1867 cuts. Thank you to everyone who confirmed it on their cards. AI-assisted (Claude Code).