d3d12: GPU reads a placed texture's image after it was destroyed (GPUVM ReadInvalid on ProjectScarlett, RX 9070 XT) #603
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?
Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T23:03:56Z.
On an RX 9070 XT (
1002:7550, RDNA 4, RADV, Mesa 26.3.1, GE-Proton11-15, Linux 7.3.6) I made 13 ProjectScarlett runs on main (d00006b2, later40a69c3f), most with @Jerkin42'sfix/heap-index-clampand local diagnostics. All 13 ended on a GPUVM read fault from TCP (RW: 0). WithVKD3D_CONFIG=fault, vkd3d-proton's address tracker placed the address inside the sparseVkImageof a placed texture that TuxBox had already destroyed in 8 of them: 2 to 97 seconds earlier. In the other 5, all before #389, it found no entry for the address, and the nearest allocation was a 64 KiB buffer.How I matched the fault to a texture
I added a local log line to
placement::Texture::dropwith the time on QPC, the same clock vkd3d's tracker uses, plus the texture's address, size and description. The tracker'sUNBINDtime for the faultingVkImagethen names the texture:UNBIND0xd98424000, 1024×1024, BC1, 9 mips0xded0ed000, 512×512, BC1, 8 mips0xd6c2d9d00, 16×4, R16G16B16A16_FLOAT, 1 mip0xda7dc0000, 512×512×6 cube, BC6H_UF16, 10 mipsIn 2129, 2143 and 2241 the drop is the last one before the
UNBIND(11–235 µs), and the tracker's image size fits it: 0xb0000, 0x30000 and 0x10000. In 2143 the tracker also names the image as 512×512, 8 levels, BC1. In 2303, three cube textures were dropped within 0.4 ms. This is the last of them and the largest, which fits the 2.25 MiB image best, but it is the least certain row. All areflags 0x300000placed textures that TuxBox backs with a reserved image (placement/residency.rs). Runs 2109 and 2119 showed the same use-after-free, but had no drop log. In 2241, by the time of the read a new 64 KiBVkDeviceMemoryhad been bound at the destroyed image's VA.Run 2329, on
40a69c3f(with #389) plus the clamp, ended the same way. Ten 1024×1024 textures of that size were released together there, so I can't say which one it was. The out-of-bounds reads past 64 KiB buffers that I saw before #389 didn't happen in that run (one run only).What I ruled out
queue_trace::pending_fences()passed the value it had at the drop, released by a worker thread. The fault still came, 2.3 to 2.6 s after that delayed release (2155, 2329). So the read comes from work submitted after the drop, or from a queue that isn't tracked there.RETIRE_GRACEon replaced descriptors (placement/descriptors.rs). With 60 s instead, the image was still destroyed and read 2.2 s later (2119).TUXBOX_TRACE_RASTER_INPUTS=1, I looked up which slots indiagnostics::display's view registry still named the image at drop time. For the faulting textures in 2143 and 2303, none did. Nulling every slot that did name a dropped image (2303), and nulling evicted visible slots (below), did not stop the fault.Something that looks wrong, but isn't proven to be this fault
descriptor_paging'srelease_slots→clear_host_trackingclears the tracking of an evicted table's visible slots. That releases theirDescriptorBacking::PlacedafterRETIRE_GRACE. It leaves the native descriptors in the visible heap until the slots are reused. In three runs, 2.1–2.5% of dropped placed textures still had registry slots naming them at drop time:In run 2251 that was 147 of 6957 drops, with 129 slots in the history ring, 122 in staging and 88 in the visible heap. Writing null SRVs into evicted slots (local experiment) didn't stop the faults: runs 2241, 2303 and 2329 had it on.
Open question
What still names a placed texture's image after the last
Arc<Texture>is gone, without being one of the descriptor slots above? Possible places I haven't been able to check:I tried vkd3d-proton's descriptor QA (
-Denable_descriptor_qa=true,VKD3D_CONFIG=descriptor_qa_checks). It needed a local fix in vkd3d-proton to start at all: a CPU sampler heap carries an invalid QA heap-info pointer. Its instrumented shaders then miss the driver cache, so I stopped before reaching the cutscene.Logs and the local diagnostic commits are available if useful.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T23:18:32Z.
@Kayotic1337 thanks, this is a careful trace. One change on main since your runs affects how this fault shows up.
34be158b(after40a69c3f) added a tile pool, on by default. A placed texture under 2 MiB no longer gets anID3D12Heapof its own: its reserved image maps 64 KiB tiles from shared 32 MiB heaps (placement/tile_pool.rs). When the texture drops, its tiles go back to the pool once the lastHeldcopy is gone, and the next small texture can be given them.So on main, a read after the image is destroyed may no longer fault where it did for you. If the stale read goes through a view of the destroyed image, it should still fault, because the
VkImageand its sparse binding are gone. But if it reaches the memory any other way, it now finds another live texture's data, not an unbound page. That would show as wrong texels instead of a GPUVM fault, so the pool could hide this bug, not fix it.If you rerun on current main, could you do one run with
TUXBOX_TILE_POOL=0(one heap per texture, as before) next to one with the default? If the fault goes away only with the pool on, that points to the second case. Your drop log with QPC times would still name the texture either way.We haven't reproduced this on NVIDIA (RTX 4070); our losses there are the Xid 13 in #232.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T23:19:29Z.
@Kayotic1337 thank you, this is the clearest trace of it so far. NVIDIA data points from an RTX 5090 (620.70.10, GE-Proton11-14 with a trace-built vkd3d-proton of the same commit), three losses of this shape, all before our newest main:
UNBINDbefore the lossVkImageVkImage(22 tiles)VkImage, 0xb0000 long#567(a shadow of the host descriptors TuxBox writes) named 0 ended images at 86a's loss (83a ran before it). In two later losses it named 2 and 1, whose ranges did not match the fault. In 91b/91c those were "Resident evicted" slots, like your evicted visible slots (129/122/88 in 2251), so I think we're looking at the same residue from two sides.34be158b) is fair: we'll run our next build with and withoutTUXBOX_TILE_POOL=0and report, and I'd like to run your drop log if you can share the commit.Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T23:24:46Z.
@NickStallman @brcly thanks.
Last tile: not on this card. Here is where each fault fell in the freed image, counting 64 KiB tiles from the image's start in vkd3d's tracker:
Four images were a single tile, so those say nothing about edges. Of the four with more than one tile, one fault was in the last tile and three weren't. So here the read isn't limited to a mip tail or edge tile. 2329's image is 22 tiles, like your 86a.
Drop log: it's one commit on current main,
diag/placed-texture-drop-log(b997abbf). WithTUXBOX_LOG_TEXTURE_DROPS=1andTUXBOX_LOG=1,Texture::droplogsplaced texture dropped at <QPC s>: address … size … WxHxD format … mips … flags …. The time is on the clock vkd3d's tracker prints, so the drop right before a faulting image'sUNBINDnames the texture. It logs every drop, 7,000–16,000 per run here.Tile pool: I'll do the two runs on current main as brcly suggested:
TUXBOX_TILE_POOL=0and the default, both withVKD3D_CONFIG=faultand the drop log. I'll post both.Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T23:54:55Z.
@brcly @NickStallman the two runs, on main
2104bfcfplus the drop log (b997abbf) and the clamp,VKD3D_CONFIG=fault, otherwise the same settings as before. One run each.TUXBOX_TILE_POOL=0DEVICE_LOST, nothing in the kernel log)0x0050113Bgame_scarlett_master.exe+0x4DA6315, +0x794894)DEVICE_LOSTWith the pool on, the fault is the same use-after-free, and the drop log names the texture again:
0xdfbf68000, 512×256, BC1, 7 mips, dropped at 25038.608661 s;UNBINDof that sparse image followed at 25038.608671 s, and the tracker names it as 512×256, 7 levels, BC1;So with the pool on, the stale read still goes through a view of the destroyed image and still faults, as you expected.
With the pool off I can't draw a conclusion from one run. It didn't fault on the GPU, but it ended on a CPU access violation in the title. That may simply have come before the use-after-free could happen. I can repeat both if that helps.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T01:50:10Z.
@Kayotic1337 a possible pointer for your pool-off run, not a finding: its CPU access violation is at
+0x4DA6315, the same offset @DrArroway gives in #608 (opened today,0x80000003at+0x4DA6315/+0x9DFC18, streaming placement underTUXBOX_XMEM_PRIVATE_VIEWS=1). Your second frame differs (+0x794894) and so does the exception, so it may be unrelated. If that run had private views on, #608 might change how it ends. Our own pool-on and pool-off pair on the 5090 (default views, no private views) is running now; I'll post both.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T01:57:24Z.
The pair on an RTX 5090 (620.70.10, GE-Proton11-15 and its own vkd3d-proton), one run of each, 20 minutes, main
82109205in an integration build with the clamp, #572 with its stride fix and your drop log (b997abbf), thanks. The only difference isTUXBOX_TILE_POOL(0 confirmed in the run manifest of the second).TUXBOX_TILE_POOL=0TUXBOX_XMEM_PRIVATE_VIEWS).Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-12-01T05:35:36Z.
The same fault on RDNA2, from one run last night with
RADV_DEBUG=hang. RADV's hang report also names the pipeline that read the destroyed image.Setup: RX 6600 (
1002:73ff, 8 GB, RDNA2), Mesa 26.3.1 RADV, GE-Proton11-15, mainee38dcf0, Series S profile,TUXBOX_XMEM_PRIVATE_VIEWS=1. That build is before #389 and before the tile pool (34be158b). WithRADV_DEBUG=hang(it includessyncshaders), the run still reached the world: mission at frame 1,191, device lost at frame 1,199, 756 s.Fault (
vm_fault.log): page0x800299c41000,GCVM_L2_PROTECTION_FAULT_STATUS 0x701031, TCP,PERMISSION_FAULTS 3,MAPPING_ERROR 0,RW 0. RADV's address binding check reports "Potential use-after-free". The range had these events:0x800299c40000–0x800299c70000(sparseVkImage, 0x30000)0x800299c40000–0x800299c500000x800299c40000–0x800299c70000Pipeline: a graphics pipeline, vkd3d hash
bb6974b27dcaa748, NGG vertex stage and a pixel stage. The dumped SPIR-V names its DXIL asc9595851250afba4.dxil(vertex) andc38906d24755082e.dxil(pixel). Matched against the runtime cache by vkd3d-proton's hash of the.csofiles, these areVS 281b4977andPS 96e8aaaa. That is the distant-lights pair that @3kynox, @TheLore64 and @DrArroway saw in their losses (#533, #232). So at least one "distant-lights" loss is this use-after-free: the draw reads a placed texture whose sparse image TuxBox had destroyed. It was not an out-of-bounds read past a root descriptor.For anyone without a trace build of vkd3d-proton:
RADV_DEBUG=hanggives the binding history and the faulting pipeline's SPIR-V on a stock Proton build. The dump goes to~/radv_dumps_*. It slows every frame, but on this card it still reached the world.Next on this card: current main (
717a74c4, with #389 and the tile pool), Series S. If it faults again, I'll do aTUXBOX_TILE_POOL=0pair as brcly asked, and repeatRADV_DEBUG=hangon the faulting setting. I can share the SPIR-V of both stages and the hang report (about 40 MB) if they help.Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-12-01T07:19:43Z.
A first data point from current main on the RX 6600 (
1002:73ff, RDNA2, Mesa 26.3.1, GE-Proton11-15, Series S), main717a74c4, so with the tile pool on and #389 in. One run with default settings.vkd3d_queuefaulted on two adjacent host pages,0x800602d14000(6 reports) and0x800602d15000(4). TCP read,GCVM_L2_PROTECTION_FAULT_STATUS 0x00501031,PERMISSION_FAULTS 3. That's the same shape as the fault I posted above fromee38dcf0, there at offset 0x1000 of a destroyed 0x30000 image. This run had noRADV_DEBUG=hang, so I can't show the binding history for it yet.TUXBOX_XMEM_PRIVATE_VIEWS=1on the same build had no GPU fault (one run).Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-01T15:14:24Z.
@1093i3511 @Kayotic1337 thanks for the RDNA2 data, and for the RADV binding history: a read of an image TuxBox already destroyed, on RDNA2 as on RDNA4.
Today's main changes when placed textures get memory, so it's worth a run on it before going further (after
e40d8052, default settings):56627188).None of these is aimed at a use after destroy, and I don't expect them to fix it. But they change the backing and timing enough that the fault may move, or show more clearly. If it still reproduces, the run with
RADV_DEBUG=hangand its binding history would be the one to post.Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-01T20:19:29Z.
@brcly two runs on current main after
e40d8052, RX 9070 XT (1002:7550), Mesa 26.3.1 RADV, GE-Proton11-15 with its own vkd3d-proton. The use-after-free is still there in the normal run; the second run, withRADV_DEBUG=hang, didn't fault.Build: main
712fb960+ #630, plus the drop log (b997abbf). Settings: defaults, tile pool on,VKD3D_CONFIG=fault, with one exception. With the full defaults, all three runs I made with #630 stopped at the first indirect dispatch with the CS rejection from #634 (details there), before the world. Both runs below haveTUXBOX_LAZY_PUBLICATION=0; read residency and check-once-per-frame stay on.Run 1: defaults
Result: 807 s, then a GPUVM fault and device lost. TCP read,
GCVM_L2_PROTECTION_FAULT_STATUS 0x0070113B,PERMISSION_FAULTS 3, at0x800366722000.vkd3d's address history for that page, with the drop log:
VkImagereserved,0x700000x99784c000512x1024 BC1 (DXGI 71), 8 mips, size0x570000x30000, reserved at the same VA (no tile bound to it yet)0x2000, in tile 0 of 7RADV_DEBUG=hang, so I can't name the pipeline.Run 2: same, plus
RADV_DEBUG=hangSame build and settings, plus
RADV_DEBUG=hang(with a separate Mesa cache dir). No fault in 2,577 s (43 min): nothing in the kernel log, no vkd3d fault report, no device lost, no RADV dump. I stopped it myself. 75,823 placed texture drops were logged, against 22,250 before run 1's fault. It also got the furthest of any run here: into the playable prison section, where an NPC could be interacted with, though most near surfaces drew black or as noise.RADV_DEBUG=hangturns onsyncshaders(Mesa's hang-debugging notes), which waits for the GPU after every draw and dispatch. A read that races the image's destruction may simply not happen with it on, so I read this run as consistent with a timing race. It doesn't show that the bug is gone, and it couldn't name the pipeline this time.Memory
From TuxBox's memory ledger, with times taken from the 10 s present lines (RX 9070 XT with 16 GB; host with 64 GB RAM):
RADV_DEBUG=hang): process commitRADV_DEBUG=hang, not TuxBox. Run 2's commit is about three times run 1's at 6 min (16.3 against 5.6 GiB), before the world loads. Without it, run 1 reached 12.2 GiB. I didn't sample the host in run 1.Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-12-01T20:54:32Z.
RX 6600 (
1002:73ff, RDNA2, 8 GB), Mesa 26.3.1 RADV, GE-Proton11-15, aftere40d8052. Build:fb17e160with #519 reverted locally (instead of #630, so it gets past the slot 133 assert). All runs withTUXBOX_LAZY_PUBLICATION=0(#634); the first three also withTUXBOX_READ_RESIDENCY=0.0x0000800265604000, status0x00501030/0x00501031; gfx ring timeout, reset failed, MODE10x00008003cc662000, status0x00501030/0x00501031; ring reset succeeded0x000080021cc04000, status0x00501030; reset failed, MODE1TUXBOX_RUNTIME_SHADER_JOBS=3 TUXBOX_LARGE_COMPILES=2, read residency still offAll three faults are
PERMISSION_FAULTS 0x3, client TCP, a read, from thevkd3d_queuethread: the same family as my dump earlier on this issue. So on this card the fault hasn't moved with today's main. Two of the three failed ring resets took the desktop with them, which is why there is noRADV_DEBUG=hangrepeat yet; I have the kernel devcoredumps of runs 1 and 3 if they help.Run 4 is one fault-free run, not a pattern. It had fewer compiles running beside the game; Kayotic1337's
RADV_DEBUG=hangrun, which serialises GPU work, didn't fault either. So timing may matter.Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-01T20:57:41Z.
One more run on the RX 9070 XT, and a correction to the memory figures in my last comment.
Run 3: same build and settings as run 1 above (main
712fb960+ #630 + drop log, defaults,TUXBOX_LAZY_PUBLICATION=0,VKD3D_CONFIG=fault), noRADV_DEBUG. No fault in 1,521 s (25 min): nothing in the kernel log and no vkd3d fault report. I stopped it myself. 56,565 placed texture drops were logged, against 22,250 before run 1's fault.On shader compiles during play: run 1 compiled 655 (120–180 a minute from 19:09 to 19:12 UTC, the last ones seconds before the fault at 19:14:22), run 2 compiled 243 and run 3 only 11. That looked like support for @1093i3511's point that timing may matter (their run 4, with
TUXBOX_RUNTIME_SHADER_JOBS=3 TUXBOX_LARGE_COMPILES=2, didn't fault). But compile load isn't needed for the fault: my seven use-after-free runs on 30 Nov and 1 Dec (older main, beforee40d8052) compiled no shaders during play, and still faulted after 6–8 minutes. So I can't say what made runs 2 and 3 clean. On today's main it's 1 fault in 3 runs here.Memory, corrected. As I guessed, most of run 2's host memory came from
RADV_DEBUG=hangitself. Run 3, sampled every 10 s from the start, in the world (12–25 min):Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-01T21:34:13Z.
Opened #639: an optional PR with the drop log I've been using here (
TUXBOX_LOG_TEXTURE_DROPS=1; an earlier copy isb997abbf). It logs each released placed texture with its time on vkd3d's clock, so anyone chasing this fault can tie it to a texture the same way. It doesn't change behaviour.Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-12-01T21:37:07Z.
Follow-up: a
RADV_DEBUG=hangrepeat of run 2 (packaged, the one that faulted at 430 s) ran 1,630 s into the world without a fault, like Kayotic1337's hang run on RDNA4. It ended on the title's watchdog after host memory ran out, not on the GPU. One caveat for the comparison: with RADV waiting after every submission, compiles were slow enough that the overlay showed about 730 empty stand-in pipelines (28-31 in the other runs), so less GPU work ran than in run 2.Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-01T23:15:32Z.
@brcly a correction to my comment above, and two more runs that point somewhere else.
Correction: I opened that comment with "the use-after-free is still there". That was stronger than the run showed. Since
e40d8052I haven't seen the shape this issue describes, a read of an address that only a destroyed image had. In all three TCP faults I've had since, the address belonged to a live image that had just been reserved.The three faults
RX 9070 XT, main after
e40d8052,TUXBOX_LAZY_PUBLICATION=0,VKD3D_CONFIG=fault, drop log on. Run 5 is the one above (712fb960+ #630); runs 9 and 10 are on2a850114+ #639.One thing first: the time vkd3d prints with the fault is when it noticed the device loss, which here was the gfx ring timeout, about 2 s after the fault. The kernel logs the page fault itself. Its timestamps run on
CLOCK_MONOTONICand vkd3d's on QPC (CLOCK_MONOTONIC_RAWunder Wine), about 10 ppm apart on this machine (0.21 s after 5.8 h of uptime). Corrected for that, the ring timeout lands within 3 ms before vkd3d'sDEVICE_LOSTin runs 9 and 10, so the times below are on vkd3d's clock and good to a few ms.0xebeff4000, 9 mips), destroyed 20974.382 sVkImagereserved at the VA0x30000, 6729.841 s0x30000, 19961.807 s0xb0000, 20974.440 s0x20000x20000x4000All three are TCP reads (
RW: 0,MAPPING_ERROR: 0x1), and vkd3d says "currently mapped" each time.So in 3 of 3 the fault comes within milliseconds of a new placed-texture image being reserved at that VA, before any tile is bound to it. Run 9 is the clearest: the earlier owner had been gone for 48 s, and the VA had nothing mapped in that time. A read of the old content in that window would have faulted then, not 15 ms after the reservation. In run 10 the old image was destroyed 62 ms before the fault, so on its own that run can't tell the two apart.
That makes me think a draw reads the new texture's image before its tiles are bound. I haven't checked in
placement/residency.rswhen the first tiles of a reserved image are bound, or what can reach the image before that.What was running
Both newer runs had
TUXBOX_TRACE_GPU_FAULT=1. Each reported 15 draws started and not finished, all mesh draws in one list. One pipeline is in both:b374992aMS4db9a403ec60ebf6MS144764f503bb6d31MS8ff74fc0f3d66f7bMS44638b1a39918babMS4dfd380b8593c32fMSe3e80f761b227abbMSe5972aa27740adb9/3cd8734cMSc767b670, PS749581e4MS840087a3, PS5a4007aaMSf8bb5ad7, PS1281b254MS9b0bdf4eBoth reports came from the trace's device-loss check, which I had changed locally to poll every 250 ms instead of every second (and its quiet window from 8 s to 2 s). In run 8, with the defaults, there was no report at all. The log ends 62 ms after vkd3d marked the device lost, between two of the 1 s polls, and the 8 s quiet window hadn't ended. The submit-path flush from #424 didn't fire either: vkd3d's own submission thread got the error, and TuxBox's call didn't.
Logs, the kernel dumps and the local diagnostic commit are available.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T23:19:33Z.
Matching data from an RTX 5090 (
10de:2b85, driver 620.70.10, GE-Proton11-15), main-23 (712fb960-era main + our then-open PRs),TUXBOX_TRACE_GPU_FAULT=1,VKD3D_CONFIG=fault. NVIDIA gives no data address for these (Xid 13, "Graphics SM Warp Exception … MMU Fault"), so I can't tie them to a VA. But the draws in flight overlap yours:b91b86fc(17), MS91b16a4f(12), MS84798173(6), MS4db9a403(6), MS0bc3511b(2)TUXBOX_LAZY_PUBLICATION=0)9e6ae248(15), MS4db9a403(13), MSe3e80f76(3), MS3a1f39d1(2)0e904b85(18), MSea7e5195(2), plus particle VS/PS5f6ec27e(7), MSef79b57e(4)What we ruled out on this card:
So your "read of a just-reserved image before any tile is bound" fits our losses too: the read is in range of a valid descriptor, which is why none of those checks saw it. We're now reading when a reserved image's first tiles are bound against when a descriptor or draw can reach it, and will report what we find.
Separately, there's a second family here: Xid 109 hangs with only one ray-traced shadow dispatch unfinished. That looks unrelated.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-12-01T23:48:40Z.
Matching RDNA2 data on
AMD Radeon RX 6900 XT (1002:73bf)(Mesa26.3.1-5RADV, kernel7.3.7-1-cachyos,GE-Proton11-15, buildcb4631ba=b279360a+ #640,TUXBOX_LAZY_PUBLICATION=1,TUXBOX_TRACE_GPU_FAULT=1):1,733.9s(14,454presents — past intro & cinematic into prison gameplay),0-EPERMCS rejections,64+clean lazy-publication recoveries.memory ledger: card 13819/15530 MiB, adapter system memory 2952/31555 MiB, upload staging 0 MiB, title pages 7131 MiB, process commit 12015 MiBtexture ledger: unbacked 18273 (3729 MiB), card 6395 (4240 MiB) (title ranges 4573 MiB, 4095 MiB distinct), system 0 (0 MiB), committed 3064 (2 MiB)journalctl -k):[gfxhub] page fault,TCP (0x8),PERMISSION_FAULTS: 0x3,MAPPING_ERROR: 0x0,RW: 0x0(read) on pages0x000080051ada0000–0x000080051ada2000, followed byring gfx_0.1.0 timeout→MODE1reset →VK_ERROR_DEVICE_LOST.TUXBOX_TRACE_GPU_FAULT=1):9commands started and not finished of2,973,180recorded, all mesh draws on command list0x76433480— overlapping directly with@Kayotic1337's RDNA4 runs 9–10 (PS b374992a / MS 4db9a403andPS 39918bab / MS 4dfd380b) and@NickStallman's RTX 5090 runs139r2/140l2(MS 4db9a403):PS b374992a/MS 4db9a403: 5 draws (#2965817,#2965827,#2965838,#2965865,#2965877)PS 39918bab/MS 4dfd380b: 3 draws (#2965811,#2965856,#2965872)PS 3ec2480e/MS 4e23ed80: 1 draw (#2965882)Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-02T00:56:49Z.
A measurement that fits your "read before its tiles are bound" finding, from the RTX 5090 (
10de:2b85, 620.70.10, GE-Proton11-15). The run used current main (ca7d1bc9: #623, #640, #644, #639 and #645 in) plus two local diagnostics, and default settings (read residency on, lazy publication on).The diagnostic. When
Transfer::backmaps tiles of a reserved placed texture on the provider's upload queue, it checks whether that texture is being read by GPU work not yet finished. It counts two cases: a batch that recorded a read of it whose fence hasn't completed, or a read through the heap in the last 3 frames.Result. The device was lost about 8 minutes into the story (Xid 13, SM MMU fault). By then the check had fired more than 4,096 times (it logs at powers of two), for example:
So tile mappings of reserved textures routinely change while the same frame's draws read those textures through the heap. Nothing orders the upload queue's
UpdateTileMappingsafter those reads. As I read the Vulkan spec, changing a sparse binding while another queue accesses the same region is undefined.What was in flight at the loss. 129 unfinished commands, the mesh draws you saw: MS
4db9a403(23), MS44638b1a(10), MS4dfd380b(4), MS86410da3(3). The provider's own readbacks and one upload were pending behind them, which is consistent with a stuck guest batch rather than a fault in our copies.Where it comes from. With read residency, a texture reached only through the heap isn't gathered for the batch that first reads it (
read_residency.rssays that read "finds the image unbacked"). The next submit maps its tiles on the upload queue while the earlier batch may still be reading it.The mapping should wait until the batches that may read the texture have finished. A cheaper alternative: map every tile of a new reserved image to a shared zero tile at reservation, so there is never a NULL-to-tile transition under a read. We're working on a change along those lines and will post it with A/B numbers.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-02T01:28:38Z.
@NickStallman thanks, I missed this before opening #646. I think we're looking at two sides of the same thing: a sparse image's binding changing while work that reads it is still queued or running.
Mine looks like the destroy side, not the mapping side. In all five faults (runs 5 and 9–12 above), vkd3d's history for the faulting page has no
BIND SPARSEafter the new reservation. What it has is the previous owner released and a new image reserved at the same VA, with the fault within milliseconds of that reservation. In runs 11 and 12 the unfinished draws were recorded 0.6–1.7 s before the previous owner was released. That fits an image destroyed under a read better than a tile mapped under one.#646 doesn't cover your case, and only part of mine. It holds the textures
submitgathers until the batch's fence passes. Read residency is on in my runs too, so a heap texture it leaves out of the batch isn't held, and can still be destroyed while that batch reads it. The same gap you describe for mapping.So I don't think the two changes exclude each other. A zero tile at reservation would stop NULL-to-tile under a read, but not a destroy and VA reuse under one, as far as I can tell. #646 does the reverse, for gathered textures only. If you post A/B numbers, a run with both would show whether anything is left.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-02T05:36:31Z.
An A/B on the RTX 5090 (
10de:2b85, 620.70.10, GE-Proton11-15). It points at the defaultse40d8052turned on, and at no single one of them.All runs on current main (
ca7d1bc9) used the same warm caches and the same scripted start presses, which reach gameplay about 2 minutes after launch. Each run was 8-20 minutes of play. "Lost" means a device loss: Xid 13 SM MMU fault, Xid 109 context-switch timeout, or occasionally Xid 32 on a copy engine. Almost all of them came at or just after the cutscene-to-gameplay switch.TUXBOX_READ_RESIDENCY=0onlyTUXBOX_LAZY_PUBLICATION=0onlyTUXBOX_CHECK_ONCE_PER_FRAME=0onlyLAZY_PUBLICATION=0+CHECK_ONCE_PER_FRAME=0(read residency on)READ_RESIDENCY=0+LAZY_PUBLICATION=0READ_RESIDENCY=0+CHECK_ONCE_PER_FRAME=0=043a1fd5don717a74c4(beforee40d8052), cold, same day and conditionsSo on this card the losses need read residency on, plus lazy publication or once-per-frame checks on. Turning off read residency and either one of the others was clean in 4 of 4 runs, and anything less lost.
The counts are small. Two clean runs per pair against about 20 losses for the defaults is a strong contrast, but not a rate.
That fits what this issue describes. With read residency, a texture reached only through the heap isn't gathered for the batch that first reads it, so it is neither backed nor held for that batch. It is then bound, or released and its VA reused, while that batch may still read it. #646 holds only gathered textures, which would explain why it doesn't help here with read residency on. The other two switches change when textures are published and checked, which plausibly widens the window. That part is a guess.
For anyone else hitting this on NVIDIA,
TUXBOX_READ_RESIDENCY=0 TUXBOX_LAZY_PUBLICATION=0is a workaround that runs reliably here, at the cost of more texture memory.🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-02T06:24:19Z.
A correction to the workaround in my last comment.
The clean pair runs in that table all had
VKD3D_CONFIG=faultset, along with two TuxBox diagnostics. Isolated on the same build and settings (TUXBOX_READ_RESIDENCY=0 TUXBOX_LAZY_PUBLICATION=0, ntsync on, 8 minutes each):VKD3D_CONFIG=fault(alone, or with the diagnostics)TUXBOX_TRACE_GPU_FAULT=1onlySo on the 5090 the configuration that holds is
TUXBOX_READ_RESIDENCY=0 TUXBOX_LAZY_PUBLICATION=0 VKD3D_CONFIG=fault. The two switches alone are not enough. With read residency on,VKD3D_CONFIG=faultdoesn't help either: the default-settings runs in the earlier table had it set and still lost.That vkd3d's fault mode changes the outcome suggests the losses depend on something it alters, such as device-fault or address-binding tracking that changes when memory or VA ranges are released or reused. We're reading vkd3d-proton's source to find which, and will report back.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-12-02T06:56:21Z.
@Kayotic1337 a second data point for the SQC fault you mention in #646, from RDNA2. It isn't the same signature as yours, so it may be a separate problem.
RX 6600 (
1002:73ff), Mesa 26.3.1 RADV, GE-Proton11-15, Series S profile, default settings (read residency and lazy publication on). Build: main2a850114+ #640 + the #625 fix (now #647).[gfxhub]clientSQC (inst), status0x004012B1,PERMISSION_FAULTS: 0xb,RW: 0x00x00000700137ff000and0x00003f00137ff000, threadvkd3d_queue, compute ringVK_ERROR_DEVICE_LOSTCS a8ffc289. Mine is an instruction fetch. Its two addresses share their low bits (…137ff000) and differ only in the high part.TUXBOX_TRACE_GPU_FAULTon, so I can't name the dispatch.3e2839b1without the #625 change ended after 446 s on the usual TCP read fault, with no SQC fault. So I can't tie it to either change.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-02T12:12:59Z.
A narrower result on the RTX 5090: the losses that need read residency come from the read notes the translation adds to shaders, not from read residency's runtime residency.
Setup. All runs are on
6d4f1cd7-era main with two local diagnostic switches,TUXBOX_LAZY_PUBLICATION=0andVKD3D_CONFIG=fault(which removed the other part of the losses earlier). Runs were 8-30 minutes.TUXBOX_DIAG_NO_NARROW=1: read residency stays on, but every heap-read texture is gathered, so nothing is left out or read unbacked.TUXBOX_DIAG_NO_HEAP_NOTES: the translator emits notb_note_heap_read(=1), or also leaves the bitmap root UAV out of the root (=root).tb_note_heap_readat each image heap bindSo keeping the UAV in the root is harmless here. What brings the losses back is the read notes themselves: the
LoadplusInterlockedOrinto the bitmap at each image heap bind, which now sits in every heap-indexing program, pixel shaders included.Statically the writes look bounded and safe: the slot is clamped, the bit is under 2^20, and the buffer is bound and held. I don't have a mechanism yet. The candidates we're looking at:
We'll follow up with one of these tested, or a way to collect reads that keeps the notes out of the shaders.
(The early-exit regression since
9c3cf86fis a separate thing, reported on #533.)🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-02T16:43:17Z.
A correction to my comment about the read notes. A review of all our runs showed that the clean results in the "no notes" arms came mostly from cold first runs. Those take a different start-up timeline, and cold runs here never show the world-entry hang. Counting warm runs only, the arms are 0/2 (normal), 1/1, 2/5, 0/1 and 1/2, and no pair is distinguishable.
What the data does support on the RTX 5090:
LAZY_PUBLICATION=0andVKD3D_CONFIG=fault, warm runs were 9/11 clean with it off and 0/5 with it on.There also seem to be two separate failures here, which our earlier tables pooled:
e40d8052at roughly 20%, and close to 100% on current defaults.We're re-running the comparisons warm, interleaved and with more runs per arm, and will post those numbers instead.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-02T19:28:11Z.
Run 14 (RX 9070 XT, the run 13 build with #646, same settings as runs 9–13) ended on the TCP read fault after 1224 s, so #646 is closed. Its timeline doesn't fit my "image destroyed under a read" reading from earlier in this thread. It fits @NickStallman's read of a newly reserved image before its tiles are bound better.
Fault: TCP read, ring 157,
MAPPING_ERROR 0x1,WALKER_ERROR 0x5, VA0x8004ae9d5000, which is offset0x5000of the range below. vkd3d: "Fault address is currently mapped". The devcoredump names the same page.vkd3d's history for that VA (QPC seconds):
0x30000reserved0x10000reserved0x160000reserved0x10000reserved. No tile bind follows in the historyDEVICE_LOST)What was in flight: 65 commands started and not finished, 48 of them printed. They are all mesh draws in one list (
0x766c7ec0): 36× PSf025a107/MS83a29e9fand 12× PS927f7231/MSf1e47dde. Every printed draw was recorded at 14408.078 and submitted at 14408.703. That is 56 s after the previous owner was destroyed and 0.24 s before the new image was reserved. Null root views: 0. Unset root descriptors: 0.What this changes:
4db9a403. That shader is in runs 9, 10 and 12 but not here.Logs and the devcoredump are available.
Imported from brcly/TuxBox. Originally posted by 3kynox on 2026-12-03T17:06:37Z.
@Kayotic1337 @NickStallman one measurement that may help here, from my RTX 4070 Ti SUPER with the console structures on and a local diagnostic. In four of the five losses where I could tell which heap slot the lost program was reading, the title had rewritten that slot 0.12 to 7 s after the provider took the submission, to an image made after it. The faulting page was in another image, which had already ended, so I can't say it's the same fault.
A question for the AMD side, which I can't test on my card: could a reserved image created after a submit have no page-table entries at all until the work already in flight is done, because amdgpu runs a process's page-table updates behind it? I've read that it can, and I haven't checked it in the kernel source. It would fit the 2–72 ms. A zero tile bound at reservation would then come too late as well, and images reserved ahead of time might not.