d3d12: build acceleration structures that titles place in their own memory #320

Merged
gtb-sbe merged 4 commits from upstream-pr/320 into main 2026-11-28 14:41:16 +00:00
gtb-sbe commented 2026-11-27 17:51:26 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-11-27T17:51:26Z.


Draft: the change does what it says in Lanes and in ProjectScarlett, but with it ProjectScarlett now hits a GPU fault at world entry on my RX 9060 XT, which I haven't solved yet. I'm opening it so others can try it, especially on NVIDIA, and because the remaining fault may be something someone else recognises. Details under "Known issue".

Addresses the open item "the title's ray tracing scenes aren't built yet" in docs/PROJECTSCARLETT.md and docs/SHADERS.md, and the dropped builds I asked about on #258.

Problem

On the console a GPU address is the CPU address, so a title can build an acceleration structure anywhere in memory it allocated itself, with no resource naming the range. ProjectScarlett does this for its BLASes: from world entry, all destinations lie in one ~2.2 GiB MEM_PRIVATE allocation of its own (not XMem-backed), and no D3D12 resource covers them.

blas::resolve only knows structure pools registered through depth::wrap, where the guest address is the native one. So the guest address went to vkd3d-proton unchanged, and vkd3d dropped every build:

err:vkd3d-proton:d3d12_command_list_build_raytracing_blas_and_tlas: Failed to place destAccelerationStructure. Dropping call.

That was 147 to 1,275 drops per run on my card. The same builds also passed their scratch, geometry, instance and size-report addresses through unchanged.

Change

  • device/blas/guest_memory.rs (new): a committed private or mapped allocation that no registered resource covers gets a structure pool without native storage (Buffers::structure_pool). Every structure built or copied into it gets private device-local storage, published under its guest address through the existing relocation path, so TLAS instance fixups, copies, size queries and ray-query scenes see the native address.
  • The mapping is published when the build is recorded, not when its list is submitted. The provider holds lists on some queues until a title fence label arrives, and the title submits scenes that reference BLASes whose lists are still held. With submit-time publication, about 230 instance records of the first scene kept raw guest addresses.
  • A new structure over older ones in such a pool releases them (overlap by the result size the title reserved, which is the host prebuild size). Copies reserve only the structure alignment, so they never release a live neighbour. Bounded logs report new pools and the private storage total.
  • find prefers a registered pool over a guest-memory pool, so a native address inside a guest CPU range keeps its old meaning.
  • commands/build_raytracing/guest_addresses.rs (new): scratch, geometry, TLAS instance records and size reports go through command_buffer_address_flags, the import views and CBVs already use. Instance records in title memory are patched by the existing GPU instance fixup through that import. A remaining Direct refusal (which fails the whole ExecuteCommandLists batch once anything is relocated) is logged once.
  • scene_view.rs: a ray-query scene in title memory resolves to its private storage.
  • XboxBvhBuilder rehydration still returns E_NOTIMPL, but now says so in a bounded log. ProjectScarlett doesn't call it.

Test

New Lanes scenario ray-tracing-guest-memory: one VirtualAlloc block holds vertices, an instance record, scratch, a BLAS and a TLAS using it. It builds the BLAS with a compacted-size report, clones it, builds the TLAS and reads all current sizes.

  • Without the change: FAIL ... the build in title memory reported no compacted size (compacted 0, current 0, copy 0, scene 0), with vkd3d's Failed to place destAccelerationStructure.
  • With it: PASS (compacted 512, current 584, copy 584, scene 704 on RADV). RADV reports the TLAS's current size above its prebuild maximum (704 > 640), so the scenario only requires a non-zero scene size.

Unit tests for the overlap rule are in src/tests/device/blas/guest_memory.rs.

Not covered by Lanes yet: a scene submitted before the list that builds its BLAS, while that list waits for a title fence (the record-time publication above). I want to add that scenario before this leaves draft.

BLAS control (second commit)

Every build mode of tools/check_frosty_blas.py failed on main with unaligned batch accepted, before any ray query: since e8af9fd a refused build is skipped and the list kept, but the guest still expected Close() to fail. The second commit updates the six build-related negative checks; copy and size-query checks still expect an error.

With that, the modes that need no retail data give identical results with this branch's and main's d3d12_xs.dll: default, --single-build, --gpu-instances, --promote-blas and --ambiguous-as pass and match the desktop ray query (70010,70120,80010,80120,dead), --copy-only passes, --reuse-blas fails on both (oversized BLAS copy accepted, not touched here).

ProjectScarlett

Title 1.0.2.1, offline, 3840x2160. RX 9060 XT, Mesa 26.2.6 RADV, kernel 6.18, GE-Proton11-14, no preload. Build: 07db52f with #258 and #308 merged plus this change; all my runs that reached world entry had #258.

  • No Failed to place destAccelerationStructure any more. At world entry the title's AS allocation gets one pool; private storage grows to 128-259 MiB over ~900 structures.
  • With record-time publication, the logged scenes reach only private storage (first scene ~3,900 instance records).

Known issue: GPU fault at world entry

In every run with this change, shortly after world entry, the compute ring faults on reads of a few consecutive pages, then the gfx ring times out and the kernel resets the GPU (twice a full MODE1 reset; once the whole desktop froze):

amdgpu: [gfxhub] page fault (src_id:0 ring:24 ...) thread vkd3d_queue
amdgpu:   in page starting at address 0x0000000d13caa000 from client 10
amdgpu:          Faulty UTCL2 client ID: TCP (0x8)
amdgpu:          PERMISSION_FAULTS: 0x3
amdgpu:          MAPPING_ERROR: 0x0

The address differs per run but always lies in 0xd10000000-0xd1e000000. Without this change, the same build ran past world entry for 39 minutes without it (but with every BLAS dropped, and a dark, very grainy picture).

What I could rule out with temporary diagnostics:

  • reads of the private storage (it is at 0xffff8002...-0xffff8004...) and storage released while still referenced (nothing was released before the fault)
  • untranslated build inputs (scratch, geometry, instances, reports): none
  • untranslated command arguments: no root descriptor, view, marker, query or wait address that buffer_at could not back
  • XboxBvhBuilder rehydration: never called
  • released label waits: with the release pushed to 120 s, none was released and the fault came anyway
  • ray-query dispatches: none of the lowered Scarlett ray programs was dispatched in any run

What I see: in one run the first scene referenced 11 structures at 0xd0a10b100-0xd1b080100, the same range as the faults, which the provider never built or copied. In another run the scenes had no such references and the fault came anyway.

Open questions

  • Are 0xd0-0xd1... guest addresses or native VAs? On RADV some native buffer VAs may be that low; I'm checking it next.
  • Does anyone see the same fault on NVIDIA, or on RADV with the amdgpu userptr preload?
  • Is a scene allowed to reference structures the provider never saw? If the title builds them through a path I'm not catching, which one?
  • How much private storage does the live set need? The 16 GB card already peaked at 14.1 GB before this change.

Checks

RX 9060 XT (RDNA4), Mesa 26.2.6 RADV, kernel 6.18, Proton Experimental (Lanes) and GE-Proton11-14 (game).

  • python tuxbox.py check --no-gpu: all six groups pass.
  • python tuxbox.py verify --only lanes-selftest: all 18 scenarios pass, including the new one and ray-tracing-builder (before the record-time publication and rehydration log commits; not rerun since).
  • Full GPU check: not run yet.
  • NVIDIA: not run.

