Device lost after ~60k live PSOs: "Kernel memory failure" from D3D12 debug layer (RTX 4060 Laptop, 8 GB) #1333
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1333
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?
@packwka22 on GitHub · 2026-11-24 14:54 UTC · original
Third run, this time with
d3d12_debug = true(everything else unchanged, shader cache warm,uma_mb = 0→ 4095 MB coherent window again). The debug layer caught something right before the device loss.report.jsonandxcl.logattached (user name and XUID redacted).The interesting part: kernel memory failure 2 s before the device is lost
60 029 live pipeline states is about the size of the whole background pipeline queue (
background_pipelines: [1266, 0, 57495]in the report). My guess: with a warm DXIL cache, XCL creates most of the ~58k PSOs in the background within a couple of minutes, and on this 8 GB laptop GPU the driver runs out of kernel memory, which then shows up as DEVICE_RESET / DEVICE_HUNG.This would also explain the odd ordering of the three runs — the faster PSOs can be created, the sooner the device dies:
Run Shader cache Debug layer Device lost at Error
1 cold (DXC compiling, up to 3 s per PSO) off 197.3 s
0x887a00062 warm off 102.9 s
0x887a00073 warm on (slower) 142.2 s
0x887a0007In all three runs the frame rate collapses for 20–50 s before the loss (run 3: 21.7 fps at 91 s, then ~3 fps until 142 s), while audio keeps decoding normally — consistent with the driver paging or running short of memory. I only have the live-object counts for run 3, so this is a hypothesis, not proven.
If there is a way to cap or turn off background pipeline creation, I can rerun with it to test this.
Other debug-layer errors (all early in the run; the title kept going for another ~130 s)
Message counts are as logged; the debug layer may only log the first few of each.
id 1047, race on the sparse queue (×8, from
UpdateTileMappingsandExecuteCommandLists): "Simultaneous-access or Buffer Resource … is still referenced by write GPU operations in-flight on another Command Queue … It is not safe to start write GPU operations now on this Command Queue (…'xcl sparse queue')."id 538, wrong resource state (×8): e.g.
ClearRenderTargetViewon a resource inUNORDERED_ACCESSinstead ofRENDER_TARGET; alsoCopyResourceandDraw.id 1422, uninitialized placed resource (×4): an RT/DS placed resource with
CREATE_NOT_ZEROEDused byDrawInstancedbefore any Discard/Clear/Copy.id 824, Map on a reserved resource (×8): "Map and Unmap can not be called on a resource created with the CreateReservedResource API."
Same as before
Failed DirectStorage read
0x89240009, this time the same file as in run 1:G:\.\data\ttdb\vfx\ttdb_vfx.ttpf(24576 bytes, at 107.8 s).A new console-only
QueryInterfaceright before the loss in run 2 (3febd6dd-…, 0.06 s before) and run 3 (310d36a0-…, 2 s before). Probably the game reacting to the failing device rather than a cause, but noting it.Best FPS so far: 30.0 over the first 600 frames, 1966 presents in total.
report.json
xcl.log
@lemosss on GitHub · 2026-11-24 15:41 UTC · original · edited 2026-11-24 16:09 UTC
Two things that may help here: what the 60 029 live pipelines most likely are, and a measurement of what that many pipelines cost an 8 GB NVIDIA GPU without a game.
What the live pipelines are. In your report
background_pipelines: [1266, 0, 57495]is (built, failed, still pending) (pso_async::counts()). A pipeline whose shaders are not compiled yet gets a stand-in at once (real.rs,standin_graphics/standin_compute: the same dummy VS / PS / CS for all of them), and the title keeps that stand-in for as long as it holds the pipeline. So the 60 029 liveID3D12PipelineStateare about 57 495 stand-ins plus the 1 266 real pipelines built so far, not 58k pipelines built in the background.To your question:
XCL_PSO_PRELOAD=0turns off the workers that build an earlier run's pipelines ahead of use (pso_async.rs). It would not lower the live count much, though, since the stand-ins are made whenever the title creates a pipeline.Measurement (a throwaway test, plain D3D12, no XCL hooks, every pipeline kept alive; process private bytes, system commit, kernel paged / nonpaged pool and
QueryVideoMemoryInfosampled every step)real.rsdummy()(FXC 5.0), 3 of 4 graphics with varied RT / DS formats, blend and cull, 1 of 4 compute, 4 root signatures: 100 000 created and alive, no failure. ~6 KB of process commit each (71 → 696 MB), kernel paged / nonpaged and local / non-local video memory flat, ~7 µs per pipeline, and the device still ran a queue signal afterwards.So on this GPU neither the stand-ins nor the built pipelines grow kernel memory or video memory, even at 90k–100k, and the pipeline count alone does not look like what ran the driver out of kernel memory. Built pipelines do cost ~115 KB of process commit each here, so a run that builds tens of thousands of them would need several GB of commit, but yours had only 1 266 built. The other large counts in the same debug-layer dump, 67 107 live
ID3D12Resourceand 3 974ID3D12Heap, may be the better lead (I have not measured those).Not tested: a laptop / hybrid-graphics RTX 4060 like yours (the driver and memory setup differ), the debug layer's own per-object cost, a retail title, AMD.
Run and written with Claude Code (Claude Opus 5.5).
@packwka22 on GitHub · 2026-11-24 16:35 UTC · original
Follow-up: same settings (
XCL_PSO_PRELOAD=0, no debug layer,uma_mb = 0), but after a reboot, so the system started with far less in use.report.json,xcl.logThis rules out commit exhaustion as the cause of the crash. Peak commit was only 43.8 / 67.5 GB this time (66.2 last run), and the title's own crash reporter logged 24.6 GB of swap free (9.4 GB last run). The crash is still identical, at the same point in the game:
Task Manager early in the world mid late end after the crash
RAM in use / available 20.4 GB / 3.1 GB 20.7 / 2.8 22.5 / 0.9 23.2 GB / 308 MB 8.1 / 15.4
Commit 29.8 / 67.5 GB 31.8 40.2 43.8 15.6
Paged / nonpaged pool 748 / 496 MB 801 / 495 947 / 576 1004 / 624 620 / 528
Dedicated / shared GPU climbing / ~2 GB 8 GB full / flat full / growing full / growing —
Physical RAM still ends up full (~15 GB for the run on this 24 GB machine), and dedicated VRAM is full while shared GPU memory keeps growing. But commit and the kernel pools have plenty of headroom, so I'd now drop my earlier "failed allocation under commit pressure" guess.
What lines up with the crash in both runs is a very long compute PSO build right before it, with the title making almost no progress:
Run 4: compute PSO with a 384 860 B DXIL finished at 132.210 s after 10 582 ms; crash 4 s later.
Run 5: that same 384 860 B PSO came from the driver blob in 27 ms, but a new 494 324 B one finished at 131.216 s after 11 645 ms; crash 25 ms later.
In both runs, presents go from 1500 (at ~84–92 s) to only ~50 more before the crash. In run 5 the render-side threads log nothing between 101 s and 131 s apart from that build finishing.
A null write with rax = rbx = 0 right after a 10+ s stall makes me wonder whether this is the title deliberately killing itself, e.g. a watchdog on a stalled frame or render thread, rather than a real bug. That is only a guess, I can't confirm it from the log. If XCL builds these huge compute pipelines on a path that blocks the title's frame, that might be the thing to look at. The 494 KB one is now in the driver blob cache, so I'll rerun to see whether the crash moves later or goes away.
report.json
xcl.log
@packwka22 on GitHub · 2026-11-24 16:46 UTC · original
Third run with the same settings, and I need to correct my last comment: the long-shader-build idea doesn't hold. In this run both earlier slow PSOs came from the driver blob cache (384 860 B in 9 ms, 494 324 B in 15 ms), and the title still crashed at the same address and stack, at almost the same time:
Run Crash at Address Last big PSO before the crash
4 136.3 s
+0x23cf683(write to 0x0) 384 860 B, 10.6 s, finished 4 s before5 131.2 s
+0x23cf683494 324 B, 11.6 s, finished 25 ms before6 135.3 s
+0x23cf683240 420 B, 5.8 s, finished 186 ms before (both earlier ones cached)Run 6 built 92 compute PSOs around that time, so "a build just finished" is true almost all the time. That makes it coincidence, not a cause. Logs and report attached.
The more useful find is the title's own crash-context files. Its Breakpad writes one to
T:(XCL'stempfolder) on every crash, and I've attached all four. The three null-write crashes are at the same point in the game:That is, the crash happens as the story intro sequence starts prestreaming. The title's memory section at that moment is the same in all three:
So the title's physical pool is about 96 % full, with "Unused" at 0, right when it starts streaming the intro. My guess is that the prestream allocation fails and the title writes through the null result, but I can't confirm that. I don't know how XCL sizes what the title sees as physical memory (
title_memory = "auto",title_memory_mb = 0inxcl.toml). Is 2.3 GB "Game Physical" the expected size there, and istitle_memory_mbthe knob to raise it? If so, I can test a larger value.The fourth crash log is from the earlier device-lost run (game
int3after0x887a0005). It shows a different state: no mission, Game Physical 2173 / 2305 MB.game_scarlett_master-20261124-173429-15472.crash.log
game_scarlett_master-20261124-191957-31112.crash.log
game_scarlett_master-20261124-193033-25580.crash.log
game_scarlett_master-20261124-193855-5856.crash.log
report.json
xcl.log
@gabrielsteglich on GitHub · 2026-11-24 17:43 UTC · original
I'd like to take the diagnostics part of this issue. I'll add opt-in counts of the D3D12 resources and heaps XCL tracks, including resources it holds until the GPU finishes, alongside the existing activity and memory samples. I'll validate the counts with synthetic create and release cases on an RTX 3090. The goal is to show how those counts change before a loss so we can compare them with commit and VRAM usage.
@lemosss on GitHub · 2026-11-24 17:44 UTC · original
On your question about how XCL sizes the title's memory (
mainat9e3831e,crates/xcl/src/config.rsandhle/kernelx.rs; read from the code and your run-6xcl.log, not run):title_memory = "auto"takes the mode fromMicrosoftGame.config. Your log says4095 MB coherent window, and XCL picks 4095 only for "advanced" (uma_mb = 0→ 4095 for advanced, otherwise 2048). So this title runs as advanced.title_memory_mb = 0gives the Series X standard figure, 13 824 MiB, for advanced as well. That is thetotalthatTitleMemoryStatus/JobTitleMemoryStatusand the limit thatXMemGetWorkingSetStatisticsreport. "Used" is the process's private bytes. These are the only places that usetitle_memory_mb.Game Physical: …/2 305 818 624(2 199 MiB,0x89700000) is not a number XCL hands out: it matches none of 13 824, 4 095 or 2 048 MiB. It looks like the size of the game's own allocator pool, and the title installs its own XMem allocation hooks (XMem: the title has allocation hooks …at 0.381 s), so that pool is managed inside the game.title_memory_mbis the setting that changes what those functions report. Whether this game sizes its pool from it, I can't tell from the code or the log. A quick check:title_memory_mb = 16384. Then see whether theGame Physicaltotal in the next.crash.logchanges. If it stays at 2 305 818 624, the game fixes that pool size itself and raising the setting won't help with this crash.Written with Claude Code (Claude Opus 5.5).
@milesah3ad on GitHub · 2026-11-24 17:52 UTC · original
One more measurement on the stand-ins, about speed rather than memory (details and table in #156):
CreateComputePipelineStateand DXC itself get slower, about 5× and 3× at 8,000. Releasing them brings both back right away. With about 1.3k real pipelines alive in these runs, that is below where it starts on this machine, so I don't think it explains this crash.AI use: Claude Code (Claude Opus 5.5) ran the probe and wrote this. I checked it against the logs.
@packwka22 on GitHub · 2026-11-24 17:54 UTC · original
@lemosss thanks, that settles it. I ran your check with
title_memory_mb = 16384(XCL_PSO_PRELOAD=0,uma_mb = 0, no debug layer), on a build of currentmainthat already includes today's changes ("a big pipeline build the title waits for does not wait for its turn", the DRED and DirectStorage fixes, etc.).The pool size is fixed by the game. The new crash log shows the exact same total:
So
title_memory_mbdoesn't reach this pool, and raising it doesn't help. The crash is otherwise identical:game_scarlett_master.exe+0x23cf683, write to 0x0, same stack, same mission state, this time at 118.9 s (game running time 1m25s).So neither today's
mainnor the setting moves it. That's four runs in a row (with and without a reboot, cached and uncached shaders, older build and currentmain, 13.5 vs 16 GB reported title memory) where the title dies at the same point, as the story intro starts prestreaming, with its own 2.2 GB physical pool at ~96 %. If anyone can tell from+0x23cf683/+0x4e4ba89what the title is allocating there, or whether something XCL reports, e.g. through the XMem hooks, influences how much of that pool the title thinks it can use, I'm happy to test it.Attached: the new
.crash.log,report.jsonandxcl.log.game_scarlett_master-20261124-205033-25584.crash.log
report.json
xcl.log
@lemosss on GitHub · 2026-11-24 18:02 UTC · original
Thanks for running it. On your other question, whether something XCL reports changes how much of that pool the title uses: I went through what XCL hands the title that a size inside the pool could depend on (
mainat9e3831e, your run-7xcl.logandreport.json; read only, nothing run). I found nothing that points to XCL:game_scarlett_master.exe+0x4deb420/+0x4e38ec0).XMemAlloccalls them as they are (hle/kernelx.rs). XCL passes them no size or limit of its own.xg_xs.dll(XCL exports onlyXGCreateTextureComputerandXGSuggestSwizzleMode). XCL answers them from its own GFX10 layout model, whichtests/xg_oracle.rscompares with the console's library. Your log has noXGCreateTextureComputerwarning, so every call got an answer. I can't check the sizes for this title without its data.GetResourceAllocationInfo(device #25 / #108,d3d12x/device_x.rs): textures get the same XG size. Buffers, and what the model does not cover (MSAA, for one), get the PC driver's size and alignment. But this title places its buffers at addresses that are not 64 KiB-aligned (e.g.0x769d58f50in run 7), so it packs them itself rather than using the PC's 64 KiB alignment.coherent 3998/4095 MBfrom ~7 s until the crash, in run 6 and run 7. It does not grow towards the crash.So I don't see anything XCL reports that would make that 2.2 GB pool fill faster than on the console. What the title allocates at
+0x23cf683can't be told from the log alone.Read and written with Claude Code (Claude Opus 5.5).