D3D12.X: mirror buffer views outside unified memory into UMA #637

Open
github-bot wants to merge 1 commit from github-bot/gh-637 into main AGit
Owner

@⁠WTactic on GitHub · 2026-11-24 02:45 UTC · original
WTactic:buffer-views-outside-uma → main · +270 −28 · 3 files · 1 commits · open

When a title allocates resources outside XCL's mapped unified memory (UMA) windows and attempts to bind them into vertex or index buffers, native D3D12 device calls previously failed or produced invalid GPU virtual addresses.

This change transparently mirrors buffer views that fall outside the UMA memory windows into the coherent UMA pool (via safe_copy_from_title), allowing games with custom out-of-pool heap layouts to bind buffers cleanly.

What is in it

  • crates/xcl/src/hle/d3d12x/device_x.rs, crates/xcl/src/hle/d3d12x/list_x.rs, crates/xcl/src/hle/d3d12x/real.rs: mirror buffer views residing outside the 3 sparse UMA windows into the coherent memory region.

Tested

  • Hardware: NVIDIA GeForce RTX 4090, Intel Core i9-10850K @ 3.60 GHz, Windows 11 x64 (26200), rustc 1.97.1, release/debug
  • cargo test -p xcl --lib list_x::tests: 27 passed, 0 failed

Regression run
main (1d027e5):

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1529 (PresentX 1529)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15898 MB

PR (3217101):

xcl-smoke v1
commit: 32171011d20dacd2f87de84865be3ef1fcb96e86
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1590 (PresentX 1590)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18690 MB

Not tested

  • AMD RDNA GPU adapter.

AI use

  • Gemini 4 Hydrogen + custom harness: analyzed buffer address ranges, implemented mirror mapping, ran smoke tests, and wrote this description.
**@⁠WTactic** on GitHub · 2026-11-24 02:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/637) `WTactic:buffer-views-outside-uma` → `main` · +270 −28 · 3 files · 1 commits · open When a title allocates resources outside XCL's mapped unified memory (UMA) windows and attempts to bind them into vertex or index buffers, native D3D12 device calls previously failed or produced invalid GPU virtual addresses. This change transparently mirrors buffer views that fall outside the UMA memory windows into the coherent UMA pool (via `safe_copy_from_title`), allowing games with custom out-of-pool heap layouts to bind buffers cleanly. **What is in it** - `crates/xcl/src/hle/d3d12x/device_x.rs`, `crates/xcl/src/hle/d3d12x/list_x.rs`, `crates/xcl/src/hle/d3d12x/real.rs`: mirror buffer views residing outside the 3 sparse UMA windows into the coherent memory region. **Tested** - Hardware: NVIDIA GeForce RTX 4090, Intel Core i9-10850K @ 3.60 GHz, Windows 11 x64 (26200), `rustc 1.97.1`, release/debug - `cargo test -p xcl --lib list_x::tests`: 27 passed, 0 failed **Regression run** `main` (`1d027e5`): ``` xcl-smoke v1 commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1529 (PresentX 1529) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15898 MB ``` PR (`3217101`): ``` xcl-smoke v1 commit: 32171011d20dacd2f87de84865be3ef1fcb96e86 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1590 (PresentX 1590) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18690 MB ``` **Not tested** - AMD RDNA GPU adapter. **AI use** - Gemini 4 Hydrogen + custom harness: analyzed buffer address ranges, implemented mirror mapping, ran smoke tests, and wrote this description.
Buffer views (CBV, SRV, UAV) created for host allocations outside UMA
previously got an empty V# descriptor (num_records 0), causing shaders
translated to read buffer memory through mem to receive zeroes.

Mirror these buffers into unified memory on view creation and refresh
contents on update, committing lazy reservations and safely zeroing
uncommitted pages to avoid faults on unwritten output buffers.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:28:05 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 03:33 UTC · original

Test run of 0f418b034490020422a44a7662cedb58b5bca2cb on AMD RDNA4. I merged it onto current main 91f9a5e locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 694 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 654 passed, 0 failed, 21 ignored
  • 0 SKIPPED; buffer_views_outside_uma_are_mirrored and cbv_outside_uma_is_mirrored_and_refreshed pass.