AI use

This branch was made with an AI coding agent (Claude Opus 5.5 via Claude Code, following AGENTS.md). The agent analysed the run logs and the provider source, wrote the provider changes, the Lanes scenario, the unit tests, the control update, the temporary diagnostics behind the findings above (not part of the branch) and this description. I reviewed the first two commits before committing them. The game runs, the Lanes runs, the BLAS controls and the checks above ran on my machine.

No title files, shader bytes or logs included.

<!-- greyfinch-sync:brcly/TuxBox:issue:5530937664 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320). Originally posted by [gtb-sbe](https://github.com/gtb-sbe) on 2026-11-27T17:51:26Z. --- Draft: the change does what it says in Lanes and in ProjectScarlett, but with it ProjectScarlett now hits a GPU fault at world entry on my RX 9060 XT, which I haven't solved yet. I'm opening it so others can try it, especially on NVIDIA, and because the remaining fault may be something someone else recognises. Details under "Known issue". Addresses the open item "the title's ray tracing scenes aren't built yet" in `docs/PROJECTSCARLETT.md` and `docs/SHADERS.md`, and the dropped builds I asked about on #258. ## Problem On the console a GPU address is the CPU address, so a title can build an acceleration structure anywhere in memory it allocated itself, with no resource naming the range. ProjectScarlett does this for its BLASes: from world entry, all destinations lie in one ~2.2 GiB `MEM_PRIVATE` allocation of its own (not XMem-backed), and no D3D12 resource covers them. `blas::resolve` only knows structure pools registered through `depth::wrap`, where the guest address is the native one. So the guest address went to vkd3d-proton unchanged, and vkd3d dropped every build: ```text err:vkd3d-proton:d3d12_command_list_build_raytracing_blas_and_tlas: Failed to place destAccelerationStructure. Dropping call. ``` That was 147 to 1,275 drops per run on my card. The same builds also passed their scratch, geometry, instance and size-report addresses through unchanged. ## Change - `device/blas/guest_memory.rs` (new): a committed private or mapped allocation that no registered resource covers gets a structure pool without native storage (`Buffers::structure_pool`). Every structure built or copied into it gets private device-local storage, published under its guest address through the existing relocation path, so TLAS instance fixups, copies, size queries and ray-query scenes see the native address. - The mapping is published when the build is **recorded**, not when its list is submitted. The provider holds lists on some queues until a title fence label arrives, and the title submits scenes that reference BLASes whose lists are still held. With submit-time publication, about 230 instance records of the first scene kept raw guest addresses. - A new structure over older ones in such a pool releases them (overlap by the result size the title reserved, which is the host prebuild size). Copies reserve only the structure alignment, so they never release a live neighbour. Bounded logs report new pools and the private storage total. - `find` prefers a registered pool over a guest-memory pool, so a native address inside a guest CPU range keeps its old meaning. - `commands/build_raytracing/guest_addresses.rs` (new): scratch, geometry, TLAS instance records and size reports go through `command_buffer_address_flags`, the import views and CBVs already use. Instance records in title memory are patched by the existing GPU instance fixup through that import. A remaining `Direct` refusal (which fails the whole `ExecuteCommandLists` batch once anything is relocated) is logged once. - `scene_view.rs`: a ray-query scene in title memory resolves to its private storage. - `XboxBvhBuilder` rehydration still returns `E_NOTIMPL`, but now says so in a bounded log. ProjectScarlett doesn't call it. ## Test New Lanes scenario `ray-tracing-guest-memory`: one `VirtualAlloc` block holds vertices, an instance record, scratch, a BLAS and a TLAS using it. It builds the BLAS with a compacted-size report, clones it, builds the TLAS and reads all current sizes. - Without the change: `FAIL ... the build in title memory reported no compacted size (compacted 0, current 0, copy 0, scene 0)`, with vkd3d's `Failed to place destAccelerationStructure`. - With it: `PASS` (compacted 512, current 584, copy 584, scene 704 on RADV). RADV reports the TLAS's current size above its prebuild maximum (704 > 640), so the scenario only requires a non-zero scene size. Unit tests for the overlap rule are in `src/tests/device/blas/guest_memory.rs`. Not covered by Lanes yet: a scene submitted before the list that builds its BLAS, while that list waits for a title fence (the record-time publication above). I want to add that scenario before this leaves draft. ## BLAS control (second commit) Every build mode of `tools/check_frosty_blas.py` failed on `main` with `unaligned batch accepted`, before any ray query: since e8af9fd a refused build is skipped and the list kept, but the guest still expected `Close()` to fail. The second commit updates the six build-related negative checks; copy and size-query checks still expect an error. With that, the modes that need no retail data give identical results with this branch's and `main`'s `d3d12_xs.dll`: default, `--single-build`, `--gpu-instances`, `--promote-blas` and `--ambiguous-as` pass and match the desktop ray query (`70010,70120,80010,80120,dead`), `--copy-only` passes, `--reuse-blas` fails on both (`oversized BLAS copy accepted`, not touched here). ## ProjectScarlett Title 1.0.2.1, offline, 3840x2160. RX 9060 XT, Mesa 26.2.6 RADV, kernel 6.18, GE-Proton11-14, no preload. Build: `07db52f` with #258 and #308 merged plus this change; all my runs that reached world entry had #258. - No `Failed to place destAccelerationStructure` any more. At world entry the title's AS allocation gets one pool; private storage grows to 128-259 MiB over ~900 structures. - With record-time publication, the logged scenes reach only private storage (first scene ~3,900 instance records). ## Known issue: GPU fault at world entry In every run with this change, shortly after world entry, the compute ring faults on reads of a few consecutive pages, then the gfx ring times out and the kernel resets the GPU (twice a full MODE1 reset; once the whole desktop froze): ```text amdgpu: [gfxhub] page fault (src_id:0 ring:24 ...) thread vkd3d_queue amdgpu: in page starting at address 0x0000000d13caa000 from client 10 amdgpu: Faulty UTCL2 client ID: TCP (0x8) amdgpu: PERMISSION_FAULTS: 0x3 amdgpu: MAPPING_ERROR: 0x0 ``` The address differs per run but always lies in `0xd10000000`-`0xd1e000000`. Without this change, the same build ran past world entry for 39 minutes without it (but with every BLAS dropped, and a dark, very grainy picture). What I could rule out with temporary diagnostics: - reads of the private storage (it is at `0xffff8002...`-`0xffff8004...`) and storage released while still referenced (nothing was released before the fault) - untranslated build inputs (scratch, geometry, instances, reports): none - untranslated command arguments: no root descriptor, view, marker, query or wait address that `buffer_at` could not back - XboxBvhBuilder rehydration: never called - released label waits: with the release pushed to 120 s, none was released and the fault came anyway - ray-query dispatches: none of the lowered Scarlett ray programs was dispatched in any run What I see: in one run the first scene referenced 11 structures at `0xd0a10b100`-`0xd1b080100`, the same range as the faults, which the provider never built or copied. In another run the scenes had no such references and the fault came anyway. ## Open questions - Are `0xd0`-`0xd1...` guest addresses or native VAs? On RADV some native buffer VAs may be that low; I'm checking it next. - Does anyone see the same fault on NVIDIA, or on RADV with the amdgpu userptr preload? - Is a scene allowed to reference structures the provider never saw? If the title builds them through a path I'm not catching, which one? - How much private storage does the live set need? The 16 GB card already peaked at 14.1 GB before this change. ## Checks RX 9060 XT (RDNA4), Mesa 26.2.6 RADV, kernel 6.18, Proton Experimental (Lanes) and GE-Proton11-14 (game). - `python tuxbox.py check --no-gpu`: all six groups pass. - `python tuxbox.py verify --only lanes-selftest`: all 18 scenarios pass, including the new one and `ray-tracing-builder` (before the record-time publication and rehydration log commits; not rerun since). - Full GPU `check`: not run yet. - NVIDIA: not run. ## AI use This branch was made with an AI coding agent (Claude Opus 5.5 via Claude Code, following `AGENTS.md`). The agent analysed the run logs and the provider source, wrote the provider changes, the Lanes scenario, the unit tests, the control update, the temporary diagnostics behind the findings above (not part of the branch) and this description. I reviewed the first two commits before committing them. The game runs, the Lanes runs, the BLAS controls and the checks above ran on my machine. No title files, shader bytes or logs included.
NickStallman commented 2026-11-27 18:21:07 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T18:21:07Z.


We had a branch for the same problem and won't open it; yours covers more. Three things from it that may help, measured on an RTX 5090 (driver 620.70.10, GE-Proton11-14) unless noted.

1. The fault range is guest memory, and the 11 unbuilt structures look like cooked ones.
In a ProjectScarlett 1.0.2.1 run we read the 64-byte instance records bound beside each scene on the CPU and mapped where their structure addresses fall:

  • 164 to 182 distinct addresses;
  • 41 in the 0x14b070000 pool, where the builds go;
  • 123 in small mapped views (0.2 to 3 MiB each) inside one reserved span, 0x300200000 to 0x108a720000. Each is 0x100 past the start of its view, for example 0x90a500100, 0x910700100, 0xd27180100, 0xeb9980100. 89 instances pointed into a single 640 KiB view.

Your 0xd0a10b100-0xd1b080100 have the same …100 form and lie in that span, as does the fault range 0xd10000000-0xd1e000000. That run had the package's own builder staged, so I can't say from it that no build call ever targets those addresses; your log says the provider never built or copied them.

instance_fixup.hlsl (and the CPU patch) leaves an address it doesn't find in the table unchanged, so such a record reaches the host scene as a raw guest address. A top-level build reads each instance's bottom level, which would fault on the compute ring without any ray-query dispatch. That part is inference; I haven't run it.

Suggested test: count the instance addresses with no mapping at fixup, and write 0 for them (an instance with a null structure is inactive). If the fault goes, the remaining work is giving those streamed structures host builds, not the placement in this PR.

2. RADV's current size is the build size plus serialisation padding.
radv_acceleration_structure.c sets the header's size to the compacted size, plus the serialisation header and the bottom-level address list rounded up to 128 bytes, minus both. That is +72 for a bottom level and +64 for a scene with one instance: your 512 → 584 and 640 → 704, and our 384 → 456 for a single triangle (Raphael iGPU). It doesn't depend on the buffer. A title that sizes a copy from the current size sees more than its prebuild maximum on RADV.

3. A ray-hit test for scenes in title memory.
We gave tools/check_scarlett_rays.py a second pass in which the guest keeps vertices, instance records, scratch and both structures in memory it allocated, and binds each scene by the top level's address. On our branch:

Provider Scenes in buffers Scenes in title memory
main (65e3e48) 4 programs, failed=0 failed=5, 12, 10, 6
with our change 4 programs, failed=0 4 programs, failed=0

I haven't run it against this PR. It is two small commits (the guest mode, and a check that --xshader and --provider exist) that I can send as a PR on top of yours, or you can take them.

Our full checks of our own branch passed on NVIDIA (149/149); I'll run this PR's head on the 5090 and report.

<!-- greyfinch-sync:brcly/TuxBox:comment:7225397560 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7225397560). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T18:21:07Z. --- We had a branch for the same problem and won't open it; yours covers more. Three things from it that may help, measured on an RTX 5090 (driver 620.70.10, GE-Proton11-14) unless noted. **1. The fault range is guest memory, and the 11 unbuilt structures look like cooked ones.** In a ProjectScarlett 1.0.2.1 run we read the 64-byte instance records bound beside each scene on the CPU and mapped where their structure addresses fall: - 164 to 182 distinct addresses; - 41 in the `0x14b070000` pool, where the builds go; - 123 in small mapped views (0.2 to 3 MiB each) inside one reserved span, `0x300200000` to `0x108a720000`. Each is `0x100` past the start of its view, for example `0x90a500100`, `0x910700100`, `0xd27180100`, `0xeb9980100`. 89 instances pointed into a single 640 KiB view. Your `0xd0a10b100`-`0xd1b080100` have the same `…100` form and lie in that span, as does the fault range `0xd10000000`-`0xd1e000000`. That run had the package's own builder staged, so I can't say from it that no build call ever targets those addresses; your log says the provider never built or copied them. `instance_fixup.hlsl` (and the CPU patch) leaves an address it doesn't find in the table unchanged, so such a record reaches the host scene as a raw guest address. A top-level build reads each instance's bottom level, which would fault on the compute ring without any ray-query dispatch. That part is inference; I haven't run it. Suggested test: count the instance addresses with no mapping at fixup, and write 0 for them (an instance with a null structure is inactive). If the fault goes, the remaining work is giving those streamed structures host builds, not the placement in this PR. **2. RADV's current size is the build size plus serialisation padding.** `radv_acceleration_structure.c` sets the header's `size` to the compacted size, plus the serialisation header and the bottom-level address list rounded up to 128 bytes, minus both. That is +72 for a bottom level and +64 for a scene with one instance: your 512 → 584 and 640 → 704, and our 384 → 456 for a single triangle (Raphael iGPU). It doesn't depend on the buffer. A title that sizes a copy from the current size sees more than its prebuild maximum on RADV. **3. A ray-hit test for scenes in title memory.** We gave `tools/check_scarlett_rays.py` a second pass in which the guest keeps vertices, instance records, scratch and both structures in memory it allocated, and binds each scene by the top level's address. On our branch: | Provider | Scenes in buffers | Scenes in title memory | | --- | --- | --- | | `main` (65e3e48) | 4 programs, `failed=0` | `failed=5`, `12`, `10`, `6` | | with our change | 4 programs, `failed=0` | 4 programs, `failed=0` | I haven't run it against this PR. It is two small commits (the guest mode, and a check that `--xshader` and `--provider` exist) that I can send as a PR on top of yours, or you can take them. Our full checks of our own branch passed on NVIDIA (149/149); I'll run this PR's head on the 5090 and report.
NickStallman commented 2026-11-27 19:19:47 +00:00 (Migrated from github.com)

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


