d3d12: keep a batch's placed textures until its queue has passed it #646
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/646"
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-12-02T01:20:23Z.
Possible fix for the TCP read faults in #603. Draft: one game run with the change so far.
Change
A recorded list holds the placed textures it binds directly (
placed_reads), but not the ones its programs reach through a descriptor heap.placement::submitgathers those from the heaps' views (views.gather, viaWeak::upgrade) to back and order them, then drops them when it returns. Nothing else holds them until the GPU has run the batch. If the title releases such a texture after submitting work that reads it, the image and its tiles are destroyed while that work is still queued or running.Now each batch keeps its gathered textures until its queue's reader fence reaches the batch's tick (
waits::kept::until). Finished batches are released on the next submission. A lost device reportsu64::MAX, which releases everything.placement.rsis at its 1,200-line limit, so the logic lives inplacement/waits/kept.rs. The call replaces thenote_readersline insubmit, anduntilcallsnote_readersfirst.Why I think this is the #603 fault
Five runs on main after
e40d8052without the change all ended on a TCP read fault (MAPPING_ERROR: 0x1, vkd3d "currently mapped"), after 681–1,630 s (runs 5, 9, 10, 11, 12 in #603). In each, the fault came within 2–70 ms of a new sparse image being reserved at a VA that had just had another owner. (The "about 2 s" vkd3d prints is its device-loss time; the kernel's page-fault time, converted to vkd3d's clock, is what's within ms.)For runs 11 and 12 I logged when each unfinished draw was recorded, on vkd3d's clock:
0x60000heap)UNBIND)So in both, the work that faulted was recorded 0.6–1.7 s before the VA's owner was released, and hadn't finished. The read only faults once the VA is remapped. All of these were mesh draws;
MS 4db9a403was the most common in both, the same program @NickStallman and @DrArroway saw on an RTX 5090 and an RX 6900 XT. In run 11 I couldn't tell what the0x60000heap belonged to. I added a render-heap log for run 12, but there the previous owner was a texture, so that question is still open.Game
RX 9070 XT (
1002:7550), Mesa 26.3.1 RADV, GE-Proton11-15,TUXBOX_LAZY_PUBLICATION=0,VKD3D_CONFIG=fault,TUXBOX_TRACE_GPU_FAULT=1, drop log on.CS a8ffc289. I had that one once before without this change (run 8), so I don't think it's related. It needs its own look.2a850114+ #639 + local diagnostics), not this PR's base. Rebasing ontoca7d1bc9brings in translator changes, which would mean recompiling every shader first.What this doesn't cover
A texture released between recording and submission is already gone when
submitgathers.gatherskips it, so this change can't hold it. Whether that happens too, I can't tell yet. My diagnostic now logs each list's submit time, so a fault with this change would show it.Tests
python tuxbox.py check --no-gpu: 13 passed, 0 failed.runtime/d3d12/(python tuxbox.py check --changed): on RX 9070 XT (1002:7550), Mesa 26.3.1 RADV, GE-Proton11-15: The one failure islanes-selftest-texture-publication, which is #625 (still open). It failed the same way onmain(2a850114) without any change of mine yesterday. I didn't rerun it onca7d1bc9without this change. All other Lanes scenarios and the D3D12 regression controls pass.🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-02T05:36:32Z.
NVIDIA results for this, as asked: on an RTX 5090 with current main (
ca7d1bc9) and default settings, this change lost the device 3 of 3, each about 2.3 minutes in, at world entry (Xid 109). That's the same as main without it.With read residency off as well as lazy publication or once-per-frame checks, main was clean in 4 of 4 runs without this change. The full table is on #603.
My reading: with read residency on, the textures a batch reaches only through the heap aren't gathered, so this change can't hold them. It may well be right for the gathered case; this test can't separate that. I haven't run it with read residency off yet. I can, if a result for that arm would help.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-12-02T06:56:23Z.
On the SQC fault mentioned in the description (
CS a8ffc289): I saw an SQC fault on RDNA2 too, an instruction fetch rather than a scalar data read, from a run without this change. Details in #603: https://github.com/brcly/TuxBox/issues/603#issuecomment-7337581570Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-02T19:24:46Z.
Closing this: it doesn't prevent the #603 fault.
A second run with the same build as run 13 (
64902616, this change plus diagnostics, same settings:TUXBOX_TRACE_GPU_FAULT=1 TUXBOX_LOG_TEXTURE_DROPS=1 TUXBOX_LAZY_PUBLICATION=0 VKD3D_CONFIG=fault, RX 9070 XT) hit the usual TCP read fault after 1224 s: ring 157,MAPPING_ERROR 0x1, vkd3d "Fault address is currently mapped", the same shape as runs 5 and 9–12 on #603. Run 13's 43 minutes without it was most likely luck.That matches what I tried before opening #603: holding a dropped texture until every queue had passed it didn't stop the fault either. So keeping textures alive longer isn't the fix, and whatever the gap this PR closes is worth on its own, it isn't what causes these faults.
Pull request closed