Review: A view of a buffer outside unified memory now gets a mirror in UMA, and every path that fills the mirror copies from mirrors::source(va) (the title's current source for a moved page) after a readable check, so the copy cannot fault. The mirror is filled when a view is created and by the existing refresh path; I did not trace every CPU write path, so whether a title write between view creation and submit always reaches the mirror is not something this run shows.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 03:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7121205882) Test run of `0f418b034490020422a44a7662cedb58b5bca2cb` on AMD RDNA4. I merged it onto current `main` `91f9a5e` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **694 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 654 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `buffer_views_outside_uma_are_mirrored` and `cbv_outside_uma_is_mirrored_and_refreshed` pass. **Review:** A view of a buffer outside unified memory now gets a mirror in UMA, and every path that fills the mirror copies from `mirrors::source(va)` (the title's current source for a moved page) after a `readable` check, so the copy cannot fault. The mirror is filled when a view is created and by the existing refresh path; I did not trace every CPU write path, so whether a title write between view creation and submit always reaches the mirror is not something this run shows. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠iggyvilla on GitHub · 2026-11-24 04:00 UTC · original

Tested (PR head 0f418b0, not merged onto current main; RDNA2/wave64, which the PR lists under Not tested)

  • AMD Radeon RX 6650 XT 8 GB (RDNA2), driver 32.0.21045.29003; AMD Ryzen 7 5700X, 32 GB RAM;
    Windows 11 build 26300, rustc 1.100.0 (0ef1bc386 2026-11-09) stable-x86_64-pc-windows-msvc.
  • cargo build --release -p xcl — ok.
  • cargo build --workspace — ok (debug test title built).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on the PR head, debug:
    679 passed, 3 failed, 41 ignored, 0 skipped.
    • xcl lib: 639 passed, 3 failed, 21 ignored
    • console_dlls_e2e 13; console_shaders 3 passed, 4 ignored; disasm_e2e 1; e2e 3;
      gpu_compute_e2e 2; gpu_pso_e2e 7; heap_probe 4 ignored; pls_quota 1;
      predication_e2e 1; rpf_e2e 2; texture_states 1; xg_oracle 6 passed, 12 ignored.
    • No SKIPPED lines.
  • The three failures are the known failures of main on this card, not new ones:
    • placed_title_textures_share_vram_and_preserve_pixels — also fails alone:
      assertion left == right failed: 3D 64x64x64 4 mips: subresource 2 mismatch (#470).
    • transitions_apply_when_their_list_is_submitted and
      d32s8_targets_take_their_own_size_of_video_memory — PoisonError in the suite (the lock-poison
      cascade #673 fixes); both pass when run alone. Not caused by this PR.
  • The PR's own unit tests pass, in the suite and alone: buffer_views_outside_uma_are_mirrored and
    cbv_outside_uma_is_mirrored_and_refreshed.
  • 60 s smoke of the head with XCL_NETWORK=0, scripts/smoke.ps1 -Game D:\GTA6.Xbox.v1.0.2.1-CYBERLEEK,
    as printed:
xcl-smoke v1
commit: 0f418b034490020422a44a7662cedb58b5bca2cb
gpu: AMD Radeon RX 6650 XT
title: GTA6.Xbox.v1.0.2.1-CYBERLEEK
seconds: 60
exit: 0x0
frames shown: 883 (PresentX 883)
presents per 2 s (last 3): 35 38 37
device removals: 0
crashes: 0
peak commit: 12403 MB

For reference, a main run on this machine the same way (commit dd2ae9a, not this PR's base 508a0c7) is 569 frames, 23 24 23 presents per 2 s, peak commit 15856 MB, exit 0x0, 0 crashes. The
difference is reported as measured; this run does not attribute it to the PR.

Not tested

  • No retail-title run past the 60 s smoke (no measured menus/fps trajectory, no profile).
  • The PR head was not merged onto current main here; only the head as fetched was built and run.
  • Tests were the debug profile; the release build was only built (and used for the smoke), not tested.
  • No XCL_SAMPLE_* tests (none set).
  • The RDNA2 smoke above is one run; commit charge and fps were not compared A/B with the PR reverted.

AI use

opencode with DeepSeek V4.1 Flash (opencode-go/deepseek-v4.1-flash) ran the build, the tests and the smoke
run and wrote this report.

**@⁠iggyvilla** on GitHub · 2026-11-24 04:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7121627437) **Tested** (PR head `0f418b0`, not merged onto current `main`; RDNA2/wave64, which the PR lists under Not tested) - AMD Radeon RX 6650 XT 8 GB (RDNA2), driver 32.0.21045.29003; AMD Ryzen 7 5700X, 32 GB RAM; Windows 11 build 26300, `rustc 1.100.0 (0ef1bc386 2026-11-09) stable-x86_64-pc-windows-msvc`. - `cargo build --release -p xcl` — ok. - `cargo build --workspace` — ok (debug test title built). - `cargo test --workspace --no-fail-fast -- --test-threads=4` on the PR head, debug: **679 passed, 3 failed, 41 ignored, 0 skipped**. - `xcl` lib: 639 passed, 3 failed, 21 ignored - `console_dlls_e2e` 13; `console_shaders` 3 passed, 4 ignored; `disasm_e2e` 1; `e2e` 3; `gpu_compute_e2e` 2; `gpu_pso_e2e` 7; `heap_probe` 4 ignored; `pls_quota` 1; `predication_e2e` 1; `rpf_e2e` 2; `texture_states` 1; `xg_oracle` 6 passed, 12 ignored. - No `SKIPPED` lines. - The three failures are the known failures of `main` on this card, not new ones: - `placed_title_textures_share_vram_and_preserve_pixels` — also fails alone: `assertion left == right failed: 3D 64x64x64 4 mips: subresource 2 mismatch` (#470). - `transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory` — `PoisonError` in the suite (the lock-poison cascade #673 fixes); both **pass when run alone**. Not caused by this PR. - The PR's own unit tests pass, in the suite and alone: `buffer_views_outside_uma_are_mirrored` and `cbv_outside_uma_is_mirrored_and_refreshed`. - 60 s smoke of the head with `XCL_NETWORK=0`, `scripts/smoke.ps1 -Game D:\GTA6.Xbox.v1.0.2.1-CYBERLEEK`, as printed: ``` xcl-smoke v1 commit: 0f418b034490020422a44a7662cedb58b5bca2cb gpu: AMD Radeon RX 6650 XT title: GTA6.Xbox.v1.0.2.1-CYBERLEEK seconds: 60 exit: 0x0 frames shown: 883 (PresentX 883) presents per 2 s (last 3): 35 38 37 device removals: 0 crashes: 0 peak commit: 12403 MB ``` For reference, a `main` run on this machine the same way (commit `dd2ae9a`, **not** this PR's base `508a0c7`) is 569 frames, 23 24 23 presents per 2 s, peak commit 15856 MB, exit `0x0`, 0 crashes. The difference is reported as measured; this run does not attribute it to the PR. **Not tested** - No retail-title run past the 60 s smoke (no measured menus/fps trajectory, no profile). - The PR head was not merged onto current `main` here; only the head as fetched was built and run. - Tests were the debug profile; the release build was only built (and used for the smoke), not tested. - No `XCL_SAMPLE_*` tests (none set). - The RDNA2 smoke above is one run; commit charge and fps were not compared A/B with the PR reverted. **AI use** opencode with DeepSeek V4.1 Flash (opencode-go/deepseek-v4.1-flash) ran the build, the tests and the smoke run and wrote this report.
Author
Owner

@⁠Dukiverse on GitHub · 2026-11-24 04:03 UTC · original

Retail regression run of this PR: the retail title 1.0.2.1 (the same title as #675 and #616) crashes about 18–23 s in, inside mirror_of, with no input. main runs the full 60 s.

Tested

  • RTX 3090 24 GB (driver 621.14, 32-lane waves), i7-9700K, 64 GB RAM, Windows 11 Pro 25H2 (26200.8246), DXC 1.9.2609.5, release builds, XCL_NETWORK=0, nothing touched during the runs.
  • scripts/smoke.ps1 -Seconds 60, run on four builds:
    • main f4ce27c: full 60 s, 1465 frames, no crash, 14632 MB peak.
    • this PR merged onto f4ce27c (local merge 723b057, clean): 0xc0000005 at 17.8 s.
    • this PR's head 0f418b0 on its own base, two runs: 0xc0000005 at 22.9 s and 23.5 s.
    • main dd2ae9a, for the head-only runs: full 60 s, 1464 frames, no crash.
  • The crash, the same in all three runs (merged build shown):
    unhandled exception 0xc0000005 in VCRUNTIME140.dll+0x1cca7 (read at address 0x249fcae0000)
    rcx=0x469a00000 rdx=0x249fcae0000 r8=0x3200000
    on the stack: xcl.exe+0x69181 (list_x::mirror_of+0x321), ...
    
    It is a 50 MB (0x3200000) copy into a new mirror at 0x469a00000, and it faults on the first byte of its source. The source is the title's memory outside unified memory. Just before it, two mirrors are made for small views (118060 and 44048 bytes, at 0x463a70000 / 0x463a90000). The third view, the one being mirrored here, is never logged, because the copy runs before the log line.
    • The destination is a fresh mirror, so this looks like the first fill (copy_nonoverlapping(src, p, len) at the end of mirror_of).
    • One possible cause: when readable(src_start, len) fails, the fallback uses mirrors::source(va) without its own readable check. The caller checked va, not that source. I have not confirmed this is the path taken.
  • iggyvilla's 60 s smoke of the same head on an RX 6650 XT (RDNA2, wave64) above did not crash, so this may be specific to NVIDIA / 32-lane waves or to the memory layout on this machine.
  • cargo test --workspace -- --test-threads=4 (debug build present) on 0f418b0: 663 passed, 0 failed, 25 ignored. SKIPPED: 2 wave64 tests (32-lane GPU).

Regression run

main f4ce27c:

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 3090
title: (redacted: the retail title 1.0.2.1)
seconds: 60
exit: 0x0
frames shown: 1465 (PresentX 1465)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14632 MB

this PR merged onto it:

xcl-smoke v1
commit: 723b057817859f7140937013cc897070de5b4e10
gpu: NVIDIA GeForce RTX 3090
title: (redacted: the retail title 1.0.2.1)
seconds: 60
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 52 57 0
device removals: 0
crashes: 2
peak commit: 14483 MB

Not tested

  • Any other retail title.
  • An AMD GPU.
  • Which branch of mirror_of the crashing copy took.
  • The title: lines in the smoke blocks are redacted; nothing else in them is edited.

Runs and report by Claude Code (Claude Opus 5.5) on my machine.


Generated by Claude Code

**@⁠Dukiverse** on GitHub · 2026-11-24 04:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7121668871) Retail regression run of this PR: the retail title 1.0.2.1 (the same title as #675 and #616) crashes about 18–23 s in, inside `mirror_of`, with no input. `main` runs the full 60 s. **Tested** - RTX 3090 24 GB (driver 621.14, 32-lane waves), i7-9700K, 64 GB RAM, Windows 11 Pro 25H2 (26200.8246), DXC 1.9.2609.5, release builds, `XCL_NETWORK=0`, nothing touched during the runs. - `scripts/smoke.ps1 -Seconds 60`, run on four builds: - `main` `f4ce27c`: full 60 s, 1465 frames, no crash, 14632 MB peak. - this PR merged onto `f4ce27c` (local merge `723b057`, clean): `0xc0000005` at 17.8 s. - this PR's head `0f418b0` on its own base, two runs: `0xc0000005` at 22.9 s and 23.5 s. - `main` `dd2ae9a`, for the head-only runs: full 60 s, 1464 frames, no crash. - The crash, the same in all three runs (merged build shown): ``` unhandled exception 0xc0000005 in VCRUNTIME140.dll+0x1cca7 (read at address 0x249fcae0000) rcx=0x469a00000 rdx=0x249fcae0000 r8=0x3200000 on the stack: xcl.exe+0x69181 (list_x::mirror_of+0x321), ... ``` It is a 50 MB (`0x3200000`) copy into a new mirror at `0x469a00000`, and it faults on the first byte of its source. The source is the title's memory outside unified memory. Just before it, two mirrors are made for small views (118060 and 44048 bytes, at `0x463a70000` / `0x463a90000`). The third view, the one being mirrored here, is never logged, because the copy runs before the log line. - The destination is a fresh mirror, so this looks like the first fill (`copy_nonoverlapping(src, p, len)` at the end of `mirror_of`). - One possible cause: when `readable(src_start, len)` fails, the fallback uses `mirrors::source(va)` without its own `readable` check. The caller checked `va`, not that source. I have not confirmed this is the path taken. - iggyvilla's 60 s smoke of the same head on an RX 6650 XT (RDNA2, wave64) above did not crash, so this may be specific to NVIDIA / 32-lane waves or to the memory layout on this machine. - `cargo test --workspace -- --test-threads=4` (debug build present) on `0f418b0`: 663 passed, 0 failed, 25 ignored. SKIPPED: 2 wave64 tests (32-lane GPU). **Regression run** main `f4ce27c`: ``` xcl-smoke v1 commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968 gpu: NVIDIA GeForce RTX 3090 title: (redacted: the retail title 1.0.2.1) seconds: 60 exit: 0x0 frames shown: 1465 (PresentX 1465) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14632 MB ``` this PR merged onto it: ``` xcl-smoke v1 commit: 723b057817859f7140937013cc897070de5b4e10 gpu: NVIDIA GeForce RTX 3090 title: (redacted: the retail title 1.0.2.1) seconds: 60 exit: 0xc0000005 frames shown: none logged (the run did not reach its end) presents per 2 s (last 3): 52 57 0 device removals: 0 crashes: 2 peak commit: 14483 MB ``` **Not tested** - Any other retail title. - An AMD GPU. - Which branch of `mirror_of` the crashing copy took. - The `title:` lines in the smoke blocks are redacted; nothing else in them is edited. Runs and report by Claude Code (Claude Opus 5.5) on my machine. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠WTactic on GitHub · 2026-11-24 12:07 UTC · original

  • Tested
  • NVIDIA GeForce RTX 4090 (driver 616.56), Intel Core i9-10850K CPU @ 3.60GHz

Thanks for finding and reporting this @⁠Dukiverse!

Root Cause

The 50 MB buffer view was placed in MEM_RESERVE memory (e.g. an unwritten GPU UAV output buffer) that had not been committed yet on the CPU. The previous fallback attempted copy_nonoverlapping directly from reserved memory without ensuring lazy page commit or verifying per-page commit status, triggering the 0xc0000005 fault.

Fix

  • Added safe_copy_from_title:
    • Calls kernelx::lazy::ensure(src, len) to commit any pending lazy pages.
    • For uncommitted or partially reserved memory (such as pure MEM_RESERVE), queries page states via VirtualQuery: committed readable pages are copied, while uncommitted pages are safely zeroed in the mirror rather than faulting.
  • Added unit test uncommitted_buffer_view_does_not_crash in real.rs verifying that views over uncommitted MEM_RESERVE memory mirror cleanly without faulting.
    Squashed and force-pushed head 8d051f3. All workspace tests pass (cargo test --workspace -- --test-threads=4: 664 passed in xcl lib).
**@⁠WTactic** on GitHub · 2026-11-24 12:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7131003730) > * **Tested** > * NVIDIA GeForce RTX 4090 (driver 616.56), Intel Core i9-10850K CPU @ 3.60GHz Thanks for finding and reporting this @⁠Dukiverse! ### Root Cause The 50 MB buffer view was placed in `MEM_RESERVE` memory (e.g. an unwritten GPU UAV output buffer) that had not been committed yet on the CPU. The previous fallback attempted `copy_nonoverlapping` directly from reserved memory without ensuring lazy page commit or verifying per-page commit status, triggering the `0xc0000005` fault. ### Fix - Added `safe_copy_from_title`: - Calls `kernelx::lazy::ensure(src, len)` to commit any pending lazy pages. - For uncommitted or partially reserved memory (such as pure `MEM_RESERVE`), queries page states via `VirtualQuery`: committed readable pages are copied, while uncommitted pages are safely zeroed in the mirror rather than faulting. - Added unit test `uncommitted_buffer_view_does_not_crash` in `real.rs` verifying that views over uncommitted `MEM_RESERVE` memory mirror cleanly without faulting. Squashed and force-pushed head `8d051f3`. All workspace tests pass (`cargo test --workspace -- --test-threads=4`: 664 passed in `xcl` lib).
Author
Owner

@⁠pvfreis on GitHub · 2026-11-24 13:49 UTC · original

Re-read at cfc848f (nothing built or run here). Point 1 of my review is fixed another way: the copies now go through safe_copy_from_title, which zeroes uncommitted pages instead of faulting. Points 2-4 still apply at this head:

  1. Only vertex and index bindings are synced before a draw (sync_title_buffers, list_x.rs:3208-3220); a CBV/SRV/UAV mirror is copied again only when a view of the same range is created (mirror_of from real.rs:1195, :1827, :2224). The description still says the views are "refreshed on CPU writes".
  2. Every mirror_of hit copies the whole requested range again (list_x.rs:3159-3161, and the second lookup under the lock).
  3. TITLE_BUFFER_BYTES (real.rs:1566-1573) still has no removal in res_release (:1587).

Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.

**@⁠pvfreis** on GitHub · 2026-11-24 13:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7133393529) Re-read at `cfc848f` (nothing built or run here). Point 1 of my review is fixed another way: the copies now go through `safe_copy_from_title`, which zeroes uncommitted pages instead of faulting. Points 2-4 still apply at this head: 2. Only vertex and index bindings are synced before a draw (`sync_title_buffers`, `list_x.rs:3208-3220`); a CBV/SRV/UAV mirror is copied again only when a view of the same range is created (`mirror_of` from `real.rs:1195`, `:1827`, `:2224`). The description still says the views are "refreshed on CPU writes". 3. Every `mirror_of` hit copies the whole requested range again (`list_x.rs:3159-3161`, and the second lookup under the lock). 4. `TITLE_BUFFER_BYTES` (`real.rs:1566-1573`) still has no removal in `res_release` (`:1587`). Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.
Author
Owner

@⁠crosettiremi on GitHub · 2026-11-24 16:28 UTC · original

RX 7900 XT downstream test of cb4a9ae on a build based on 930e8b4. The three focused tests for non-UMA buffers, constant-buffer refresh, and uncommitted views passed. The comparison build logged an empty buffer descriptor during startup. With this PR the title reached the new mirror path: one logged view was 118,060 bytes, and the last power-of-two sample showed 8,192 mirrors totaling 1,408 MB.

Both runs had matching initial caches, scripted Player1 input at 33 seconds, two DXC workers and a 28 GiB whole-job limit. The comparison build later had a GPU page fault during world loading. The mirrored build exited at about 190 s with Rust allocation-error handling on a DirectStorage queue worker; peak sampled process commit was 27,560 MB and no device removal was logged. The title exercised the implementation. These two runs do not establish that mirroring fixed the GPU fault, or that mirrors alone caused the allocation failure.

**@⁠crosettiremi** on GitHub · 2026-11-24 16:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7137733984) RX 7900 XT downstream test of cb4a9ae on a build based on 930e8b4. The three focused tests for non-UMA buffers, constant-buffer refresh, and uncommitted views passed. The comparison build logged an empty buffer descriptor during startup. With this PR the title reached the new mirror path: one logged view was 118,060 bytes, and the last power-of-two sample showed 8,192 mirrors totaling 1,408 MB. Both runs had matching initial caches, scripted Player1 input at 33 seconds, two DXC workers and a 28 GiB whole-job limit. The comparison build later had a GPU page fault during world loading. The mirrored build exited at about 190 s with Rust allocation-error handling on a DirectStorage queue worker; peak sampled process commit was 27,560 MB and no device removal was logged. The title exercised the implementation. These two runs do not establish that mirroring fixed the GPU fault, or that mirrors alone caused the allocation failure.
Author
Owner

@⁠relativespace2K on GitHub · 2026-11-24 03:48 UTC · original · edited 2026-11-25 04:10 UTC

Tested - 3217101 on main 3da2abb, retail GTA6 1.0.2.1

Tool: OpenCode with DeepSeek V4.1 Flash 1017

  • 240 s with the machine's usual background load: two runs aborted at 45.6 s and 50.1 s with
    0xc0000409; stdout memory allocation of 2073600 bytes failed (host OOM), peaks
    31,964 MB and 35,116 MB.
  • 240 s with background programs closed (commit free 19.9 -> 28.8 GB): exit 0, 3,183 frames,
    peak 40,020 MB, mirrors active, 0 failed pipelines, 0 DXIL failures, 40 refusals as main.
  • Controls: main 240 s exit 0 at 33,429 MB; #684 240 s exit 0 at 35,380 MB.
  • Conclusion: the earlier aborts were this 31.9 GB machine's commit limit, not the PR. The mirror
    feature raises peak memory to ~40 GB; with enough headroom the run is clean.

Tested - re-tested at the new head, independent AMD RDNA2 validation

  • PR head cfc848f934f1ba13dff0f31121718a226702e493, based on 47efa2e (the branch was
    rebased; the previous report was for 0f418b0). Applied as a cherry-pick without
    committing onto current main b8b1f49 (clean; real.rs auto-merged).
  • AMD Radeon RX 6800 XT (16338 MiB), driver 32.0.21045.29003; Ryzen 5 5600, 31.9 GB;
    Windows 11 IoT Enterprise LTSC 26100; Rust 1.100.0 stable-x86_64-pc-windows-msvc;
    DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); debug; no XCL_SAMPLE_*.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4.