NVIDIA results for 561b8059:

  • Full check: python tuxbox.py check --adapter 10de:2b85 passed, 148 pass and 0 fail (RTX 5090, driver 620.70.10, GE-Proton11-14).
  • ProjectScarlett 1.0.2.1, 30 minutes, offline: this PR merged into main at 8ef909bb. There was no Xid, no device loss, no forced label release, and no Failed to place destAccelerationStructure.
  • The run tells you nothing about the world-entry fault: it never reached the world. A run of plain main under the same conditions didn't either. After the intro, both sat at about 1 fps while pipelines compiled for the rest of the 30 minutes, so I'll rerun once that's sorted out.

The ray-hit replay against this PR's provider is next.

<!-- greyfinch-sync:brcly/TuxBox:comment:7226418770 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7226418770). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T19:19:47Z. --- NVIDIA results for `561b8059`: - **Full check:** `python tuxbox.py check --adapter 10de:2b85` passed, 148 pass and 0 fail (RTX 5090, driver 620.70.10, GE-Proton11-14). - **ProjectScarlett 1.0.2.1, 30 minutes, offline:** this PR merged into `main` at `8ef909bb`. There was no Xid, no device loss, no forced label release, and no `Failed to place destAccelerationStructure`. - **The run tells you nothing about the world-entry fault:** it never reached the world. A run of plain `main` under the same conditions didn't either. After the intro, both sat at about 1 fps while pipelines compiled for the rest of the 30 minutes, so I'll rerun once that's sorted out. The ray-hit replay against this PR's provider is next.
NickStallman commented 2026-11-27 19:50:32 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T19:50:32Z.


