D3D12.X: GPU addresses above 2^40 make the title's BVH builder throw ("more than 40b of address set") #585

Closed
opened 2026-11-26 04:26:24 +00:00 by github-bot · 4 comments
Owner

@⁠13hourstilliland on GitHub · 2026-11-24 02:09 UTC · original

On main 7ebf1b8 @⁠sub-north's run of the newer retail title (in #505) ends ~290 s in, before the watchdog, with:

D3D12 XDXR Error: DestAccelerationStructureData can not have more than 40b of address set
C++ exception thrown; stack: xboxbvhbuilder.dll+0xd2538, vcruntime140.dll+0x6480
process ends with status 0xe06d7363

with a GPU address of 0x1d1ae5c0000 (above 2^40 = 0x100_0000_0000). The check is in the title's own XboxBvhBuilder, so the address the title gets for its destination buffer has to stay under 40 bits, as it does on the console.

Where such an address can come from (read from the code, not measured)

  • gpu/uma.rs places the UMA at slot << 32 for slot in (4..512).step_by(4) (for_runtime_with, line 172; same loop in with_windows, line 379), so the base can be anywhere from 16 GiB to 2 TiB. Nothing in crates/xcl/src keeps it under 2^40. 0x1d1ae5c0000 is exactly slot 464 (base 0x1d0_0000_0000), window 1, offset 0xae5c0000, and window 1 is a sparse window holding large title reservations.
  • res_gpu_va_x (d3d12x/real.rs:1688) returns the host driver's GPU address for a buffer that is not a console buffer. That can also be above 2^40, depending on the driver.
  • The GPU-visible plain-memory fallback (kernelx.rs, reserve_watched) is VirtualAlloc(NULL), so it can land anywhere too.

How to tell which one it is: the log's UMA: … sparse VRAM window(s) … at 0x… line gives the base of that run. If it is 0x1d000000000, the UMA placement is the cause.

Possible fix (not written; a runtime change needs a regression run I cannot make)

  • Stop the slot search at base + 16 GiB <= 2^40 (slot <= 252). If nothing below fits, warn rather than go higher.
  • If the host-address path is the cause, an acceleration-structure buffer would need a console address in UMA, as console buffers already get.

Not tested: no run. I do not have the title's package. Static reading of main 508a0c7 only.

AI use: Claude Code (Claude Opus 5.5) read the XCL source and wrote this issue.

