d3d12: withdraw a title-memory structure when the list over it is submitted #409

Merged
NickStallman merged 5 commits from upstream-pr/409 into main 2026-11-29 01:45:02 +00:00
NickStallman commented 2026-11-28 19:48:56 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T19:48:56Z.


Summary

A structure a title builds in its own memory gets host storage when its build is recorded (#320). A later recording that wrote a structure over an older one dropped the older structure's address at once. So a list recorded before that build, and submitted after it was recorded, resolved the older structure to one of two wrong addresses:

  • its raw title address, after a build over it ("the address now resolves to" the address itself);
  • the new storage, not built yet, after a rebuild at the same address that needed more room.

Before e380da14 such a list was refused, and its queue stopped. Since e380da14 it runs. Its copy or size query uses the storage it recorded, but a scene it builds over the structure, and lists after it, read through the bad address.

  • On an RTX 5090, the new Lanes case hangs the GPU (Xid 109, CTX SWITCH TIMEOUT).
  • On RDNA2, it fits the gfxhub page faults reported on #232 (TCP, PERMISSION_FAULTS: 0x3). The faulting pages there are title-range addresses next to the logged structure sources. That link to the game's faults is inferred: the faulting draw or dispatch wasn't identified.

Changes:

  • Withdrawn at submission. guest_memory::target no longer drops older structures' addresses at recording time. It returns the storage it takes, both from structures the new one covers and from a rebuild at the same address. The recording list keeps that storage alive until it completes. When the list is submitted, a scene command withdraws each older address, unless a later recording has since given that address other storage.

  • The recorded storage stays published. When a list's structure source got new storage after the list recorded it (e380da14's case), the list publishes the storage it recorded. Its own later commands, and lists submitted before the replacing list, then mean the structure that storage holds.

    • Trade-off: a list recorded after the replacing build but submitted before it now sees the older structure instead of the unbuilt one.
  • Instances whose structure is gone (a2b56c94). An instance naming an address in title memory where no structure is published now gets a null structure, instead of keeping the raw address. Registered and native structures pass through unchanged. This is the first cause DrArroway named on #403, and the one the RX 6600 retest on this PR pinned down.

  • Updates whose source was never built (ce620c7). An in-place update resolved its source after its destination had got new storage, so it could read storage that nothing had built. The source is now taken first, and an update whose title-memory source has no storage is built in full, with private scratch, and logged. On an RX 6600, @1093i3511 ran this commit: no GPU fault and no reset, where every earlier run on that card since 2af42c9 had faulted, and the new log line appeared 16 times in 9 minutes. That run also had TUXBOX_TRACE_RAYTRACING=1.

    • No failing-first test. The new Lanes case for it passes with the change on an RDNA2 iGPU, but the unfixed case wasn't run, because it can hang a GPU. The evidence that it matters is the game run above.

Tested

  • The checks relevant to this change passed
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below
  • Where the table calls for AMD and NVIDIA, they passed on both

Lanes ray-tracing-guest-memory now also builds a scene over the structure in its earlier list. It traces a ray onto the structure's triangle and one beside it, then records a build over the structure and submits the earlier list.

  • On main with only the test (RTX 5090): the provider logs that the source got new storage, then the GPU hangs (Xid 109) and the self-test never completes.
  • With the fix: it passes on both GPUs.
  • At 928abca (before e380da14): the list is refused with E_INVALIDARG, as expected.
  • Not run: main on the AMD iGPU.

GPU, driver and backend:

  • RTX 5090 (10de:2b85), NVIDIA 620.70.10
  • AMD Raphael iGPU (1002:13c0), Mesa RADV 26.0.8
  • both on GE-Proton11-14

At a2b56c94, the AMD full check passed all 11 steps. The RTX 5090 full check passed 9 of 11 on a busy machine; lanes-late-pipeline and the translator's translated-mesh failed and each passed on a rerun. I have not found a cause; both passed at ce620c7. At ce620c7 (the last commit) the full check passed all 11 steps on the AMD iGPU and on the RTX 5090. The results below are for the first two commits.

Commands run and their results:

python tuxbox.py check --no-gpu
  all 7 steps passed
python tuxbox.py check --adapter 10de:2b85 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64
  all 11 steps passed
python tuxbox.py check --adapter 1002:13c0 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64
  all 11 steps passed
python tuxbox.py verify --only lanes-selftest --adapter 10de:2b85
  23 of 23 passed
python tuxbox.py verify --only lanes-selftest --adapter 1002:13c0
  23 of 23 passed