Ray-hit replay against this PR's provider (561b8059 plus our two tools/ commits, RTX 5090, 620.70.10, GE-Proton11-14): all 4 programs show failed=0, both with the scenes in buffers and with the scenes in title memory. main gave failed=5, 12, 10 and 6 in the title-memory pass. So the placement in this PR gives the same ray hits as our branch did.

<!-- greyfinch-sync:brcly/TuxBox:comment:7226922705 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7226922705). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T19:50:32Z. --- Ray-hit replay against this PR's provider (`561b8059` plus our two `tools/` commits, RTX 5090, 620.70.10, GE-Proton11-14): all 4 programs show `failed=0`, both with the scenes in buffers and with the scenes in title memory. `main` gave `failed=5`, `12`, `10` and `6` in the title-memory pass. So the placement in this PR gives the same ray hits as our branch did.
brcly commented 2026-11-27 20:00:59 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-27T20:00:59Z.


Update the PR when you're ready to merge and I'll have a look

<!-- greyfinch-sync:brcly/TuxBox:comment:7227091383 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7227091383). Originally posted by [brcly](https://github.com/brcly) on 2026-11-27T20:00:59Z. --- Update the PR when you're ready to merge and I'll have a look
Jerkin42 commented 2026-11-27 23:51:44 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-27T23:51:44Z.


I think I hit the same world-entry fault on the same card (RX 9060 XT, RADV 26.1.8), with a local branch that builds the title-memory BLASes much like this one. In my case it came from geometry formats the console uses and the host doesn't, not from the structure placement.

What an audit of the title's BLAS build inputs showed (ProjectScarlett 1.0.2.1):

  • Index format 53 on 548 geometries in one run. That isn't R16 or R32: it is a meshlet-coded index stream. With _ => 0 in the index match, the index range has 0 bytes, and in my branch native(addr, 0) returned the title pointer unchanged, so it reached the GPU as a raw address. The faults stopped when I decoded it. Your IndexBuffer = native(..., bytes, ...) with bytes == 0 may do the same; worth checking what native returns for an empty range.
  • Positions stored as 8-byte quantized records, declared as R32G32_FLOAT with stride 8 (175 geometries). The real data needs a 32-byte header just before StartAddress (origin, order, scale), and read as R32G32 the positions come out as garbage.
  • Two smaller ones:
    • some VertexCount ranges run past committed memory (checking only the first page doesn't catch it);
    • some R16 indices exceed VertexCount (e.g. 3747 against 16).

The format 53 layout, as far as I decoded it:

  • dword 0 = 0x80000000 | meshlet count, dword 1 = triangle count;
  • then 16-byte meshlet records;
  • then one dword per triangle: meshlet index in bits 21 and up, plus three 7-bit local vertex indices;
  • then the u16 vertex lists. A meshlet's list starts at 2 * (((M0 << 2) & 0x10000) | (M1 & 0xffff)), where M0 and M1 are its record's first two dwords.

Rebuilt that way, triangles matched the retail builder's leaves on 61,973 of 61,973 paired leaves.

What fixed it for me:

  • decode both formats into ordinary upload buffers (R32 indices, R32G32B32 positions);
  • size the vertex range by the largest index;
  • require the whole range to be committed;
  • refuse an unknown index format instead of passing it through.

After that, a run decoded 256+ builds and had no GPU page fault through to "Game Running". I can open the decoder as a follow-up PR on top of this one if that helps.

<!-- greyfinch-sync:brcly/TuxBox:comment:7230463757 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7230463757). Originally posted by [Jerkin42](https://github.com/Jerkin42) on 2026-11-27T23:51:44Z. --- I think I hit the same world-entry fault on the same card (RX 9060 XT, RADV 26.1.8), with a local branch that builds the title-memory BLASes much like this one. In my case it came from geometry formats the console uses and the host doesn't, not from the structure placement. **What an audit of the title's BLAS build inputs showed (ProjectScarlett 1.0.2.1):** - **Index format 53** on 548 geometries in one run. That isn't R16 or R32: it is a meshlet-coded index stream. With `_ => 0` in the index match, the index range has 0 bytes, and in my branch `native(addr, 0)` returned the title pointer unchanged, so it reached the GPU as a raw address. The faults stopped when I decoded it. Your `IndexBuffer = native(..., bytes, ...)` with `bytes == 0` may do the same; worth checking what `native` returns for an empty range. - **Positions stored as 8-byte quantized records**, declared as `R32G32_FLOAT` with stride 8 (175 geometries). The real data needs a 32-byte header just before `StartAddress` (origin, order, scale), and read as R32G32 the positions come out as garbage. - **Two smaller ones:** - some `VertexCount` ranges run past committed memory (checking only the first page doesn't catch it); - some R16 indices exceed `VertexCount` (e.g. 3747 against 16). **The format 53 layout, as far as I decoded it:** - dword 0 = `0x80000000 | meshlet count`, dword 1 = triangle count; - then 16-byte meshlet records; - then one dword per triangle: meshlet index in bits 21 and up, plus three 7-bit local vertex indices; - then the u16 vertex lists. A meshlet's list starts at `2 * (((M0 << 2) & 0x10000) | (M1 & 0xffff))`, where M0 and M1 are its record's first two dwords. Rebuilt that way, triangles matched the retail builder's leaves on 61,973 of 61,973 paired leaves. **What fixed it for me:** - decode both formats into ordinary upload buffers (R32 indices, R32G32B32 positions); - size the vertex range by the largest index; - require the whole range to be committed; - refuse an unknown index format instead of passing it through. After that, a run decoded 256+ builds and had no GPU page fault through to "Game Running". I can open the decoder as a follow-up PR on top of this one if that helps.
Jerkin42 commented 2026-11-28 05:09:34 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-28T05:09:34Z.


@gtb-sbe, following up on the geometry decoder above (index format 53 and the 8-byte quantized positions): would you like me to open it as a separate PR stacked on this branch, or would you rather fold those formats into this PR yourself? Either works for me. I'll wait for your preference so we don't both change the same build path.

<!-- greyfinch-sync:brcly/TuxBox:comment:7234493648 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7234493648). Originally posted by [Jerkin42](https://github.com/Jerkin42) on 2026-11-28T05:09:34Z. --- @gtb-sbe, following up on the geometry decoder above (index format 53 and the 8-byte quantized positions): would you like me to open it as a separate PR stacked on this branch, or would you rather fold those formats into this PR yourself? Either works for me. I'll wait for your preference so we don't both change the same build path.
NickStallman commented 2026-11-28 06:12:19 +00:00 (Migrated from github.com)

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


@Jerkin42, your format-53 decoder would help us too; I'd welcome it as a PR stacked on this one. Here's what we measured with this PR merged into main plus our mesh-loop fix (#372), on an RTX 5090 (620.70.10):

  • The earlier faults are gone. With this PR, vkd3d-proton logs no more "Failed to place destAccelerationStructure" and no more postbuild "Invalid resource" (123 and 97 in the run without it). A front-end write fault (Xid 31) we had seen is also gone.
  • The index buffers still pass through raw. About 12 minutes into the story, 581 distinct BLAS index-buffer addresses reached vkd3d-proton untranslated. All were in the title's reserved streaming span (0x90032e100–0xef8238500), 16-byte aligned, and inside no registered buffer.
    • In guest_addresses::geometry, any index format other than R16_UINT or R32_UINT is sized as 0 bytes, so it is never resolved and its raw address is passed through.
    • vkd3d-proton (acceleration_structure.c:90-98 at cae8353e) treats any index format other than UNKNOWN or R16_UINT as R32_UINT at that address.
  • What followed: about 27 seconds after these lines started, the GPU raised Xid 13 (an SM warp MMU fault). The link between the two is inferred.

Locally we're testing a stopgap that builds such a geometry empty, so no raw address reaches the host. It doesn't decode anything, so your decoder is the real fix. We'll post the run result here.

<!-- greyfinch-sync:brcly/TuxBox:comment:7235146468 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7235146468). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T06:12:19Z. --- @Jerkin42, your format-53 decoder would help us too; I'd welcome it as a PR stacked on this one. Here's what we measured with this PR merged into `main` plus our mesh-loop fix (#372), on an RTX 5090 (620.70.10): - **The earlier faults are gone.** With this PR, vkd3d-proton logs no more "Failed to place destAccelerationStructure" and no more postbuild "Invalid resource" (123 and 97 in the run without it). A front-end write fault (Xid 31) we had seen is also gone. - **The index buffers still pass through raw.** About 12 minutes into the story, 581 distinct BLAS index-buffer addresses reached vkd3d-proton untranslated. All were in the title's reserved streaming span (`0x90032e100`–`0xef8238500`), 16-byte aligned, and inside no registered buffer. - In `guest_addresses::geometry`, any index format other than R16_UINT or R32_UINT is sized as 0 bytes, so it is never resolved and its raw address is passed through. - vkd3d-proton (`acceleration_structure.c:90-98` at `cae8353e`) treats any index format other than UNKNOWN or R16_UINT as R32_UINT at that address. - **What followed:** about 27 seconds after these lines started, the GPU raised Xid 13 (an SM warp MMU fault). The link between the two is inferred. Locally we're testing a stopgap that builds such a geometry empty, so no raw address reaches the host. It doesn't decode anything, so your decoder is the real fix. We'll post the run result here.
Jerkin42 commented 2026-11-28 06:26:04 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-28T06:26:04Z.


@NickStallman thanks for the measurements. I opened #375, stacked on this branch. It decodes format 53 on the CPU into R32_UINT indices, in an upload buffer the list keeps, and sizes the vertex range by the largest decoded index. Any other index format the host can't read now refuses the build instead of passing the address through.

I left out the packed 8-byte positions (R32G32_FLOAT, stride 8) for now: that layout is also valid D3D12, so decoding it needs a reliable way to tell the two apart. It hasn't been run in game on this branch yet.

<!-- greyfinch-sync:brcly/TuxBox:comment:7235291562 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7235291562). Originally posted by [Jerkin42](https://github.com/Jerkin42) on 2026-11-28T06:26:04Z. --- @NickStallman thanks for the measurements. I opened #375, stacked on this branch. It decodes format 53 on the CPU into R32_UINT indices, in an upload buffer the list keeps, and sizes the vertex range by the largest decoded index. Any other index format the host can't read now refuses the build instead of passing the address through. I left out the packed 8-byte positions (R32G32_FLOAT, stride 8) for now: that layout is also valid D3D12, so decoding it needs a reliable way to tell the two apart. It hasn't been run in game on this branch yet.
NickStallman commented 2026-11-28 06:43:36 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T06:43:36Z.


A correction to what this PR and our earlier comment assumed, with what we're doing about it. Measured on an RTX 5090 (620.70.10) with this PR merged locally.

ProjectScarlett does call rehydration.

  • game_scarlett_master.exe imports XboxBvhBuilder::RehydrateRaytracingAccelerationStructureBatched2X (hint 7). The package DLL exports only the Batched and Batched2X rehydrate entry points.
  • With this PR's "refused rehydration" log, every run that reaches the story makes 16 or more calls of 16 structures each, at least 256 bottom-level structures. tuxbox_bvh_rehydrate2 (runtime/bvh/src/lib.rs:146) answers E_NOTIMPL to all of them.
  • Every logged entry is in place (dest == source), scratch 0, bottom level, flags 0x14, NumDescs 1–12, an array of geometry descs. Dests are in the title's reserved streaming span, ending in …100 or at 256-byte steps after it. The extra addresses array is always dest − 0x600000000.
  • These are the "pre-cooked" structures from my first comment. Nothing is built at those destinations, so the TLAS instances keep raw title addresses. Matching the two sets address for address is inferred: same span, same …100 form.

What that does on the 5090.

  • With this PR plus #372, #373 and a stopgap that builds format-53 geometry empty, the remaining fault was an Xid 13 about 35 s after the story load.
  • vkd3d's device-fault report gives a ReadInvalid at 0x926c95000, in the same span and about 212 KiB past refused rehydration destinations, with no allocation there.
  • Breadcrumbs put the running command at a top-level build over 3,140 instances whose own buffers were all valid host addresses.
  • The connection to the refused structures is inferred.

What we're doing. The cooked data holds no vertices: its leaves carry geometry and primitive indices only, and rehydration reads the title's own geometry. So each rehydrate entry can be handled as an ordinary bottom-level build of the geometry descs it carries, through this PR's title-memory path. That needs format-53 indices (#375) and the 8-byte quantized positions decoded. We're writing that now, on top of this PR and #375, and will open it as a PR stacked on #375 with a Lanes scenario and game results.

@Jerkin42, if you already decode the quantized positions, say so and we'll use yours rather than write a second decoder.

<!-- greyfinch-sync:brcly/TuxBox:comment:7235479599 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7235479599). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T06:43:36Z. --- A correction to what this PR and our earlier comment assumed, with what we're doing about it. Measured on an RTX 5090 (620.70.10) with this PR merged locally. **ProjectScarlett does call rehydration.** - `game_scarlett_master.exe` imports `XboxBvhBuilder::RehydrateRaytracingAccelerationStructureBatched2X` (hint 7). The package DLL exports only the Batched and Batched2X rehydrate entry points. - With this PR's "refused rehydration" log, every run that reaches the story makes 16 or more calls of 16 structures each, at least 256 bottom-level structures. `tuxbox_bvh_rehydrate2` (`runtime/bvh/src/lib.rs:146`) answers `E_NOTIMPL` to all of them. - **Every logged entry** is in place (dest == source), scratch 0, bottom level, flags `0x14`, `NumDescs` 1–12, an array of geometry descs. Dests are in the title's reserved streaming span, ending in `…100` or at 256-byte steps after it. The extra `addresses` array is always dest − `0x600000000`. - **These are the "pre-cooked" structures from my first comment.** Nothing is built at those destinations, so the TLAS instances keep raw title addresses. Matching the two sets address for address is inferred: same span, same `…100` form. **What that does on the 5090.** - With this PR plus #372, #373 and a stopgap that builds format-53 geometry empty, the remaining fault was an Xid 13 about 35 s after the story load. - vkd3d's device-fault report gives a `ReadInvalid` at `0x926c95000`, in the same span and about 212 KiB past refused rehydration destinations, with no allocation there. - Breadcrumbs put the running command at a top-level build over 3,140 instances whose own buffers were all valid host addresses. - The connection to the refused structures is inferred. **What we're doing.** The cooked data holds no vertices: its leaves carry geometry and primitive indices only, and rehydration reads the title's own geometry. So each rehydrate entry can be handled as an ordinary bottom-level build of the geometry descs it carries, through this PR's title-memory path. That needs format-53 indices (#375) and the 8-byte quantized positions decoded. We're writing that now, on top of this PR and #375, and will open it as a PR stacked on #375 with a Lanes scenario and game results. @Jerkin42, if you already decode the quantized positions, say so and we'll use yours rather than write a second decoder.
NickStallman commented 2026-11-28 11:20:15 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T11:20:15Z.


Following up on our note above: the rehydration fix is now #394, stacked on #376. RehydrateRaytracingAccelerationStructureBatched2X becomes host builds of each entry's geometry, read through XMem's backing. In ProjectScarlett on an RTX 5090, with #376's 14-bit stride mask, a run logged 84 rehydrations and none skipped. Lanes ray-tracing-rehydrate passes on NVIDIA and AMD.

<!-- greyfinch-sync:brcly/TuxBox:comment:7238484136 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7238484136). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T11:20:15Z. --- Following up on our note above: the rehydration fix is now #394, stacked on #376. `RehydrateRaytracingAccelerationStructureBatched2X` becomes host builds of each entry's geometry, read through XMem's backing. In ProjectScarlett on an RTX 5090, with #376's 14-bit stride mask, a run logged 84 rehydrations and none skipped. Lanes `ray-tracing-rehydrate` passes on NVIDIA and AMD.
1093i3511 commented 2026-11-28 11:49:57 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T11:49:57Z.


A data point from RDNA2 without this change. It may help separate what this PR causes from what happens at world entry anyway on RADV.

Setup

RX 6600 (1002:73ff, RDNA2, 8 GB), Ryzen 5 5600, 32 GB RAM + 34 GB swap, Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14. ProjectScarlett 1.0.2.1, offline, 3840x2160, no preload. main at b426c1a, D3D12 provider sha256 7ae6d1db…de720cb2, Microsoft DXC 1.9.2609, shaders prepared. Host profile: adapter=1002:73ff wave=32-64 section-import=substituted descriptor-bytes=64/16 mesh=yes rays=yes.

What happened

This is the first run on this card that got past the #215 watchdog. All five earlier runs, on 7953f0a and before, ended on it in the intro Prestream. This time the intro presented 1–14 frames per second instead of 0.5. The title set mission 0x98c85f2a at frame 15,258, after 39 minutes. Then, within about 11 s:

  1. vkd3d-proton dropped 379 builds with Failed to place destAccelerationStructure. Dropping call. There were none earlier in the run; all 379 fall in those last 11 s, around the frames where the mission was set.
  2. The kernel timed out the gfx ring:
    amdgpu: ring gfx_0.0.0 timeout, signaled seq=798507, emitted seq=798509
    amdgpu:  Process game_scarlett_m ... thread vkd3d_queue
    amdgpu: Ring gfx_0.0.0 reset succeeded
    amdgpu: [drm] device wedged, but no recovery needed
    
  3. vkd3d reported VK_ERROR_DEVICE_LOST, the provider logged direct queue rejected a guest command-list batch, and the title stopped on a breakpoint (exit code 3) at frame 15,262.

Unlike your known issue, there was no gfxhub page fault and no MODE1 reset, only the ring timeout and a ring reset. In the last 25 lines before the hang the log also shows a skipped compute dispatch (pipeline has no paged descriptor layout: its root indexes the resource heap directly, guest caller 0x248cbc1, 11 in the whole run) and placed texture alias handled without failing the queue messages.

How this relates to the PR

  • On your card, main without this change ran past world entry for 39 minutes. On this card it hangs within seconds of world entry without the change. So the gfx timeout after world entry is not caused by this PR alone on RDNA2. It could be the dropped builds themselves, or whatever the frame does with the scenes they should have produced. I can't tell which from this run.
  • On your question about private storage: here VRAM was already full (8.1 of 8.2 GB used on the card), with 10.1 GB in GTT, 29 of 32 GB RAM and 11.4 GB swap in use, before any BLAS was built. These are whole-card and whole-system samples every 10 s; I have no per-process numbers for this run. Another 128–259 MiB of private storage is small next to that, but the card has no room left.

Not established

  • Whether the dropped builds cause the hang, or only come just before it.
  • Whether this hang is the same fault as yours seen differently on RDNA2 (ring timeout instead of a page fault).
  • One run only.

I can run this branch on the same setup and report whether the drops go away and how it ends. I'd add per-process VRAM and GTT samples to that run.

<!-- greyfinch-sync:brcly/TuxBox:comment:7238811387 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7238811387). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T11:49:57Z. --- A data point from RDNA2 **without** this change. It may help separate what this PR causes from what happens at world entry anyway on RADV. ## Setup RX 6600 (`1002:73ff`, RDNA2, 8 GB), Ryzen 5 5600, 32 GB RAM + 34 GB swap, Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14. ProjectScarlett 1.0.2.1, offline, 3840x2160, no preload. `main` at b426c1a, D3D12 provider sha256 `7ae6d1db…de720cb2`, Microsoft DXC 1.9.2609, shaders prepared. Host profile: `adapter=1002:73ff wave=32-64 section-import=substituted descriptor-bytes=64/16 mesh=yes rays=yes`. ## What happened This is the first run on this card that got past the #215 watchdog. All five earlier runs, on 7953f0a and before, ended on it in the intro Prestream. This time the intro presented 1–14 frames per second instead of 0.5. The title set mission `0x98c85f2a` at frame 15,258, after 39 minutes. Then, within about 11 s: 1. vkd3d-proton dropped 379 builds with `Failed to place destAccelerationStructure. Dropping call.` There were none earlier in the run; all 379 fall in those last 11 s, around the frames where the mission was set. 2. The kernel timed out the gfx ring: ```text amdgpu: ring gfx_0.0.0 timeout, signaled seq=798507, emitted seq=798509 amdgpu: Process game_scarlett_m ... thread vkd3d_queue amdgpu: Ring gfx_0.0.0 reset succeeded amdgpu: [drm] device wedged, but no recovery needed ``` 3. vkd3d reported `VK_ERROR_DEVICE_LOST`, the provider logged `direct queue rejected a guest command-list batch`, and the title stopped on a breakpoint (exit code 3) at frame 15,262. Unlike your known issue, there was **no gfxhub page fault** and no MODE1 reset, only the ring timeout and a ring reset. In the last 25 lines before the hang the log also shows a skipped compute dispatch (`pipeline has no paged descriptor layout: its root indexes the resource heap directly`, guest caller `0x248cbc1`, 11 in the whole run) and `placed texture alias handled without failing the queue` messages. ## How this relates to the PR - On your card, `main` without this change ran past world entry for 39 minutes. On this card it hangs within seconds of world entry without the change. So the gfx timeout after world entry is not caused by this PR alone on RDNA2. It could be the dropped builds themselves, or whatever the frame does with the scenes they should have produced. I can't tell which from this run. - On your question about private storage: here VRAM was already full (8.1 of 8.2 GB used on the card), with 10.1 GB in GTT, 29 of 32 GB RAM and 11.4 GB swap in use, before any BLAS was built. These are whole-card and whole-system samples every 10 s; I have no per-process numbers for this run. Another 128–259 MiB of private storage is small next to that, but the card has no room left. ## Not established - Whether the dropped builds cause the hang, or only come just before it. - Whether this hang is the same fault as yours seen differently on RDNA2 (ring timeout instead of a page fault). - One run only. I can run this branch on the same setup and report whether the drops go away and how it ends. I'd add per-process VRAM and GTT samples to that run.
1093i3511 commented 2026-11-28 12:07:49 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-28T12:07:49Z.