**@⁠13hourstilliland** on GitHub · 2026-11-24 02:09 UTC · [original](https://github.com/xcl-dev/xcl/issues/585) On `main` 7ebf1b8 @⁠sub-north's run of the newer retail title (in #505) ends ~290 s in, before the watchdog, with: ``` D3D12 XDXR Error: DestAccelerationStructureData can not have more than 40b of address set C++ exception thrown; stack: xboxbvhbuilder.dll+0xd2538, vcruntime140.dll+0x6480 process ends with status 0xe06d7363 ``` with a GPU address of `0x1d1ae5c0000` (above 2^40 = `0x100_0000_0000`). The check is in the title's own XboxBvhBuilder, so the address the title gets for its destination buffer has to stay under 40 bits, as it does on the console. **Where such an address can come from (read from the code, not measured)** - `gpu/uma.rs` places the UMA at `slot << 32` for `slot in (4..512).step_by(4)` (`for_runtime_with`, line 172; same loop in `with_windows`, line 379), so the base can be anywhere from 16 GiB to 2 TiB. Nothing in `crates/xcl/src` keeps it under 2^40. `0x1d1ae5c0000` is exactly slot 464 (base `0x1d0_0000_0000`), window 1, offset `0xae5c0000`, and window 1 is a sparse window holding large title reservations. - `res_gpu_va_x` (`d3d12x/real.rs:1688`) returns the host driver's GPU address for a buffer that is not a console buffer. That can also be above 2^40, depending on the driver. - The GPU-visible plain-memory fallback (`kernelx.rs`, `reserve_watched`) is `VirtualAlloc(NULL)`, so it can land anywhere too. **How to tell which one it is:** the log's `UMA: … sparse VRAM window(s) … at 0x…` line gives the base of that run. If it is `0x1d000000000`, the UMA placement is the cause. **Possible fix (not written; a runtime change needs a regression run I cannot make)** - Stop the slot search at `base + 16 GiB <= 2^40` (slot <= 252). If nothing below fits, warn rather than go higher. - If the host-address path is the cause, an acceleration-structure buffer would need a console address in UMA, as console buffers already get. **Not tested:** no run. I do not have the title's package. Static reading of `main` `508a0c7` only. AI use: Claude Code (Claude Opus 5.5) read the XCL source and wrote this issue.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:26:24 +00:00
Author
Owner

@⁠sub-north on GitHub · 2026-11-24 02:17 UTC · original

Measured data from another lab, in case it saves the implementer a couple of runs.

The check is exactly as described. In XboxBvhBuilder.dll: mov r8,[rdx] (desc+0x00, DestAccelerationStructureData), cmp r8,0x10000000000, jae -> message and 0x80070057. The same function checks Source (+0x20) and Scratch (+0x28) identically, plus size <= 2 GB (+0x58). It is a plain unsigned compare on the GPU VA.

Which path produced it here. Failing AS descriptors sat at 0x20eb5240000, 0x20eb7002b00, 0x20eb7f9c700, 0x20eb8824b00 - about 2.06 TiB, past the top of the UMA slot search (slots 4..512, max base 2 TiB). They did not come from res_gpu_va_x or a UMA base: they are GPU views of write-watched reservations, e.g. kernelx: reservation 0x208a0b30000 (0x600000000 bytes, no CPU access) is the GPU view of 0x202a0b30000. The view is the CPU reservation + 24 GiB, so a CPU-side placement that looks fine still yields a descriptor above 2^40.

We implemented roughly half the suggestion and measured it. VirtualAlloc2 + MEM_ADDRESS_REQUIREMENTS capped at 2^40 - 24 GiB placed a 24 GiB reservation at 0xee00000000 with its view at 0xf400000000, both under the ceiling, and that path works. But a 0x89700000 (2.3 GB) write-watched reservation found nothing below the ceiling and silently fell back:

mem: nothing below 0xfa00000000 for 0x89700000 write-watched bytes; falling back to any address

The wall was unchanged, at the same call. That 2.3 GB reservation is the one that matters - most likely the AS memory itself.

Suggestion: apply the ceiling to the write-watched/GPU-view reservation and to the VirtualAlloc(NULL) fallback, not only the slot search, and make an above-2^40 fallback a loud warning. The silent fallback hid this here for two runs.

No PR from us: crates/xcl/AGENTS.md excludes open-weight-model contributions, so this is a data point only.

**@⁠sub-north** on GitHub · 2026-11-24 02:17 UTC · [original](https://github.com/xcl-dev/xcl/issues/585#issuecomment-7119972869) Measured data from another lab, in case it saves the implementer a couple of runs. **The check is exactly as described.** In `XboxBvhBuilder.dll`: `mov r8,[rdx]` (desc+0x00, `DestAccelerationStructureData`), `cmp r8,0x10000000000`, `jae` -> message and `0x80070057`. The same function checks `Source` (+0x20) and `Scratch` (+0x28) identically, plus `size <= 2 GB` (+0x58). It is a plain unsigned compare on the GPU VA. **Which path produced it here.** Failing AS descriptors sat at `0x20eb5240000`, `0x20eb7002b00`, `0x20eb7f9c700`, `0x20eb8824b00` - about 2.06 TiB, past the top of the UMA slot search (slots 4..512, max base 2 TiB). They did not come from `res_gpu_va_x` or a UMA base: they are GPU views of write-watched reservations, e.g. `kernelx: reservation 0x208a0b30000 (0x600000000 bytes, no CPU access) is the GPU view of 0x202a0b30000`. The view is the CPU reservation + 24 GiB, so a CPU-side placement that looks fine still yields a descriptor above 2^40. **We implemented roughly half the suggestion and measured it.** `VirtualAlloc2` + `MEM_ADDRESS_REQUIREMENTS` capped at 2^40 - 24 GiB placed a 24 GiB reservation at `0xee00000000` with its view at `0xf400000000`, both under the ceiling, and that path works. But a `0x89700000` (2.3 GB) write-watched reservation found nothing below the ceiling and silently fell back: `mem: nothing below 0xfa00000000 for 0x89700000 write-watched bytes; falling back to any address` The wall was unchanged, at the same call. That 2.3 GB reservation is the one that matters - most likely the AS memory itself. **Suggestion:** apply the ceiling to the write-watched/GPU-view reservation and to the `VirtualAlloc(NULL)` fallback, not only the slot search, and make an above-2^40 fallback a loud warning. The silent fallback hid this here for two runs. No PR from us: `crates/xcl/AGENTS.md` excludes open-weight-model contributions, so this is a data point only.
Author
Owner

@⁠13hourstilliland on GitHub · 2026-11-24 02:42 UTC · original

Thanks @⁠sub-north, that settles it, and it corrects my issue text. My "slot 464" decode means nothing: every address above 16 GiB maps to some slot. Your data shows the addresses come from write-watched reservations, not the UMA windows.

Why those reservations land around 2 TiB: xcl.exe is linked with high-entropy VA (Rust's default), and Windows then places every bottom-up allocation in the process around 1 to 2.5 TiB. Measured with a probe linked both ways (Windows 11 26200): VirtualAlloc(NULL, 24 GiB) landed at 0x1e1cb8a0000 and up (20/20 above 2^40); with high-entropy VA off it landed from 0x7fff0000 (0/20).

So instead of capping each allocation, #631 links xcl.exe without high-entropy VA (build.rs, with a test of the PE flag). I have no retail title, so it needs a run on yours: smoke.ps1 on main and on the PR head, and whether the 40b of address set stop is gone. Allocations a title makes with MEM_TOP_DOWN would still go high. This change does not cover them.

AI use: Claude Code (Claude Opus 5.5).

**@⁠13hourstilliland** on GitHub · 2026-11-24 02:42 UTC · [original](https://github.com/xcl-dev/xcl/issues/585#issuecomment-7120397385) Thanks @⁠sub-north, that settles it, and it corrects my issue text. My "slot 464" decode means nothing: every address above 16 GiB maps to some slot. Your data shows the addresses come from write-watched reservations, not the UMA windows. Why those reservations land around 2 TiB: `xcl.exe` is linked with high-entropy VA (Rust's default), and Windows then places every bottom-up allocation in the process around 1 to 2.5 TiB. Measured with a probe linked both ways (Windows 11 26200): `VirtualAlloc(NULL, 24 GiB)` landed at `0x1e1cb8a0000` and up (20/20 above 2^40); with high-entropy VA off it landed from `0x7fff0000` (0/20). So instead of capping each allocation, #631 links `xcl.exe` without high-entropy VA (`build.rs`, with a test of the PE flag). I have no retail title, so it needs a run on yours: `smoke.ps1` on `main` and on the PR head, and whether the `40b of address set` stop is gone. Allocations a title makes with `MEM_TOP_DOWN` would still go high. This change does not cover them. AI use: Claude Code (Claude Opus 5.5).
Author
Owner

@⁠JFyuhong on GitHub · 2026-11-24 07:22 UTC · original · edited 2026-11-24 07:45 UTC

Four out-of-range acceleration-structure SRVs in the intro world load came from the same 2,199 MiB write-watched allocation. This confirms the allocation behind the SRV warnings that @⁠sub-north suspected.

Tested

  • Retail 1.0.2.1, Windows 11 build 26300, i7-14650HX, 32 GB RAM, RTX 4060 Laptop 8 GB (616.92), MSVC Rust 1.93.1. Release b54f6fe (#879 on a1672ef), default four windows. Ran xcl run offline with a saved profile, XCL_TRACE_MEM=10000 and XCL_ACTIVITY=1.
  • At 1.015 s, kernelx::VirtualAlloc logged the GPU-visible, write-watched fallback for size=0x89700000, flags=0x20003000, protect=0x2404. It returned 0x205158f0000. All four empty RT SRVs fell inside this allocation at offsets 0x14710000, 0x1646e600, 0x17408200 and 0x17c90a00. Live VirtualQueryEx independently reported that allocation base for all four addresses. Both 24 GiB views had other bases.
  • This run ended in Prestream at +0x23cf683 at 222.211 s, about 30 s after the last two-second interval with a present. In a separate run on #822 (e9705bb plus the #879 runtime change), 16 windows placed both 24 GiB views below 2^40. An RT SRV still appeared at 0x28400f80000, and the title again ended at +0x23cf683.
  • The builder's explicit 40-bit destination error also reproduced on clean #640 (808a8a4), both with the texture budget off and with XCL_PAGE_BUDGET_MB=4096. Peak title texture pages fell from 9,859 to 6,726 MiB in those two runs. Both raised 0xe06d7363.

Not tested

The builder did not print the value of its rejected destination. The measured allocation owns the four SRVs. Whether it also supplied DestAccelerationStructureData in a throwing run is still open.

Follow-up on the 2,199 MiB allocation

I repeated the b54f6fe four-window run on the same hardware, profile and 51-key shader seed. My earlier harness created a fresh title data directory each time and omitted XCL's learned cache/uma_coherent.txt. I copied the file XCL had actually written (4,804,771,840 bytes requested) into the new test profile. XCL automatically opened a 4,095 MiB coherent window instead of 512 MiB. The same size=0x89700000, flags=0x20003000, protect=0x2404 allocation now came from VirtualAlloc (graphics, coherent window) at 0x749400000. The four outside-UMA BVH SRV warnings fell to zero.

That placement change is enough for the four measured SRVs on this machine. The title still stopped in intro Prestream at +0x23cf683, about 29 s after the last present interval. Neither run in this particular A/B printed the builder's destination-address exception.

AI use

OpenAI Codex (GPT-6) ran the tests, matched the allocation records, and wrote this report.

**@⁠JFyuhong** on GitHub · 2026-11-24 07:22 UTC · [original](https://github.com/xcl-dev/xcl/issues/585#issuecomment-7124920774) · edited 2026-11-24 07:45 UTC Four out-of-range acceleration-structure SRVs in the intro world load came from the same **2,199 MiB write-watched allocation**. This confirms the allocation behind the SRV warnings that @⁠sub-north suspected. **Tested** - Retail 1.0.2.1, Windows 11 build 26300, i7-14650HX, 32 GB RAM, RTX 4060 Laptop 8 GB (616.92), MSVC Rust 1.93.1. Release `b54f6fe` (#879 on `a1672ef`), default four windows. Ran `xcl run` offline with a saved profile, `XCL_TRACE_MEM=10000` and `XCL_ACTIVITY=1`. - At 1.015 s, `kernelx::VirtualAlloc` logged the GPU-visible, write-watched fallback for `size=0x89700000, flags=0x20003000, protect=0x2404`. It returned `0x205158f0000`. All four empty RT SRVs fell inside this allocation at offsets `0x14710000`, `0x1646e600`, `0x17408200` and `0x17c90a00`. Live `VirtualQueryEx` independently reported that allocation base for all four addresses. Both 24 GiB views had other bases. - This run ended in Prestream at `+0x23cf683` at 222.211 s, about 30 s after the last two-second interval with a present. In a separate run on #822 (`e9705bb` plus the #879 runtime change), 16 windows placed both 24 GiB views below 2^40. An RT SRV still appeared at `0x28400f80000`, and the title again ended at `+0x23cf683`. - The builder's explicit 40-bit destination error also reproduced on clean #640 (`808a8a4`), both with the texture budget off and with `XCL_PAGE_BUDGET_MB=4096`. Peak title texture pages fell from 9,859 to 6,726 MiB in those two runs. Both raised `0xe06d7363`. **Not tested** The builder did not print the value of its rejected destination. The measured allocation owns the four SRVs. Whether it also supplied `DestAccelerationStructureData` in a throwing run is still open. **Follow-up on the 2,199 MiB allocation** I repeated the `b54f6fe` four-window run on the same hardware, profile and 51-key shader seed. My earlier harness created a fresh title data directory each time and omitted XCL's learned `cache/uma_coherent.txt`. I copied the file XCL had actually written (4,804,771,840 bytes requested) into the new test profile. XCL automatically opened a 4,095 MiB coherent window instead of 512 MiB. The same `size=0x89700000, flags=0x20003000, protect=0x2404` allocation now came from `VirtualAlloc (graphics, coherent window)` at `0x749400000`. The four outside-UMA BVH SRV warnings fell to zero. That placement change is enough for the four measured SRVs on this machine. The title still stopped in intro Prestream at `+0x23cf683`, about 29 s after the last present interval. Neither run in this particular A/B printed the builder's destination-address exception. **AI use** OpenAI Codex (GPT-6) ran the tests, matched the allocation records, and wrote this report.
Author
Owner

@⁠ivall on GitHub · 2026-11-24 10:06 UTC · original

Fixed on main (02bfd1d): #631 is merged (xcl.exe without high-entropy ASLR, so the title's memory stays under 2^40); AlexLopezDevelop's run with it went past the 40b of address set error. Please reopen if it shows up again on current main.

**@⁠ivall** on GitHub · 2026-11-24 10:06 UTC · [original](https://github.com/xcl-dev/xcl/issues/585#issuecomment-7128326614) Fixed on main (02bfd1d): #631 is merged (xcl.exe without high-entropy ASLR, so the title's memory stays under 2^40); AlexLopezDevelop's run with it went past the `40b of address set` error. Please reopen if it shows up again on current main.
This discussion has been locked. Commenting is limited to contributors.
No description provided.