d3d12 unit tests under GE-Proton: 286 passed, 10 failed; the same 10 memory_wait GPU tests fail on main (D3D12XboxCreateDevice 0x80070057 in that environment)

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5543961432 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T19:48:56Z. --- ## Summary A structure a title builds in its own memory gets host storage when its build is **recorded** (#320). A later recording that wrote a structure over an older one dropped the older structure's address at once. So a list recorded before that build, and submitted after it was recorded, resolved the older structure to one of two wrong addresses: - its raw title address, after a build over it ("the address now resolves to" the address itself); - the new storage, not built yet, after a rebuild at the same address that needed more room. Before e380da14 such a list was refused, and its queue stopped. Since e380da14 it runs. Its copy or size query uses the storage it recorded, but a scene it builds over the structure, and lists after it, read through the bad address. - **On an RTX 5090,** the new Lanes case hangs the GPU (Xid 109, CTX SWITCH TIMEOUT). - **On RDNA2,** it fits the gfxhub page faults reported on #232 (TCP, `PERMISSION_FAULTS: 0x3`). The faulting pages there are title-range addresses next to the logged structure sources. That link to the game's faults is inferred: the faulting draw or dispatch wasn't identified. **Changes:** - **Withdrawn at submission.** `guest_memory::target` no longer drops older structures' addresses at recording time. It returns the storage it takes, both from structures the new one covers and from a rebuild at the same address. The recording list keeps that storage alive until it completes. When the list is submitted, a scene command withdraws each older address, unless a later recording has since given that address other storage. - **The recorded storage stays published.** When a list's structure source got new storage after the list recorded it (e380da14's case), the list publishes the storage it recorded. Its own later commands, and lists submitted before the replacing list, then mean the structure that storage holds. - Trade-off: a list recorded after the replacing build but submitted before it now sees the older structure instead of the unbuilt one. - **Instances whose structure is gone (a2b56c94).** An instance naming an address in title memory where no structure is published now gets a null structure, instead of keeping the raw address. Registered and native structures pass through unchanged. This is the first cause DrArroway named on #403, and the one the RX 6600 retest on this PR pinned down. - **Updates whose source was never built (ce620c7).** An in-place update resolved its source after its destination had got new storage, so it could read storage that nothing had built. The source is now taken first, and an update whose title-memory source has no storage is built in full, with private scratch, and logged. On an RX 6600, @1093i3511 ran this commit: no GPU fault and no reset, where every earlier run on that card since 2af42c9 had faulted, and the new log line appeared 16 times in 9 minutes. That run also had `TUXBOX_TRACE_RAYTRACING=1`. - **No failing-first test.** The new Lanes case for it passes with the change on an RDNA2 iGPU, but the unfixed case wasn't run, because it can hang a GPU. The evidence that it matters is the game run above. ## Tested - [x] The checks relevant to this change passed - [x] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below - [x] Where the table calls for AMD and NVIDIA, they passed on both Lanes `ray-tracing-guest-memory` now also builds a scene over the structure in its earlier list. It traces a ray onto the structure's triangle and one beside it, then records a build over the structure and submits the earlier list. - **On `main` with only the test** (RTX 5090): the provider logs that the source got new storage, then the GPU hangs (Xid 109) and the self-test never completes. - **With the fix:** it passes on both GPUs. - **At 928abca** (before e380da14): the list is refused with `E_INVALIDARG`, as expected. - **Not run:** `main` on the AMD iGPU. GPU, driver and backend: - RTX 5090 (10de:2b85), NVIDIA 620.70.10 - AMD Raphael iGPU (1002:13c0), Mesa RADV 26.0.8 - both on GE-Proton11-14 At a2b56c94, the AMD full check passed all 11 steps. The RTX 5090 full check passed 9 of 11 on a busy machine; `lanes-late-pipeline` and the translator's `translated-mesh` failed and each passed on a rerun. I have not found a cause; both passed at ce620c7. At ce620c7 (the last commit) the full check passed all 11 steps on the AMD iGPU and on the RTX 5090. The results below are for the first two commits. Commands run and their results: ```text python tuxbox.py check --no-gpu all 7 steps passed python tuxbox.py check --adapter 10de:2b85 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64 all 11 steps passed python tuxbox.py check --adapter 1002:13c0 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64 all 11 steps passed python tuxbox.py verify --only lanes-selftest --adapter 10de:2b85 23 of 23 passed python tuxbox.py verify --only lanes-selftest --adapter 1002:13c0 23 of 23 passed d3d12 unit tests under GE-Proton: 286 passed, 10 failed; the same 10 memory_wait GPU tests fail on main (D3D12XboxCreateDevice 0x80070057 in that environment) ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1093i3511 commented 2026-11-28 20:17:46 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T20:17:46Z.


Thanks for the fix. I ran this branch on the RX 6600 under the same conditions as before. The Lanes test passes here, but in the game the fault is still there, and now it lands on the structure addresses themselves.

Setup: RX 6600 (1002:73ff, NAVI23, 8 GB), Mesa RADV 26.3.1, Linux 7.3.6, linux-firmware-amdgpu 20261124, GE-Proton11-14. This branch at d5002e0 (on main b8355fa), D3D12 provider sha256 5b27b58e…, XboxBvhBuilder.dll f9d957b9…. Warm caches, TUXBOX_TRACE_GPU_FAULT=1, default settings otherwise.

Lanes

tuxbox.py verify --only lanes-selftest: 23 of 23 pass, including ray-tracing-guest-memory, ray-tracing-rehydrate and ray-tracing-builder. No reset.

Game

The run went the same way as on main, but ended sooner, after 388 s and 5,380 frames, before a world frame was shown; the intro's audio could be heard. The title had made 32 rehydration calls (469 structures, 0 skipped). The last lines before the fault:

AS source 0x179ed0100 was given new storage after a list recorded it (#1): the list keeps 0xffff8007b6710000, the address now resolves to 0x179ed0100
AS source 0x17a18c400 was given new storage after a list recorded it (#2): the list keeps 0xffff8007b6770000, the address now resolves to 0x17a18c400
AS source 0x17a1a7a00 was given new storage after a list recorded it (#3): the list keeps 0xffff8007b67a0000, the address now resolves to 0x17a1a7a00
radv: GPUVM fault detected at address 0x17a16b000.

The kernel (21:03:56), 10 reports, all ring:24, TCP, PERMISSION_FAULTS: 0x3, RW: 0x0:

page reports
0x179ae3000 2
0x179e9b000 1
0x179ee7000 1
0x17a16b000 2 first in the devcoredump (comp_1.1.1, status 0x701031)
0x17a18c000 2 the page of AS source #2 (0x17a18c400)
0x17a1a7000 2 the page of AS source #3 (0x17a1a7a00)

Then Ring comp_1.1.1 reset failed, a MODE1 reset and VRAM lost, as before.

What differs from main:

  • On main, about half of the AS source lines resolved to new host storage and the rest to the raw title address. Here all three resolve to the raw title address.
  • Two faulting pages are exactly the pages of those structures, and the others lie in the same range (0x179a…–0x17a1…). On main the faulting pages only lay near the AS sources.

So something still reads through the raw title address of a structure whose storage was replaced. My guess is a TLAS instance record or a later list, like the first cause in #403 (an instance whose structure address isn't found keeps the raw guest address). The GPU fault trace again printed nothing, because the game was gone within about 0.4 s of the device loss.

Memory, peak: requested VRAM 6.7 GB, GTT 11.0 GB, RAM 29.5 GB, swap 4.4 GB.

I can rerun with extra logging if you point me at what would help.

<!-- greyfinch-sync:brcly/TuxBox:comment:7245181350 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7245181350). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T20:17:46Z. --- Thanks for the fix. I ran this branch on the RX 6600 under the same conditions as before. The Lanes test passes here, but in the game the fault is still there, and now it lands on the structure addresses themselves. **Setup:** RX 6600 (`1002:73ff`, NAVI23, 8 GB), Mesa RADV 26.3.1, Linux 7.3.6, `linux-firmware-amdgpu` 20261124, GE-Proton11-14. This branch at d5002e0 (on `main` b8355fa), D3D12 provider sha256 `5b27b58e…`, `XboxBvhBuilder.dll` `f9d957b9…`. Warm caches, `TUXBOX_TRACE_GPU_FAULT=1`, default settings otherwise. ## Lanes `tuxbox.py verify --only lanes-selftest`: 23 of 23 pass, including `ray-tracing-guest-memory`, `ray-tracing-rehydrate` and `ray-tracing-builder`. No reset. ## Game The run went the same way as on `main`, but ended sooner, after 388 s and 5,380 frames, before a world frame was shown; the intro's audio could be heard. The title had made 32 rehydration calls (469 structures, 0 skipped). The last lines before the fault: ```text AS source 0x179ed0100 was given new storage after a list recorded it (#1): the list keeps 0xffff8007b6710000, the address now resolves to 0x179ed0100 AS source 0x17a18c400 was given new storage after a list recorded it (#2): the list keeps 0xffff8007b6770000, the address now resolves to 0x17a18c400 AS source 0x17a1a7a00 was given new storage after a list recorded it (#3): the list keeps 0xffff8007b67a0000, the address now resolves to 0x17a1a7a00 radv: GPUVM fault detected at address 0x17a16b000. ``` The kernel (21:03:56), 10 reports, all `ring:24`, TCP, `PERMISSION_FAULTS: 0x3`, `RW: 0x0`: | page | reports | | | --- | ---: | --- | | `0x179ae3000` | 2 | | | `0x179e9b000` | 1 | | | `0x179ee7000` | 1 | | | `0x17a16b000` | 2 | first in the devcoredump (`comp_1.1.1`, status `0x701031`) | | `0x17a18c000` | 2 | the page of AS source #2 (`0x17a18c400`) | | `0x17a1a7000` | 2 | the page of AS source #3 (`0x17a1a7a00`) | Then `Ring comp_1.1.1 reset failed`, a MODE1 reset and VRAM lost, as before. What differs from `main`: - On `main`, about half of the `AS source` lines resolved to new host storage and the rest to the raw title address. Here **all three resolve to the raw title address**. - **Two faulting pages are exactly the pages of those structures**, and the others lie in the same range (`0x179a…`–`0x17a1…`). On `main` the faulting pages only lay near the AS sources. So something still reads through the raw title address of a structure whose storage was replaced. My guess is a TLAS instance record or a later list, like the first cause in #403 (an instance whose structure address isn't found keeps the raw guest address). The GPU fault trace again printed nothing, because the game was gone within about 0.4 s of the device loss. Memory, peak: requested VRAM 6.7 GB, GTT 11.0 GB, RAM 29.5 GB, swap 4.4 GB. I can rerun with extra logging if you point me at what would help.
1093i3511 commented 2026-11-28 20:28:15 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T20:28:15Z.


One more detail from the amdgpu devcoredumps, for this run and my last two on main.

run hung ring pending submission (indirect buffers)
main 2af42c9 comp_1.1.1 56 + 20,360 dwords
main b8355fa comp_1.3.0 56 + 24,392 dwords
this branch comp_1.1.1 56 + 19,384 dwords

Each time, exactly one submission was pending on the hung compute ring, and it was a large compute list. The dump holds only the ring, not the contents of the indirect buffers, so I can't name the dispatch from it.

<!-- greyfinch-sync:brcly/TuxBox:comment:7245309073 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7245309073). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T20:28:15Z. --- One more detail from the amdgpu devcoredumps, for this run and my last two on `main`. | run | hung ring | pending submission (indirect buffers) | | --- | --- | --- | | `main` 2af42c9 | `comp_1.1.1` | 56 + 20,360 dwords | | `main` b8355fa | `comp_1.3.0` | 56 + 24,392 dwords | | this branch | `comp_1.1.1` | 56 + 19,384 dwords | Each time, exactly one submission was pending on the hung compute ring, and it was a large compute list. The dump holds only the ring, not the contents of the indirect buffers, so I can't name the dispatch from it.
NickStallman commented 2026-11-28 20:41:32 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T20:41:32Z.


Thanks for the retest; the faults landing on the structure pages pinned it down. See also #403.

What was left. When the list that writes over a structure in title memory is submitted, the older structure's address is withdrawn.

  • On d5002e0, that's where "now resolves to" the address itself comes from: the rehydration over the structure was submitted before a list that still named the old one.
  • Any scene in or after that list kept the raw title address in its instance. The instance fixups (the GPU table and the upload path) leave an address they don't find unchanged.

That's DrArroway's first cause on #403.

The change (a2b56c9). An instance naming an address in title memory where no structure is published now gets a null structure, which makes it inactive. Following #403, only title-memory pools count; registered and native structures pass through unchanged.

Two new Lanes cases cover it, one per fixup path:

  • ray-tracing-guest-memory submits the build over the structure before a scene recorded earlier;
  • ray-tracing-rehydrate rehydrates a structure over another on a second queue, and runs it before the scene.

Both hang the GPU on d5002e0 on an RTX 5090 (Xid 109), and pass with this change on the 5090 and on an RDNA2 iGPU.

Not covered yet: #403's second cause, a TLAS built before the overwrite and traced in a later frame after the older storage is freed. Your third run on main, which faulted at host addresses, looks like that one.

@1093i3511, could you rerun this branch at a2b56c9 under the same conditions? If it still faults, whether the pages are title addresses (0x17…) or host addresses (0x8007…) tells the two causes apart.

<!-- greyfinch-sync:brcly/TuxBox:comment:7245470496 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7245470496). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T20:41:32Z. --- Thanks for the retest; the faults landing on the structure pages pinned it down. See also #403. **What was left.** When the list that writes over a structure in title memory is submitted, the older structure's address is withdrawn. - On d5002e0, that's where "now resolves to" the address itself comes from: the rehydration over the structure was submitted before a list that still named the old one. - Any scene in or after that list kept the raw title address in its instance. The instance fixups (the GPU table and the upload path) leave an address they don't find unchanged. That's DrArroway's first cause on #403. **The change (a2b56c9).** An instance naming an address in title memory where no structure is published now gets a null structure, which makes it inactive. Following #403, only title-memory pools count; registered and native structures pass through unchanged. Two new Lanes cases cover it, one per fixup path: - `ray-tracing-guest-memory` submits the build over the structure before a scene recorded earlier; - `ray-tracing-rehydrate` rehydrates a structure over another on a second queue, and runs it before the scene. Both hang the GPU on d5002e0 on an RTX 5090 (Xid 109), and pass with this change on the 5090 and on an RDNA2 iGPU. **Not covered yet:** #403's second cause, a TLAS built before the overwrite and traced in a later frame after the older storage is freed. Your third run on `main`, which faulted at host addresses, looks like that one. @1093i3511, could you rerun this branch at a2b56c9 under the same conditions? If it still faults, whether the pages are title addresses (`0x17…`) or host addresses (`0x8007…`) tells the two causes apart.
1093i3511 commented 2026-11-28 21:05:01 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T21:05:01Z.