Follow-up to my comment above: a second run on the same build (main b426c1a, still without this change) reproduced the ending, this time with per-process memory numbers.

Same ending, after 5 minutes instead of 39

With the Mesa cache and the link translations from the first run warm, the title reached world entry after 5 minutes. It set mission 0x98c85f2a at frame 1,748. Then came 315 Failed to place destAccelerationStructure. Dropping call. and the same ring gfx_0.0.0 timeout with a ring reset (no page fault). The title stopped with exit code 3 at frame 1,752. The first run ended the same way, 4 frames after the same mission was set.

So on this card the hang follows the start of the mission at world entry, not run time. In both runs the dropped builds start at that point, and the ring times out about 10 s later.

Memory at the hang

The game process's amdgpu counters (/proc/<pid>/fdinfo), sampled every 10 s. The last sample was 2 s before the ring timeout:

MiB
amd-requested-vram 14,646
amd-requested-gtt 2,528
drm-memory-vram (resident) 7,108
drm-memory-gtt (resident) 10,066
amd-evicted-vram 0
  • The process asks for about 17 GB of GPU memory on an 8 GB card. About 7.5 GB of what it requested as VRAM lives in GTT.
  • VRAM was full from about 3 minutes in. The largest step was +4 GB of VRAM within 10 s while loading.
  • Host memory was tight but not exhausted at the hang: 29.4 of 32 GB RAM, 8.8 of 34 GB swap, card GTT 11.4 of 16 GB. There was no Not enough memory for command submission.