tree passed failed ignored
main b8b1f49 746 3 41
main + this PR 749 3 41
  • The +3 are this PR's own tests, all passing: buffer_views_outside_uma_are_mirrored,
    cbv_outside_uma_is_mirrored_and_refreshed and uncommitted_buffer_view_does_not_crash
    (lib tests go 702 -> 705; the integration binaries are unchanged).
  • The three failures are the known RDNA2 ones, unchanged by this PR: the packed-mip
    3D 64x64x64 4 mips: subresource 2 mismatch (#470) and the two PoisonError
    follow-ons (#673).
  • Focused cargo test -p xcl --lib outside_uma: 2 passed, 0 failed, 0 ignored, and the
    log shows both paths active - the CBV and the buffer view outside unified memory are
    mirrored at 0x420010000 / 0x420020000, "each draw copies what it reads".
  • 0 SKIPPED GPU tests on this adapter.

Not tested: retail title / smoke.ps1, release build, NVIDIA / Intel.

AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report.

**@⁠relativespace2K** on GitHub · 2026-11-24 03:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7121441230) · edited 2026-11-25 04:10 UTC **Tested** - `3217101` on `main` `3da2abb`, retail GTA6 1.0.2.1 Tool: OpenCode with DeepSeek V4.1 Flash 1017 - 240 s with the machine's usual background load: two runs aborted at 45.6 s and 50.1 s with `0xc0000409`; stdout `memory allocation of 2073600 bytes failed` (host OOM), peaks 31,964 MB and 35,116 MB. - 240 s with background programs closed (commit free 19.9 -> 28.8 GB): **exit 0**, 3,183 frames, peak **40,020 MB**, mirrors active, 0 failed pipelines, 0 DXIL failures, 40 refusals as `main`. - Controls: `main` 240 s exit 0 at 33,429 MB; #684 240 s exit 0 at 35,380 MB. - Conclusion: the earlier aborts were this 31.9 GB machine's commit limit, not the PR. The mirror feature raises peak memory to ~40 GB; with enough headroom the run is clean. --- **Tested** - re-tested at the new head, independent AMD RDNA2 validation - PR head `cfc848f934f1ba13dff0f31121718a226702e493`, based on `47efa2e` (the branch was rebased; the previous report was for `0f418b0`). Applied as a cherry-pick without committing onto current `main` `b8b1f49` (clean; `real.rs` auto-merged). - AMD Radeon RX 6800 XT (16338 MiB), driver 32.0.21045.29003; Ryzen 5 5600, 31.9 GB; Windows 11 IoT Enterprise LTSC 26100; Rust 1.100.0 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); debug; no `XCL_SAMPLE_*`. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`. | tree | passed | failed | ignored | |---|---:|---:|---:| | `main` `b8b1f49` | 746 | 3 | 41 | | `main` + this PR | 749 | 3 | 41 | - The +3 are this PR's own tests, all passing: `buffer_views_outside_uma_are_mirrored`, `cbv_outside_uma_is_mirrored_and_refreshed` and `uncommitted_buffer_view_does_not_crash` (lib tests go 702 -> 705; the integration binaries are unchanged). - The three failures are the known RDNA2 ones, unchanged by this PR: the packed-mip `3D 64x64x64 4 mips: subresource 2 mismatch` (#470) and the two `PoisonError` follow-ons (#673). - Focused `cargo test -p xcl --lib outside_uma`: 2 passed, 0 failed, 0 ignored, and the log shows both paths active - the CBV and the buffer view outside unified memory are mirrored at `0x420010000` / `0x420020000`, "each draw copies what it reads". - 0 `SKIPPED` GPU tests on this adapter. **Not tested**: retail title / `smoke.ps1`, release build, NVIDIA / Intel. **AI use**: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:36 UTC · original

Empirical test report (32171011)

Hardware / environment

  • PR head 32171011d20dacd2f87de84865be3ef1fcb96e86, verified on a clean detached HEAD.
  • Windows 11 Enterprise Evaluation, build 26200, AMD Ryzen 7 3800X 8-Core Processor. No GPU adapter was used.
  • Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), DXC 1.9.2609.5 (01b62ad47). Cargo used the unoptimized test profile with incremental compilation and debug info disabled.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test executables. This command compiled tests only.
  • Focused commands ran outside the Arc lock with XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. $unitTestExe refers to the prebuilt library harness, xcl-77aca8ccb20e299f.exe.
& $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::buffer_views_outside_uma_are_mirrored --test-threads=1
& $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::cbv_outside_uma_is_mirrored_and_refreshed --test-threads=1
& $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::uncommitted_buffer_view_does_not_crash --test-threads=1

All three commands exited 0. Each reported 1 passed, 0 failed and 0 ignored. The focused log totals were 3 passed, 0 failed, 0 ignored and 0 skipped (case-sensitive ^SKIPPED lines).

Observed behavior

  • The raw view pointed inside UMA and exposed the expected first host word. The structured and address-based views preserved the expected offsets, strides and record counts.
  • The CBV mirror helper reused the same UMA address and copied the updated host word on the second call.
  • A 4 MiB reservation with no committed pages produced a UMA view with the expected record count and a zero first word. The log recorded UMA initialization and mirror creation in every test.

Not tested

The full GPU workspace suite, shader execution against these descriptors and game smoke runs were omitted.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr637-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7154975674) ### Empirical test report (32171011) **Hardware / environment** - PR head `32171011d20dacd2f87de84865be3ef1fcb96e86`, verified on a clean detached HEAD. - Windows 11 Enterprise Evaluation, build 26200, AMD Ryzen 7 3800X 8-Core Processor. No GPU adapter was used. - Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), DXC 1.9.2609.5 (01b62ad47). Cargo used the unoptimized test profile with incremental compilation and debug info disabled. **Commands and results** - `cargo test --workspace --no-run` exited 0 and built the workspace test executables. This command compiled tests only. - Focused commands ran outside the Arc lock with `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`. `$unitTestExe` refers to the prebuilt library harness, `xcl-77aca8ccb20e299f.exe`. ```powershell & $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::buffer_views_outside_uma_are_mirrored --test-threads=1 & $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::cbv_outside_uma_is_mirrored_and_refreshed --test-threads=1 & $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::uncommitted_buffer_view_does_not_crash --test-threads=1 ``` All three commands exited 0. Each reported 1 passed, 0 failed and 0 ignored. The focused log totals were 3 passed, 0 failed, 0 ignored and 0 skipped (case-sensitive `^SKIPPED ` lines). **Observed behavior** - The raw view pointed inside UMA and exposed the expected first host word. The structured and address-based views preserved the expected offsets, strides and record counts. - The CBV mirror helper reused the same UMA address and copied the updated host word on the second call. - A 4 MiB reservation with no committed pages produced a UMA view with the expected record count and a zero first word. The log recorded UMA initialization and mirror creation in every test. **Not tested** The full GPU workspace suite, shader execution against these descriptors and game smoke runs were omitted. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr637-focused.log and published.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 08:59 UTC · original

A test of this PR's idea on the retail title, done with an equivalent local change rather than this branch: copies of out-of-window buffer views are enough to get world geometry rasterised, with three conditions this PR may want to know about. Numbers: #697

Setup in short (the full block is in the linked comment): main 689f2db + #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640, #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits from wondercrash/xcl, then #541, #2092's 3442b58 state, #1887, #1803, plus local changes; XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1; RTX 3090 24 GB (driver 616.56), Windows 11 22631; one clean run and one partial run.

  • Which views matter: the buffer views created by address in the GPU view of the title's 24 GB pair (device #70, the buffer_words_at path this PR also changes): 94 412 distinct ranges in the first 25 s of the world, 1 156 MB, every one an SRV, 71 % of them 4 KiB or less. The title's GPU-driven culling and its mesh programs read through them.
  • Root views too: copies were also needed for root views outside the windows, including in the two-pass mesh stages (#2092). Without the mesh path nothing is drawn whatever the copies.
  • Refresh: my copies were refilled from the CPU view at every present (about 750 MB per frame). I did not test copies taken once at view creation, which is what this PR does for these views as far as I read it, so I cannot say whether that is enough for the title; the per-frame object lists suggest not.
  • Size: about 75 000 copies and 1.4 GB at that point, so the 2 GiB cap is not far.

Not tested: this branch itself; writes through UAV copies going back to the title (none of the by-address views in the GPU view was a UAV here).

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 08:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7157739974) **A test of this PR's idea on the retail title, done with an equivalent local change rather than this branch: copies of out-of-window buffer views are enough to get world geometry rasterised, with three conditions this PR may want to know about.** Numbers: https://git.gtahub.st/github/xcl-dev--xcl/issues/697 Setup in short (the full block is in the linked comment): `main` `689f2db` + #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640, #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits from `wondercrash/xcl`, then #541, #2092's `3442b58` state, #1887, #1803, plus local changes; `XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1`; RTX 3090 24 GB (driver 616.56), Windows 11 22631; one clean run and one partial run. - **Which views matter**: the buffer views created by address in the GPU view of the title's 24 GB pair (device #70, the `buffer_words_at` path this PR also changes): 94 412 distinct ranges in the first 25 s of the world, 1 156 MB, every one an SRV, 71 % of them 4 KiB or less. The title's GPU-driven culling and its mesh programs read through them. - **Root views too**: copies were also needed for root views outside the windows, including in the two-pass mesh stages (#2092). Without the mesh path nothing is drawn whatever the copies. - **Refresh**: my copies were refilled from the CPU view at every present (about 750 MB per frame). I did not test copies taken once at view creation, which is what this PR does for these views as far as I read it, so I cannot say whether that is enough for the title; the per-frame object lists suggest not. - **Size**: about 75 000 copies and 1.4 GB at that point, so the 2 GiB cap is not far. Not tested: this branch itself; writes through UAV copies going back to the title (none of the by-address views in the GPU view was a UAV here). **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 12:43 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 12:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7162772334) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠throny on GitHub · 2026-11-25 20:14 UTC · original

Two contributors checked independently and found that #2384 solves the same problem in a different way: #1607, group D110. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

**@⁠throny** on GitHub · 2026-11-25 20:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/637#issuecomment-7173381916) <!-- xcl-1607-hint:D110 --> Two contributors checked independently and found that #2384 solves the same problem in a different way: #1607, group D110. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/real.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/637/head:github-bot/gh-637'
git switch 'github-bot/gh-637'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-637'
git switch 'github-bot/gh-637'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-637'
git switch 'github-bot/gh-637'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-637'
git switch 'main'
git merge --squash 'github-bot/gh-637'
git switch 'main'
git merge --ff-only 'github-bot/gh-637'
git switch 'main'
git merge 'github-bot/gh-637'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.