d3d12: guest-memory BLAS eviction and unmapped guest-pool instances cause RADV GPUVM faults after #394 #403
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 DrArroway on 2026-11-28T16:02:07Z.
Environment
1002:73bf, RADV NAVI21, Mesa 26.3.1, Linux 7.3.6)vkd3d-proton), 3840x2160e380da1and567bd04(both tested with open PRs#373,#389,#393applied)Summary
Once
#394enabled BLAS rehydration in ProjectScarlett (484–489rehydrated BLASes,0skipped,~256 MiBprivate storage), RADV hits repeatable GPUVM page faults (GPU reset) shortly after entering the 3D world and loggingAS source ... was given new storage after a list recorded it.We observed two distinct BLAS guest-memory lifetime/fixup causes (plus two related notes below):
1. Raw guest VA leaked into TLAS instance descriptors (
PERMISSION_FAULTS: 0x3, RW: 0x0)On
e380da1(Run 3, 286.6s), right after:RADV faulted directly on the raw Xbox guest VA:
Root cause:
runtime/d3d12/src/device/blas/guest_memory.rs, overwriting an overlapping BLAS range removes overwritten neighbours frommappings.addressesat recording time (before earlier-recorded TLAS lists submit).runtime/d3d12/src/device/blas/instance_fixup.hlsl(and the upload path inbuild_raytracing.rs), if a TLAS instance'sAccelerationStructureaddress is not found inrelocated, it is left unchanged as the raw Xbox guest VA instead of being zeroed to0(inactive DXR instance).tools/reference/blas/guest.cpp), so zeroing needs to be restricted to registered guest-pool ranges (minus any registered nativeKind::Structurebuffers).2. Replaced / overwritten BLAS private storage dropped while in-flight TLASes still traverse it (
PERMISSION_FAULTS: 0x3, RW: 0x0)On
e380da1(Run 1, 245.6s), right afterAS source 0x1799c6100..0x179df5000 was given new storage after a list recorded it (#1..#7), RADV faulted across freed host VAs in the BLAS private-storage range (0x8005ab06e000,0x8005cd09d000,GPU reset).Root cause & prototype finding:
guest_memory.rscurrently dropsevicted: Vec<ID3D12Resource>on the CPU immediately when recording a replacing/overlapping build.567bd04that:Kind::Structurebuffers) to0ininstance_fixup.hlsland upload fixup, andID3D12Resources behindqueue_tracepending fences + a 5-second grace period.0x1745...) and survivedAS source #1..#8across multiple 3D frames, but still hit freed BLAS host-VA reads on a second run (0x80078e54a000,0x8007905eb000,0x800788431000,0x8007af05d000— same0x8007...range asAS source #1..#50xffff8007bbf60000..0xffff8007bc020000,PERMISSION_FAULTS: 0x3, RW: 0x0).placed texture readbackbatches), so a short grace period +pending_fences()captured at overwrite time misses command lists still being recorded and later frames still tracing an already-built TLAS.Instances::prepareoverwrites its previous submission's retained snapshot on re-submission, dropping old BLAS references on the CPU while an earlier TLAS build or ray trace using them is still in flight. Keeping each BLAS snapshot bound to the built TLAS until that TLAS is rebuilt and all queues have drained past the rebuild should close this gap.Related observations from the same runs
PERMISSION_FAULTS: 0x4, RW: 0x1): On the longer prototype run (430.5s, game frame 2095,AS source #1..#8crossed without any0x3read fault), RADV hit a write permission fault across0x8001d0ee3000–0x8001d3ed6000(Faulty UTCL2 client ID: TCP (0x8),PERMISSION_FAULTS: 0x4,RW: 0x1,ring comp_1.0.1timeout). A similar0x4 / RW: 0x1fault (0x8005cd09d000,ring comp_1.3.0) also appeared alongside the0x3read fault ine380da1Run 1.TUXBOX_TRACE_GPU_FAULT=1(0a97a05) on fast aborts: In the traced run,GPU fault trace: marking every draw and dispatchinitialized cleanly, but no unfinished command list was printed afterVK_ERROR_DEVICE_LOSTbecause the title hitplaced texture publication failed: HRESULT(0x80004005)→ BreakpadEXCEPTION_BREAKPOINTand exited within ~1s, racing the watcher thread's 1ssleeploop. Triggeringgpu_trace::report()synchronously whend3d12_xsobservesDXGI_ERROR_DEVICE_REMOVED/ queue submission failure would ensure fast aborts still dump the ring.Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-28T16:49:27Z.
Follow-up: TLAS-bound BLAS lifetime + exact
build_asGPU fault traceTested an updated prototype on
567bd04(+#373,#389,#393) on RX 6900 XT (RADV NAVI21, Mesa 26.3.1, GE-Proton11-14) with:Arc<[ID3D12Resource]>) until that TLAS is rebuilt/cleared/destroyed, retiring superseded snapshots behindqueue_tracepending fences + a 30s grace window.gpu_traceflush onUINT64_MAXfence / device-removed queue errors, plusgpu_trace::aroundmarkers on all 6 raytracing commands (build_as,rehydrate_as,copy_as,copy_as_deserialize,postbuild_as,instance_fixup,dispatch_rays).Results across 3 runs
exit code 0), 17 consecutive 3D world frames (11s–22s/frame), past488+BLAS rehydrations (0skipped),513 MiBprivate BLAS storage, andAS source #1..#16— 0 GPUVM faults, 0 GPU resets.312.6son0x8007bcfff000(ring:24,TCP,PERMISSION_FAULTS: 0x3, RW: 0x0) with 0 draws/dispatches unfinished and 0 BLAS resources reaped (elapsed< 30s), showing the remaining intermittent fault was inside an unmarked raytracing operation.TUXBOX_TRACE_GPU_FAULT=1): Crossed 8 consecutive 3D world frames (475+BLAS rehydrations,512 MiBprivate storage,AS source #1..#8), then at343.2shit0x8007c63eb000–0x8007c63fc000(ring:24,TCP,PERMISSION_FAULTS: 0x3, RW: 0x0). The synchronous trace pinpointed 1 single unfinished command out of 107,772:Takeaways
#394freed-BLAS / raw-guest-VA UAFs (allowing 9-minute fault-free 3D runs).build_as type=1 count=6,native_dst == src == 0xffff800788000000), reading unmapped pages0x8007c63eb000–0x8007c63fc000(RW: 0x0) — pointing either to one of the 6 geometry inputs (VertexBuffer/IndexBufferinbuild_raytracing/guest_addresses.rsreading past its imported buffer span) or aPERFORM_UPDATEmismatch on a relocated/rehydrated BLAS.scratch=0xffff8001d003b200lies in the same0x8001d0...VA region as the earlierPERMISSION_FAULTS: 0x4, RW: 0x1compute write fault (0x8001d0ee3000–0x8001d3ed6000).gpu_traceflushing onUINT64_MAX/ removed-device errors + marking raytracing commands madeTUXBOX_TRACE_GPU_FAULT=1capture fast Breakpad aborts cleanly.Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T18:32:19Z.
The same faults happen on RDNA2 with a smaller card, on current
mainwithout extra PRs. Details are on #232 and #292.Setup: RX 6600 (
1002:73ff, NAVI23, 8 GB), Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14.main2af42c9with no open PRs applied,TUXBOX_TRACE_GPU_FAULT=1.Two runs, 35 and 7.4 min long. Both went the same way: 476 and 487 BLASes rehydrated, 0 skipped, then 7 and 8
AS source … was given new storage after a list recorded it, then a fault 10–20 s later. Each run also logged oneAttempted to place TLAS on VA … previously used by non-TLAS, marking mutated.The faulting pages are raw guest addresses, like your first cause:
Run 1's
AS sourcelines included0x179dac100 … the address now resolves to 0x179dac100, an address that resolves to itself. That fits a guest address left unresolved in an instance.Two things that differ from your 6900 XT:
Ring comp_1.1.1 reset failed, thencomp_1.3.0in run 2). Then the kernel does a MODE1 reset (VRAM is lost due to GPU reset!), which also takes down the Wayland compositor. If your resets recovered on their own, an 8 GB card makes this worse.VK_ERROR_DEVICE_LOST, because the compositor and Xwayland went away. So a report flushed when the device is lost, as in your follow-up, would help here too.I didn't see a
PERMISSION_FAULTS: 0x4, RW: 0x1write fault in either run.If you push the prototype from your follow-up (TLAS-pinned BLAS snapshots, the synchronous trace flush, marked raytracing commands), I can run it on this card. A branch on top of
mainwould be easiest.Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T19:20:58Z.
A third run on the RX 6600, same build (
main2af42c9, no extra PRs,TUXBOX_TRACE_GPU_FAULT=1), after an update tolinux-firmware-amdgpu20261124 and a reboot (MEC firmware0x86, PFP0x6d, ME0x40). This time the fault was on your second cause, and the title rendered the opening world scene first.Two world frames
The world was on screen twice before the fault, at 20:04:06 and 20:04:29; I took a screenshot of each. The fault came at 20:04:34. Frames took 26–31 s (
presented 1 frames in 28s, 6,152 frames in total), and the run lasted 422 s.Both frames show the night skyline past a fence and an overhang that PROJECTSCARLETT.md describes. They are very dark and blocky. The first has only edge outlines on most geometry. I haven't checked how much of this comes from missing shaders or stand-ins.
The fault: host addresses this time, not raw guest VAs
The amdgpu devcoredump for the ring timeout gives the first faulting page as
0x00008007a07e0000(status0x501030, ringcomp_1.1.1). RADV logged the same address (GPUVM fault detected at address 0x8007a07e0000).My first two runs faulted on raw guest addresses (
0x17561f000,0x177fdf000), like your cause 1. This run faulted on host addresses that are spread out, all reads (RW: 0x0). That looks like your cause 2 (freed BLAS private storage) and your second prototype run (0x8007…, freed BLAS host VAs).The
AS sourcelines before it, 8 in total. Four of them resolve to the guest address itself:There were 494 rehydrated structures (0 skipped). Unlike runs 1 and 2, there was no
place TLAS on VA … previously used by non-TLASthis time.Across the three runs
0x17561f000,0x00x177fdf0000x8007a07e0000,0x80084d4bc000–0x8008840a0000All three runs ended in a failed compute ring reset and a MODE1 reset. The new firmware doesn't change that.
Trace and dump
GPU fault trace: marking every draw and dispatchappeared again, with no report after it: the game was gone about 0.4 s after the device loss. Your synchronous flush would be needed here too.I have the full devcoredump (about 5.6 MB, with register state and the
comp_1.1.1ring contents). I can share it privately if someone wants to decode the ring.Your prototype, as a branch on
main, is the next thing I'd run on this card.Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-11-28T23:20:12Z.
On the geometry-range candidate from your follow-up: I opened #428 for it. Indices past
VertexCountmake a title-memory build read past its vertex import, and a Lanes case reproduces it onmainas aTCPread fault (MAPPING_ERROR 0x1).In my game runs on an RX 9060 XT it didn't come up, though. With a counter on top of #409 and #424, none of the 256+ 16-bit indexed geometries had an index past
VertexCount. So yourbuild_as type=1 count=6fault is more likely the never-built update source thatce620c7handles. I'm leaving the lifetime and prebuild work to you and #409.Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T07:52:21Z.
Updated the remaining non-overlapping work onto current
main(2871726) in #455:#409,#424, and#428are merged onmain, and#436/#442/#443/#445cover unbuilt AS copy/query, refused builds, private scratch, and in-place update extent booking.#455adds the remaining pieces: TLAS-pinned BLAS storage snapshots (tlas_deps+ fence-backed retirement) and prebuild-after-translation + Xbox format normalization (53/R32G32_FLOAT/vertex_bytes), verified on both AMD1002:73bfand1002:164eplus ProjectScarlett (545.6s, 24+ 3D frames, 0 GPUVM faults alongside#441).Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T21:58:11Z.
Closing as fixed: the pieces are all on
mainnow (#409, #424, #428, #436, #442, #443, #445, and #455 for the TLAS-pinned BLAS storage and prebuild normalisation). The RX 6600 and RX 6900 XT runs on those builds reached the world without this fault. Thanks for seeing it through. Please reopen if a GPUVM fault on guest-memory BLAS or unmapped instances shows up again on currentmain.