So this hang doesn't look like an allocation failure. Your 128–259 MiB of private storage would come on top of a VRAM that is already full.

Not established

  • Whether the dropped builds cause the hang. My guess: a scene ends up referencing structures that were never built, and that GPU work never finishes. I haven't tested this. Running this branch would show it, and that's the next run I plan on this card, with the same sampling.
<!-- greyfinch-sync:brcly/TuxBox:comment:7239013910 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7239013910). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T12:07:49Z. --- Follow-up to my comment above: a second run on the same build (`main` b426c1a, still without this change) reproduced the ending, this time with per-process memory numbers. ## Same ending, after 5 minutes instead of 39 With the Mesa cache and the link translations from the first run warm, the title reached world entry after 5 minutes. It set mission `0x98c85f2a` at frame 1,748. Then came 315 `Failed to place destAccelerationStructure. Dropping call.` and the same `ring gfx_0.0.0 timeout` with a ring reset (no page fault). The title stopped with exit code 3 at frame 1,752. The first run ended the same way, 4 frames after the same mission was set. So on this card the hang follows the start of the mission at world entry, not run time. In both runs the dropped builds start at that point, and the ring times out about 10 s later. ## Memory at the hang The game process's amdgpu counters (`/proc/<pid>/fdinfo`), sampled every 10 s. The last sample was 2 s before the ring timeout: | | MiB | | --- | ---: | | `amd-requested-vram` | 14,646 | | `amd-requested-gtt` | 2,528 | | `drm-memory-vram` (resident) | 7,108 | | `drm-memory-gtt` (resident) | 10,066 | | `amd-evicted-vram` | 0 | - The process asks for about 17 GB of GPU memory on an 8 GB card. About 7.5 GB of what it requested as VRAM lives in GTT. - VRAM was full from about 3 minutes in. The largest step was +4 GB of VRAM within 10 s while loading. - Host memory was tight but not exhausted at the hang: 29.4 of 32 GB RAM, 8.8 of 34 GB swap, card GTT 11.4 of 16 GB. There was no `Not enough memory for command submission`. So this hang doesn't look like an allocation failure. Your 128–259 MiB of private storage would come on top of a VRAM that is already full. ## Not established - Whether the dropped builds cause the hang. My guess: a scene ends up referencing structures that were never built, and that GPU work never finishes. I haven't tested this. Running this branch would show it, and that's the next run I plan on this card, with the same sampling.
1093i3511 commented 2026-11-28 12:29:17 +00:00 (Migrated from github.com)

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