Rerun at a2b56c9 on the RX 6600, under the same conditions (warm caches, TUXBOX_TRACE_GPU_FAULT=1, provider sha256 5746bf71…). lanes-selftest passes 23 of 23 again, including both new cases. The game still faults, but now only at host addresses, so the first cause looks fixed here and what's left is the second.

Run

It lasted 400.6 s and 5,251 frames, about as long as before. There were 471 structures rehydrated (0 skipped). The last lines before the fault:

AS source 0x179f4d200 was given new storage after a list recorded it (#1): the list keeps 0xffff8007902a0000, the address now resolves to 0x179f4d200
AS source 0x17a209700 was given new storage after a list recorded it (#2): the list keeps 0xffff80079ac70000, the address now resolves to 0x17a209700
AS source 0x17a224d00 was given new storage after a list recorded it (#3): the list keeps 0xffff80079ada0000, the address now resolves to 0x17a224d00
AS source 0x17a240300 was given new storage after a list recorded it (#4): the list keeps 0xffff800783200000, the address now resolves to 0x17a240300
radv: GPUVM fault detected at address 0x8007831ff000.

The kernel (21:57:40): 10 reports, all ring:24, TCP, PERMISSION_FAULTS: 0x3, RW: 0x0, on two pages only:

page reports
0x8007831fe000 3
0x8007831ff000 7

Then ring comp_1.3.0 timeout, Ring comp_1.3.0 reset failed, a MODE1 reset and VRAM lost, as before.

Compared with d5002e0

  • No title addresses fault anymore. On d5002e0, all ten faulting pages were title addresses in 0x179a…–0x17a1….
  • The two faulting pages lie directly below the storage that AS source #4's list keeps. That list keeps 0xffff800783200000, and the faults are at 0x8007831fe000 and 0x8007831ff000, the two 4 KiB pages just before 0x800783200000. All reads.
  • No place TLAS on VA … previously used by non-TLAS line this time either.

So it fits the second cause you described: storage that was freed or replaced, then read by work recorded against it. I can't tell from here whether the pages below 0x800783200000 belonged to an older structure that was freed, or whether a read starts before that structure's storage.

The game was killed with the desktop again, so the GPU fault trace didn't print anything. I didn't keep the devcoredump this time.

Memory, peak: requested VRAM 6.7 GB, GTT 12.3 GB, RAM 29.6 GB, swap 6.4 GB.

<!-- greyfinch-sync:brcly/TuxBox:comment:7245759388 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7245759388). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T21:05:01Z. --- Rerun at a2b56c9 on the RX 6600, under the same conditions (warm caches, `TUXBOX_TRACE_GPU_FAULT=1`, provider sha256 `5746bf71…`). `lanes-selftest` passes 23 of 23 again, including both new cases. The game still faults, but now **only at host addresses**, so the first cause looks fixed here and what's left is the second. ## Run It lasted 400.6 s and 5,251 frames, about as long as before. There were 471 structures rehydrated (0 skipped). The last lines before the fault: ```text AS source 0x179f4d200 was given new storage after a list recorded it (#1): the list keeps 0xffff8007902a0000, the address now resolves to 0x179f4d200 AS source 0x17a209700 was given new storage after a list recorded it (#2): the list keeps 0xffff80079ac70000, the address now resolves to 0x17a209700 AS source 0x17a224d00 was given new storage after a list recorded it (#3): the list keeps 0xffff80079ada0000, the address now resolves to 0x17a224d00 AS source 0x17a240300 was given new storage after a list recorded it (#4): the list keeps 0xffff800783200000, the address now resolves to 0x17a240300 radv: GPUVM fault detected at address 0x8007831ff000. ``` The kernel (21:57:40): 10 reports, all `ring:24`, TCP, `PERMISSION_FAULTS: 0x3`, `RW: 0x0`, on two pages only: | page | reports | | --- | ---: | | `0x8007831fe000` | 3 | | `0x8007831ff000` | 7 | Then `ring comp_1.3.0 timeout`, `Ring comp_1.3.0 reset failed`, a MODE1 reset and VRAM lost, as before. ## Compared with d5002e0 - **No title addresses fault anymore.** On d5002e0, all ten faulting pages were title addresses in `0x179a…`–`0x17a1…`. - **The two faulting pages lie directly below the storage that AS source #4's list keeps.** That list keeps `0xffff800783200000`, and the faults are at `0x8007831fe000` and `0x8007831ff000`, the two 4 KiB pages just before `0x800783200000`. All reads. - No `place TLAS on VA … previously used by non-TLAS` line this time either. So it fits the second cause you described: storage that was freed or replaced, then read by work recorded against it. I can't tell from here whether the pages below `0x800783200000` belonged to an older structure that was freed, or whether a read starts before that structure's storage. The game was killed with the desktop again, so the GPU fault trace didn't print anything. I didn't keep the devcoredump this time. Memory, peak: requested VRAM 6.7 GB, GTT 12.3 GB, RAM 29.6 GB, swap 6.4 GB.
NickStallman commented 2026-11-28 21:31:35 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T21:31:35Z.


Thanks, that's very useful: no title addresses, and two pages directly below one structure's storage.

A possible cause. Reads just below a structure are what RADV's update shader would do if the source header is zero: it finds parent links before an offset it reads from that header. I read that in Mesa 26.0.8, not your 26.3.1. We had a path to it: an in-place update resolved its source after its destination got new storage, so it could read storage nothing had built.

To try: branch fix/as-update-unbuilt-source on my fork (ce620c77, one commit on top of a2b56c94). It takes the source first, and builds in full when there is none.

What I haven't shown:

  • that this is your fault. A freed neighbour ending at that page would look the same;
  • a failing case without the change. The new Lanes case for it passes with the change on an RDNA2 iGPU, but I did not run the unfixed case, and it's a contrived one. So I haven't put it in #409.

Could you run it with TUXBOX_TRACE_RAYTRACING=1? Two things would separate the explanations:

  • any update of a structure in title memory without storage built in full lines;
  • the AS storage START..END lines around the faulting pages. Does an older structure's range end at the fault, or does nothing lie there?

@DrArroway, your TLAS-pinned snapshots cover the freed-storage cause, which this doesn't. Are you planning to open that as a PR? I'd rather combine than duplicate it. Your unfinished build_as with native_dst == src may be a related update, though its fault addresses don't fit this directly.

<!-- greyfinch-sync:brcly/TuxBox:comment:7246081804 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7246081804). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T21:31:35Z. --- Thanks, that's very useful: no title addresses, and two pages directly below one structure's storage. **A possible cause.** Reads just below a structure are what RADV's update shader would do if the source header is zero: it finds parent links before an offset it reads from that header. I read that in Mesa 26.0.8, not your 26.3.1. We had a path to it: an in-place update resolved its source *after* its destination got new storage, so it could read storage nothing had built. **To try:** branch `fix/as-update-unbuilt-source` on my fork (`ce620c77`, one commit on top of a2b56c94). It takes the source first, and builds in full when there is none. **What I haven't shown:** - that this is your fault. A freed neighbour ending at that page would look the same; - a failing case without the change. The new Lanes case for it passes with the change on an RDNA2 iGPU, but I did not run the unfixed case, and it's a contrived one. So I haven't put it in #409. Could you run it with `TUXBOX_TRACE_RAYTRACING=1`? Two things would separate the explanations: - any `update of a structure in title memory without storage built in full` lines; - the `AS storage START..END` lines around the faulting pages. Does an older structure's range end at the fault, or does nothing lie there? @DrArroway, your TLAS-pinned snapshots cover the freed-storage cause, which this doesn't. Are you planning to open that as a PR? I'd rather combine than duplicate it. Your unfinished `build_as` with `native_dst == src` may be a related update, though its fault addresses don't fit this directly.
DrArroway commented 2026-11-28 21:50:44 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-28T21:50:44Z.


Yes, happy to coordinate rather than duplicate. I split my local work on top of main (b8355fa) into two branches and just finished a 59-minute live ProjectScarlett run with both applied (alongside #389, #390, and #408): 8 consecutive 3D world frames (pool #256, 512 MiB private BLAS storage) with 0 AS source errors, 0 build_as faults, 0 GPUVM faults, and 0 GPU resets (the run ended only on the game's stall watchdog during heavy placed-texture readback).

I am running the full dual-GPU (1002:73bf + 1002:164e) Lanes + regression verification gate on both branches now:

  1. fix/d3d12-gpu-fault-trace-flush (independent of #409): flushes gpu_trace synchronously on UINT64_MAX/device-removed errors and adds gpu_trace markers around raytracing builds, instance fixup, dispatch, and rehydration. That should also give @1093i3511 the unfinished command even when a GPU reset kills the desktop before process exit.
  2. Guest BLAS lifetime + update fixes:
    • TLAS-pinned BLAS snapshots (tlas_deps + retiring replaced Instances snapshots + grace window so freed BLAS storage is not read by in-flight or reused TLAS builds), and
    • For the PERFORM_UPDATE (native_dst == src) fault we hit: resolving guest_source before build_destination and converting missing-source updates to full builds, plus calling GetRaytracingAccelerationStructurePrebuildInfo after geometry translation, normalizing Xbox vertex formats in ray_build::prebuild, and allocating private scratch when full-build scratch exceeds update scratch.

I can open the gpu_trace PR first, and either open the TLAS-pinned snapshot + prebuild/update fixes as a standalone PR or rebase the non-overlapping pieces on top of #409 once it lands — whichever is easier for you.

<!-- greyfinch-sync:brcly/TuxBox:comment:7246315477 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7246315477). Originally posted by [DrArroway](https://github.com/DrArroway) on 2026-11-28T21:50:44Z. --- Yes, happy to coordinate rather than duplicate. I split my local work on top of `main` (`b8355fa`) into two branches and just finished a 59-minute live ProjectScarlett run with both applied (alongside `#389`, `#390`, and `#408`): 8 consecutive 3D world frames (`pool #256`, `512 MiB` private BLAS storage) with **0 `AS source` errors, 0 `build_as` faults, 0 GPUVM faults, and 0 GPU resets** (the run ended only on the game's stall watchdog during heavy placed-texture readback). I am running the full dual-GPU (`1002:73bf` + `1002:164e`) Lanes + regression verification gate on both branches now: 1. **`fix/d3d12-gpu-fault-trace-flush`** (independent of `#409`): flushes `gpu_trace` synchronously on `UINT64_MAX`/device-removed errors and adds `gpu_trace` markers around raytracing builds, instance fixup, dispatch, and rehydration. That should also give @1093i3511 the unfinished command even when a GPU reset kills the desktop before process exit. 2. **Guest BLAS lifetime + update fixes**: - TLAS-pinned BLAS snapshots (`tlas_deps` + retiring replaced `Instances` snapshots + grace window so freed BLAS storage is not read by in-flight or reused TLAS builds), and - For the `PERFORM_UPDATE` (`native_dst == src`) fault we hit: resolving `guest_source` before `build_destination` and converting missing-source updates to full builds, plus calling `GetRaytracingAccelerationStructurePrebuildInfo` after geometry translation, normalizing Xbox vertex formats in `ray_build::prebuild`, and allocating private scratch when full-build scratch exceeds update scratch. I can open the `gpu_trace` PR first, and either open the TLAS-pinned snapshot + prebuild/update fixes as a standalone PR or rebase the non-overlapping pieces on top of `#409` once it lands — whichever is easier for you.
1093i3511 commented 2026-11-28 22:11:09 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T22:11:09Z.


Before trying your branch, I ran a2b56c9 with local logging of my own (not pushed). It logs every buffer the structure code creates (rebuild::buffer) and every new, reused and released storage in guest_memory.rs. It also adds trace markers on the raytracing commands (build_as, rehydrate_as, copy_as, postbuild_as, instance_fixup, dispatch_rays), and checks for device loss every 50 ms. Same card and conditions as before. It answers your second question: nothing lay below the faulting pages.

Faulting pages

At 22:47:09, 10 reports on ring 24, TCP, PERMISSION_FAULTS: 0x3, RW: 0x0:

0x8003c7ff4000 (2), 0x8003c7ff7000, 0x8003c7ff8000, 0x8003c7ff9000 (2), 0x8003c7ffb000 (2), 0x8003c7ffd000 (2)
radv: GPUVM fault detected at address 0x8003c7ffa000

That is the 48 KiB directly below 0x8003c8000000. Then ring gfx_0.1.0 timeout, Ring gfx_0.1.0 reset failed, MODE1. This time it was the graphics ring, not a compute ring.

What the log says about that address

The storage at 0x8003c8000000 and everything near it:

7500  AS storage: new 0xffff8003b7400000+0x930000 for title 0x17dd43b00
7504  AS storage: reuse 0xffff8003b7400000+0x930000 for title 0x17dd43b00+0x927100
7536  AS storage: released 0xffff8003b7400000+0x930000 of title 0x17dd43b00, replaced by a build at title 0x17e4f5900+0x757280
8213  AS storage: new 0xffff8003c8000000+0x930000 for title 0x17dd43b00
8214  AS storage: released 0xffff8003acc00000+0x760000 of title 0x17e4f5900, replaced by a build at title 0x17dd43b00+0x927100
8343  AS storage: reuse 0xffff8003c8000000+0x930000 for title 0x17dd43b00+0x927100
8508  radv: GPUVM fault detected at address 0x8003c7ffa000.
  • No buffer that the structure code created lies at or near the faulting pages. The nearest buffer below 0x8003c8000000 ends at 0x8003b7d30000, about 250 MiB lower. So it isn't a freed neighbour, as far as this logging can see.
  • The structure at title 0x17dd43b00 (9.4 MB of storage) and the one at 0x17e4f5900 overlap and keep replacing each other.
  • Each time 0x17dd43b00 gets new storage, the next build at the same address reuses it (line 7500 to 7504, line 8213 to 8343). The fault comes after the second reuse.

That fits your explanation: an update in place over storage that nothing had built yet, reading below its start. My logging doesn't show the build flags for the reuse, so I can't confirm it was an update. Your branch's update of a structure in title memory without storage built in full line should show that.

The trace

With the 50 ms check, the trace reported in time this time, but found nothing:

GPU fault trace: device lost; every marked command had finished

So every marked raytracing command, including the builds, had finished when the device was lost. A faulting read returns data and lets the build complete with garbage, and a later traversal on the graphics ring can then hang. That would explain it, but I'm inferring it from the gfx timeout, not seeing it.

@DrArroway, this may matter for the trace flush branch: on RADV a faulting build apparently doesn't stay unfinished, so a marker on build_as alone may not name it. The hang shows up later on another ring.

With fix/as-update-unbuilt-source (ce620c77): no fault

@NickStallman, I ran your branch unchanged, under the same conditions, with TUXBOX_TRACE_RAYTRACING=1 and TUXBOX_TRACE_GPU_FAULT=1. Lanes passes 23 of 23 first.

  • No GPU fault and no reset. The kernel logged nothing from amdgpu during the whole run, and RADV reported no fault. The desktop stayed up. That's the first run on this card since 2af42c9 with no fault.
  • 16 lines update of a structure in title memory without storage built in full, for example:
    update of a structure in title memory without storage built in full at 0xffff8007a5fc0000 (#1)
    ...
    update of a structure in title memory without storage built in full at 0xffff8007833e0000 (#16)
    
    So the case you described happens in the game, 16 times in 9 minutes.
  • 487 structures rehydrated (0 skipped), 2 AS source lines, 1,532 AS storage lines.
  • The run ended after 540.5 s with exit code 5, the title's own watchdog. Its crash report has Current Mission Name: 0x98c85f2a [F:1734] and Frame: 1747. So about 13 game frames in the world, at 18–28 s per presented frame.

What ends it now is the readback volume from #292 / #300, not a fault:

placed texture readback 7.0s: batches=8 textures=504 copied=2885.4MiB largest=939.3MiB/504 textures | ...
placed texture readback 5.4s: batches=5 textures=504 copied=1973.6MiB largest=939.3MiB/504 textures | ...

Memory got tighter than in earlier runs: requested VRAM 6.8 GB, GTT up to 15.9 GB (the card's GTT limit is 16 GB), RAM up to 31.1 of 32 GB and swap 11.0 GB.

<!-- greyfinch-sync:brcly/TuxBox:comment:7246555964 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7246555964). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T22:11:09Z. --- Before trying your branch, I ran a2b56c9 with local logging of my own (not pushed). It logs every buffer the structure code creates (`rebuild::buffer`) and every new, reused and released storage in `guest_memory.rs`. It also adds trace markers on the raytracing commands (`build_as`, `rehydrate_as`, `copy_as`, `postbuild_as`, `instance_fixup`, `dispatch_rays`), and checks for device loss every 50 ms. Same card and conditions as before. It answers your second question: **nothing lay below the faulting pages.** ## Faulting pages At 22:47:09, 10 reports on ring 24, TCP, `PERMISSION_FAULTS: 0x3`, `RW: 0x0`: ```text 0x8003c7ff4000 (2), 0x8003c7ff7000, 0x8003c7ff8000, 0x8003c7ff9000 (2), 0x8003c7ffb000 (2), 0x8003c7ffd000 (2) radv: GPUVM fault detected at address 0x8003c7ffa000 ``` That is the 48 KiB directly below `0x8003c8000000`. Then `ring gfx_0.1.0 timeout`, `Ring gfx_0.1.0 reset failed`, MODE1. This time it was the graphics ring, not a compute ring. ## What the log says about that address The storage at `0x8003c8000000` and everything near it: ```text 7500 AS storage: new 0xffff8003b7400000+0x930000 for title 0x17dd43b00 7504 AS storage: reuse 0xffff8003b7400000+0x930000 for title 0x17dd43b00+0x927100 7536 AS storage: released 0xffff8003b7400000+0x930000 of title 0x17dd43b00, replaced by a build at title 0x17e4f5900+0x757280 8213 AS storage: new 0xffff8003c8000000+0x930000 for title 0x17dd43b00 8214 AS storage: released 0xffff8003acc00000+0x760000 of title 0x17e4f5900, replaced by a build at title 0x17dd43b00+0x927100 8343 AS storage: reuse 0xffff8003c8000000+0x930000 for title 0x17dd43b00+0x927100 8508 radv: GPUVM fault detected at address 0x8003c7ffa000. ``` - **No buffer that the structure code created lies at or near the faulting pages.** The nearest buffer below `0x8003c8000000` ends at `0x8003b7d30000`, about 250 MiB lower. So it isn't a freed neighbour, as far as this logging can see. - The structure at title `0x17dd43b00` (9.4 MB of storage) and the one at `0x17e4f5900` overlap and keep replacing each other. - **Each time `0x17dd43b00` gets new storage, the next build at the same address reuses it** (line 7500 to 7504, line 8213 to 8343). The fault comes after the second reuse. That fits your explanation: an update in place over storage that nothing had built yet, reading below its start. My logging doesn't show the build flags for the reuse, so I can't confirm it was an update. Your branch's `update of a structure in title memory without storage built in full` line should show that. ## The trace With the 50 ms check, the trace reported in time this time, but found nothing: ```text GPU fault trace: device lost; every marked command had finished ``` So every marked raytracing command, including the builds, had finished when the device was lost. A faulting read returns data and lets the build complete with garbage, and a later traversal on the graphics ring can then hang. That would explain it, but I'm inferring it from the gfx timeout, not seeing it. @DrArroway, this may matter for the trace flush branch: on RADV a faulting build apparently doesn't stay unfinished, so a marker on `build_as` alone may not name it. The hang shows up later on another ring. ## With `fix/as-update-unbuilt-source` (ce620c77): no fault @NickStallman, I ran your branch unchanged, under the same conditions, with `TUXBOX_TRACE_RAYTRACING=1` and `TUXBOX_TRACE_GPU_FAULT=1`. Lanes passes 23 of 23 first. - **No GPU fault and no reset.** The kernel logged nothing from amdgpu during the whole run, and RADV reported no fault. The desktop stayed up. That's the first run on this card since 2af42c9 with no fault. - **16 lines `update of a structure in title memory without storage built in full`**, for example: ```text update of a structure in title memory without storage built in full at 0xffff8007a5fc0000 (#1) ... update of a structure in title memory without storage built in full at 0xffff8007833e0000 (#16) ``` So the case you described happens in the game, 16 times in 9 minutes. - 487 structures rehydrated (0 skipped), 2 `AS source` lines, 1,532 `AS storage` lines. - The run ended after 540.5 s with exit code 5, the title's own watchdog. Its crash report has `Current Mission Name: 0x98c85f2a [F:1734]` and `Frame: 1747`. So about 13 game frames in the world, at 18–28 s per presented frame. What ends it now is the readback volume from #292 / #300, not a fault: ```text placed texture readback 7.0s: batches=8 textures=504 copied=2885.4MiB largest=939.3MiB/504 textures | ... placed texture readback 5.4s: batches=5 textures=504 copied=1973.6MiB largest=939.3MiB/504 textures | ... ``` Memory got tighter than in earlier runs: requested VRAM 6.8 GB, GTT up to 15.9 GB (the card's GTT limit is 16 GB), RAM up to 31.1 of 32 GB and swap 11.0 GB.
NickStallman commented 2026-11-28 22:19:47 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T22:19:47Z.


Thank you both.

@1093i3511, that's a decisive test: no fault on your card, and the case happens 16 times in 9 minutes. I've moved the commit onto this PR (ce620c7) and put your result in the description. Your note about the marker is useful too: a faulting build can finish, and the hang then shows up later on another ring.

@DrArroway, that plan works well. Since ce620c7 already covers the "resolve guest_source before build_destination, full build when the source is missing" part of your update fix, could you rebase the rest on top of #409 once it lands: the TLAS-pinned snapshots, the prebuild changes and the scratch handling? Please also open the gpu_trace flush separately whenever it suits you. If you'd rather have the update fix as your own commit, say so, and I'll drop mine.

On the readback volume that now ends the runs: draft #413 keeps GPU-written placed textures on the GPU until title memory is looked at, so no readback is recorded for textures the title never reads. It hasn't been run in the game yet, and its AMD check isn't clean. It has one known gap you might hit: textures with unmapped mips, or on memory XMem doesn't manage, still use the old path. If you want to try it, TUXBOX_GPU_OWNED=0 turns it off for a comparison. Our own run with and without it is in progress.

<!-- greyfinch-sync:brcly/TuxBox:comment:7246658848 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7246658848). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T22:19:47Z. --- Thank you both. @1093i3511, that's a decisive test: no fault on your card, and the case happens 16 times in 9 minutes. I've moved the commit onto this PR (ce620c7) and put your result in the description. Your note about the marker is useful too: a faulting build can finish, and the hang then shows up later on another ring. @DrArroway, that plan works well. Since ce620c7 already covers the "resolve `guest_source` before `build_destination`, full build when the source is missing" part of your update fix, could you rebase the rest on top of #409 once it lands: the TLAS-pinned snapshots, the prebuild changes and the scratch handling? Please also open the `gpu_trace` flush separately whenever it suits you. If you'd rather have the update fix as your own commit, say so, and I'll drop mine. On the readback volume that now ends the runs: draft #413 keeps GPU-written placed textures on the GPU until title memory is looked at, so no readback is recorded for textures the title never reads. It hasn't been run in the game yet, and its AMD check isn't clean. It has one known gap you might hit: textures with unmapped mips, or on memory XMem doesn't manage, still use the old path. If you want to try it, `TUXBOX_GPU_OWNED=0` turns it off for a comparison. Our own run with and without it is in progress.
DrArroway commented 2026-11-28 22:23:47 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-28T22:23:47Z.


Sounds good — keeping ce620c7 in #409 makes total sense, and I'll rebase the remaining pieces (TLAS-pinned BLAS snapshots, prebuild-after-translation + Xbox vertex format normalization, and private scratch when full-build scratch exceeds update scratch) on top of #409 once it lands.

I opened the gpu_trace flush + raytracing markers PR separately as #424 (dual-GPU verified on 1002:73bf and 1002:164e), and noted @1093i3511's caveat about RADV faulting builds sometimes finishing and hanging a later ring.

Also excited to try draft #413 on the placed-texture readback volume next!

<!-- greyfinch-sync:brcly/TuxBox:comment:7246705972 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/409#issuecomment-7246705972). Originally posted by [DrArroway](https://github.com/DrArroway) on 2026-11-28T22:23:47Z. --- Sounds good — keeping `ce620c7` in `#409` makes total sense, and I'll rebase the remaining pieces (TLAS-pinned BLAS snapshots, prebuild-after-translation + Xbox vertex format normalization, and private scratch when full-build scratch exceeds update scratch) on top of `#409` once it lands. I opened the `gpu_trace` flush + raytracing markers PR separately as #424 (dual-GPU verified on `1002:73bf` and `1002:164e`), and noted @1093i3511's caveat about RADV faulting builds sometimes finishing and hanging a later ring. Also excited to try draft `#413` on the placed-texture readback volume next!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!409
No description provided.