I ran this PR on the RX 6600 from my comments above. It was merged locally into main at b426c1a: one conflict, in the Lanes list in project_tuxbox/verify.py, where I kept both sides. tuxbox.py check --no-gpu passes. D3D12 provider sha256 e1e11ef5…56348877. Same setup otherwise: RDNA2, Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14, warm shader caches.

The dropped builds are gone

  • Failed to place destAccelerationStructure: 0. The two runs on main without this change had 379 and 315.
  • One guest-memory pool was created. Its private storage grew to 64 MiB.

It ends in your known issue, on RDNA2 too

The title set mission 0x98c85f2a at frame 4,973, after about 7 minutes. It ended at frame 4,979 with exit code 3. The kernel log:

13:23:55 amdgpu: [gfxhub] page fault (src_id:0 ring:24 vmid:5 pasid:191) ... thread vkd3d_queue
         in page starting at address 0x0000000969fc0000 from client 0x1b (UTCL2)
         GCVM_L2_PROTECTION_FAULT_STATUS:0x00501031
         Faulty UTCL2 client ID: TCP (0x8)
         MORE_FAULTS: 0x1  WALKER_ERROR: 0x0  PERMISSION_FAULTS: 0x3  MAPPING_ERROR: 0x0  RW: 0x0
13:23:57 amdgpu: ring comp_1.0.1 timeout ... Ring comp_1.0.1 reset succeeded
13:24:09 amdgpu: ring gfx_0.0.0 timeout ... Ring gfx_0.0.0 reset succeeded

There were 10 fault reports, all on ring 24, at these pages:

page reports
0x969fbf000 2
0x969fc0000 4
0xd2115c000 2
0xe9cf49000 2

These are the same client, status and permission fault as on your RX 9060 XT, so it isn't specific to RDNA4. Two things differ:

  • No MODE1 reset. Both ring resets succeeded and the desktop kept running.
  • The addresses are spread wider. Yours always lay in 0xd10000000–0xd1e000000; one of mine is just above that range, the others far outside it.

Without this change, the same build on this card ended with a plain gfx ring timeout and no page fault.

The title calls rehydration here

Your PR description says ProjectScarlett doesn't call XboxBvhBuilder rehydration. In this run it did, 16 times with 16 structures each, all refused by the new log:

TuxBox XboxBvhBuilder: refused rehydration #16 of 16 structures (256 so far, addresses given): cooked console nodes are not built

The refusals came about 2 minutes before the first page fault, by vkd3d's timestamps. Your note says one run's first scene referenced 11 structures that the provider never built or copied. 256 refused rehydrations would be one source of such structures. That is a guess, not tested. #394 (on #376) implements rehydration, so a run with it should show whether the faults follow the refused structures.

Memory

The game process's own amdgpu counters (/proc/<pid>/fdinfo), in the last sample before the fault (13:23:45):

MiB
amd-requested-vram 15,389
amd-requested-gtt 2,654
drm-memory-vram (resident) 7,117
drm-memory-gtt (resident) 10,927

Host memory: 29.0 of 32 GB RAM, 11.9 of 34 GB swap. That is about 0.7 GB more requested VRAM than on main (14,646 MiB), most of it not this PR's private storage (64 MiB). The growth in GTT after 13:23:55 is after the fault.

Not established

  • Whether the faulting pages belong to structures that were refused or never built.
  • One run with this branch.

I can run #394 on top of this next if that's useful.

<!-- greyfinch-sync:brcly/TuxBox:comment:7239260688 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7239260688). Originally posted by [1093i3511](https://github.com/1093i3511) on 2026-11-28T12:29:17Z. --- I ran this PR on the RX 6600 from my comments above. It was merged locally into `main` at b426c1a: one conflict, in the Lanes list in `project_tuxbox/verify.py`, where I kept both sides. `tuxbox.py check --no-gpu` passes. D3D12 provider sha256 `e1e11ef5…56348877`. Same setup otherwise: RDNA2, Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14, warm shader caches. ## The dropped builds are gone - `Failed to place destAccelerationStructure`: **0**. The two runs on `main` without this change had 379 and 315. - One guest-memory pool was created. Its private storage grew to 64 MiB. ## It ends in your known issue, on RDNA2 too The title set mission `0x98c85f2a` at frame 4,973, after about 7 minutes. It ended at frame 4,979 with exit code 3. The kernel log: ```text 13:23:55 amdgpu: [gfxhub] page fault (src_id:0 ring:24 vmid:5 pasid:191) ... thread vkd3d_queue in page starting at address 0x0000000969fc0000 from client 0x1b (UTCL2) GCVM_L2_PROTECTION_FAULT_STATUS:0x00501031 Faulty UTCL2 client ID: TCP (0x8) MORE_FAULTS: 0x1 WALKER_ERROR: 0x0 PERMISSION_FAULTS: 0x3 MAPPING_ERROR: 0x0 RW: 0x0 13:23:57 amdgpu: ring comp_1.0.1 timeout ... Ring comp_1.0.1 reset succeeded 13:24:09 amdgpu: ring gfx_0.0.0 timeout ... Ring gfx_0.0.0 reset succeeded ``` There were 10 fault reports, all on ring 24, at these pages: | page | reports | | --- | ---: | | `0x969fbf000` | 2 | | `0x969fc0000` | 4 | | `0xd2115c000` | 2 | | `0xe9cf49000` | 2 | These are the same client, status and permission fault as on your RX 9060 XT, so it isn't specific to RDNA4. Two things differ: - **No MODE1 reset.** Both ring resets succeeded and the desktop kept running. - **The addresses are spread wider.** Yours always lay in `0xd10000000`–`0xd1e000000`; one of mine is just above that range, the others far outside it. Without this change, the same build on this card ended with a plain gfx ring timeout and no page fault. ## The title calls rehydration here Your PR description says ProjectScarlett doesn't call `XboxBvhBuilder` rehydration. In this run it did, 16 times with 16 structures each, all refused by the new log: ```text TuxBox XboxBvhBuilder: refused rehydration #16 of 16 structures (256 so far, addresses given): cooked console nodes are not built ``` The refusals came about 2 minutes before the first page fault, by vkd3d's timestamps. Your note says one run's first scene referenced 11 structures that the provider never built or copied. 256 refused rehydrations would be one source of such structures. That is a guess, not tested. #394 (on #376) implements rehydration, so a run with it should show whether the faults follow the refused structures. ## Memory The game process's own amdgpu counters (`/proc/<pid>/fdinfo`), in the last sample before the fault (13:23:45): | | MiB | | --- | ---: | | `amd-requested-vram` | 15,389 | | `amd-requested-gtt` | 2,654 | | `drm-memory-vram` (resident) | 7,117 | | `drm-memory-gtt` (resident) | 10,927 | Host memory: 29.0 of 32 GB RAM, 11.9 of 34 GB swap. That is about 0.7 GB more requested VRAM than on `main` (14,646 MiB), most of it not this PR's private storage (64 MiB). The growth in GTT after 13:23:55 is after the fault. ## Not established - Whether the faulting pages belong to structures that were refused or never built. - One run with this branch. I can run #394 on top of this next if that's useful.
gtb-sbe commented 2026-11-28 17:41:11 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-11-28T17:41:11Z.


Thanks everyone for taking this further while I was away: the rehydration (#394) and the console geometry formats (#375, #376) were exactly the missing pieces.

A correction to my description: ProjectScarlett does call rehydration, as @NickStallman showed. My "doesn't call it" came from runs that faulted at world entry before the title got there. The structures my last runs found in small title-memory views outside the AS pool, with addresses ending in …100, match the rehydrated ones.

Follow-up in #406, for two ways a title-memory structure could still stay unbuilt while a scene points at it:

  • A build refused after its storage was reserved (an unreadable index format since #375, or a failed import) left published storage that nothing was built into, or that still held the replaced structure. Its instances are now inactive, with a log line.
  • Scratch the host can't reach (title GPU memory without CPU backing, which failed with ERROR_INVALID_ADDRESS on my card, or memory the title only reserved) now gets private scratch instead of refusing the build or reaching the host raw.

Both come with Lanes scenarios that fail on current main.

<!-- greyfinch-sync:brcly/TuxBox:comment:7243206991 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/320#issuecomment-7243206991). Originally posted by [gtb-sbe](https://github.com/gtb-sbe) on 2026-11-28T17:41:11Z. --- Thanks everyone for taking this further while I was away: the rehydration (#394) and the console geometry formats (#375, #376) were exactly the missing pieces. **A correction to my description:** ProjectScarlett does call rehydration, as @NickStallman showed. My "doesn't call it" came from runs that faulted at world entry before the title got there. The structures my last runs found in small title-memory views outside the AS pool, with addresses ending in `…100`, match the rehydrated ones. **Follow-up in #406**, for two ways a title-memory structure could still stay unbuilt while a scene points at it: - A build refused after its storage was reserved (an unreadable index format since #375, or a failed import) left published storage that nothing was built into, or that still held the replaced structure. Its instances are now inactive, with a log line. - Scratch the host can't reach (title GPU memory without CPU backing, which failed with `ERROR_INVALID_ADDRESS` on my card, or memory the title only reserved) now gets private scratch instead of refusing the build or reaching the host raw. Both come with Lanes scenarios that fail on current `main`.
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!320
No description provided.