D3D12.X: a vertex or index buffer with a mirror is bound without VirtualQuery #688

Merged
iggyvilla merged 1 commit from upstream-pr/693 into main 2026-11-24 10:06:03 +00:00
iggyvilla commented 2026-11-24 03:34:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-24T03:34:14Z.


gpu_va (crates/xcl/src/hle/d3d12x/list_x.rs) called gpu::shader::readable() on every vertex and index buffer bind outside unified memory, before it looked for the mirror the buffer already has. When the title's memory isn't resident, readable() falls back to a VirtualQuery walk of the whole region. Past the account prompt in a retail title, that walk took 68.8 % of the render thread (see below). The bind now looks up the mirror first. Only the first bind of a range still calls readable(). That is safe because the mirror was made from readable memory, and sync_title_buffers calls readable() itself before each copy into it. The window check stays first, so a PC resource's GPU address that falls in a window by number is still passed through unchanged.

Related: #582 (the slowdown past the menus), #501 (VirtualQuery walks hold the address space).

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: gpu_va returns an existing mirror before calling readable() (one commit, +10/−1).
  • The same file has a unit test, a_mirrored_buffer_binds_its_mirror_without_asking_readable. It makes a buffer's pages PAGE_NOACCESS after its first bind and checks that the next bind still gets the same mirror. Without the fix the test fails, because the bind returns the title's address.

Tested

  • AMD Radeon RX 6650 XT (RDNA2), driver 32.0.21045.29003, Ryzen 7 5700X, Windows 10.0.26300, rustc 1.100.0, debug tests and a release build (with CARGO_PROFILE_RELEASE_DEBUG=1 for symbols).

  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 03912e8 (rebased onto 1ec4c98): 713 passed, 3 failed, 41 ignored, 0 SKIPPED. (The first run had two e2e failures because xcl_testtitle.exe was not built yet; after cargo build --workspace, --test e2e passes 3/3. The counts above include that rerun.) The 3 failures are the same known ones as on main:

    • placed_title_textures_share_vram_and_preserve_pixels also fails on its own. It is the packed-mip bug that #470 fixes.
    • transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory pass on their own. In the full run they fail from PoisonError after the first failure; #673 fixes that.
  • I profiled the title's render thread past the account prompt (a 20 s sample at 125 s, the same steps on both builds; taken before the rebase, on 82c3681 against main @ dd2ae9a, the same code):

    main (dd2ae9a) this PR
    render thread 92 % of a core 25 % of a core
    NtQueryVirtualMemory via gpu_va → readable (IASetVertexBuffers / IASetIndexBuffer) 60.7 % + 8.1 % none sampled
    render thread waiting (timestamp) 12.2 % 81.9 %
    fps at that point 10–12 10–11

    fps did not change in this scene. With the render thread mostly idle, the limit is now the submit thread, which runs at 86–89 % of a core on both builds in title_textures::refresh and NtGetWriteWatch under ExecuteCommandLists. This PR does not change that thread.

Regression run

The title's first minute varies a lot between runs on this machine (here 477 to 1555 frames), so the runs alternate (head, main, main, head) after an unmeasured warm-up run of each build (the game was freshly moved to a new disk). Pair 1: head 1555 frames, main 482 (the head run landed in the fast mode; not a result for the PR). Pair 2, matched, is shown: main 481, head 477. No device removals or crashes in any run.

main:

xcl-smoke v1
commit: 1ec4c98cda119432a4b3f205e146fba2d6f8379a
gpu: AMD Radeon RX 6650 XT
title: retail
seconds: 60
exit: 0x0
frames shown: 481 (PresentX 485)
presents per 2 s (last 3): 19 60 21
device removals: 0
crashes: 0
peak commit: 15140 MB

This PR:

xcl-smoke v1
commit: 03912e8de71cd43700fc3fa4857fd51fa2a0e552
gpu: AMD Radeon RX 6650 XT
title: retail
seconds: 60
exit: 0x0
frames shown: 477 (PresentX 483)
presents per 2 s (last 3): 18 60 22
device removals: 0
crashes: 0
peak commit: 15270 MB

Not tested

  • NVIDIA, Intel, RDNA3/4.
  • Other titles. Only one retail title, and only its first minutes (menus and account prompt).
  • The case where a title decommits a mirrored buffer's memory and reuses the address for a different buffer. The mirror is bound as before; sync_title_buffers checks before it copies.

AI use

  • Claude Code, Claude Opus 5.5 (claude-opus-5-5). It wrote the change, the test and this description, and ran the tests, profiles and smoke run above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6574013653 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/693). Originally posted by [iggyvilla](https://github.com/iggyvilla) on 2026-11-24T03:34:14Z. --- `gpu_va` (`crates/xcl/src/hle/d3d12x/list_x.rs`) called `gpu::shader::readable()` on every vertex and index buffer bind outside unified memory, before it looked for the mirror the buffer already has. When the title's memory isn't resident, `readable()` falls back to a `VirtualQuery` walk of the whole region. Past the account prompt in a retail title, that walk took 68.8 % of the render thread (see below). The bind now looks up the mirror first. Only the first bind of a range still calls `readable()`. That is safe because the mirror was made from readable memory, and `sync_title_buffers` calls `readable()` itself before each copy into it. The window check stays first, so a PC resource's GPU address that falls in a window by number is still passed through unchanged. Related: #582 (the slowdown past the menus), #501 (`VirtualQuery` walks hold the address space). **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `gpu_va` returns an existing mirror before calling `readable()` (one commit, +10/−1). - The same file has a unit test, `a_mirrored_buffer_binds_its_mirror_without_asking_readable`. It makes a buffer's pages `PAGE_NOACCESS` after its first bind and checks that the next bind still gets the same mirror. Without the fix the test fails, because the bind returns the title's address. **Tested** - AMD Radeon RX 6650 XT (RDNA2), driver 32.0.21045.29003, Ryzen 7 5700X, Windows 10.0.26300, rustc 1.100.0, debug tests and a release build (with `CARGO_PROFILE_RELEASE_DEBUG=1` for symbols). - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `03912e8` (rebased onto `1ec4c98`): 713 passed, 3 failed, 41 ignored, 0 SKIPPED. (The first run had two e2e failures because `xcl_testtitle.exe` was not built yet; after `cargo build --workspace`, `--test e2e` passes 3/3. The counts above include that rerun.) The 3 failures are the same known ones as on `main`: - `placed_title_textures_share_vram_and_preserve_pixels` also fails on its own. It is the packed-mip bug that #470 fixes. - `transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory` pass on their own. In the full run they fail from `PoisonError` after the first failure; #673 fixes that. - I profiled the title's render thread past the account prompt (a 20 s sample at 125 s, the same steps on both builds; taken before the rebase, on `82c3681` against `main` @ `dd2ae9a`, the same code): | | `main` (dd2ae9a) | this PR | |---|---|---| | render thread | 92 % of a core | 25 % of a core | | `NtQueryVirtualMemory` via `gpu_va` → `readable` (`IASetVertexBuffers` / `IASetIndexBuffer`) | 60.7 % + 8.1 % | none sampled | | render thread waiting (`timestamp`) | 12.2 % | 81.9 % | | fps at that point | 10–12 | 10–11 | fps did not change in this scene. With the render thread mostly idle, the limit is now the submit thread, which runs at 86–89 % of a core on both builds in `title_textures::refresh` and `NtGetWriteWatch` under `ExecuteCommandLists`. This PR does not change that thread. **Regression run** The title's first minute varies a lot between runs on this machine (here 477 to 1555 frames), so the runs alternate (head, `main`, `main`, head) after an unmeasured warm-up run of each build (the game was freshly moved to a new disk). Pair 1: head 1555 frames, `main` 482 (the head run landed in the fast mode; not a result for the PR). Pair 2, matched, is shown: `main` 481, head 477. No device removals or crashes in any run. `main`: ``` xcl-smoke v1 commit: 1ec4c98cda119432a4b3f205e146fba2d6f8379a gpu: AMD Radeon RX 6650 XT title: retail seconds: 60 exit: 0x0 frames shown: 481 (PresentX 485) presents per 2 s (last 3): 19 60 21 device removals: 0 crashes: 0 peak commit: 15140 MB ``` This PR: ``` xcl-smoke v1 commit: 03912e8de71cd43700fc3fa4857fd51fa2a0e552 gpu: AMD Radeon RX 6650 XT title: retail seconds: 60 exit: 0x0 frames shown: 477 (PresentX 483) presents per 2 s (last 3): 18 60 22 device removals: 0 crashes: 0 peak commit: 15270 MB ``` **Not tested** - NVIDIA, Intel, RDNA3/4. - Other titles. Only one retail title, and only its first minutes (menus and account prompt). - The case where a title decommits a mirrored buffer's memory and reuses the address for a different buffer. The mirror is bound as before; `sync_title_buffers` checks before it copies. **AI use** - Claude Code, Claude Opus 5.5 (`claude-opus-5-5`). It wrote the change, the test and this description, and ran the tests, profiles and smoke run above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
pvfreis commented 2026-11-24 07:06:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T03:52:48Z.


Test report for f44cc79 (this PR's head) against its merge base on main dd2ae9a70a, on NVIDIA (the PR lists NVIDIA as not tested). The new test passes; no regression elsewhere.

Tested

  • RTX 3060 12 GB (driver 617.14), Ryzen 9 5900XT, Windows 11 26H2 (10.0.26300), Rust 1.100.0 stable MSVC, debug
  • cargo build --workspace --locked --offline, then cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4, for both commits:
    • main dd2ae9a: 689 passed, 1 failed, 41 ignored
    • PR f44cc79: 690 passed, 1 failed, 41 ignored. The only difference is the new hle::d3d12x::list_x::tests::a_mirrored_buffer_binds_its_mirror_without_asking_readable, which passes; the log shows the test buffer outside unified memory taking the mirror path ("mirrored at 0x420010000, each draw copies what it reads")
  • SKIPPED on this adapter (both): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)
  • The 1 failure is the same on both and not from this PR: test_title_runs_and_game_folder_is_untouched (e2e.rs:225, presents 0), because these runs are in an isolated non-interactive session where CreateSwapChainForHwnd returns 0x887A0022. An interactive run of main at 7ebf1b8 on this machine passed it.

Not tested

  • a retail title / smoke run, so not the draw-time cost this PR is about
  • AMD, Intel

Tested and written with Claude Code (Claude Opus 5.5); the runs are real, on the hardware above.

<!-- greyfinch-sync:ivall/xcl:comment:7121505919 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121505919). Originally posted by [pvfreis](https://github.com/pvfreis) on 2026-11-24T03:52:48Z. --- Test report for f44cc79 (this PR's head) against its merge base on main dd2ae9a70a, on NVIDIA (the PR lists NVIDIA as not tested). The new test passes; no regression elsewhere. **Tested** - RTX 3060 12 GB (driver 617.14), Ryzen 9 5900XT, Windows 11 26H2 (10.0.26300), Rust 1.100.0 stable MSVC, debug - `cargo build --workspace --locked --offline`, then `cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4`, for both commits: - main dd2ae9a: 689 passed, 1 failed, 41 ignored - PR f44cc79: 690 passed, 1 failed, 41 ignored. The only difference is the new `hle::d3d12x::list_x::tests::a_mirrored_buffer_binds_its_mirror_without_asking_readable`, which passes; the log shows the test buffer outside unified memory taking the mirror path ("mirrored at 0x420010000, each draw copies what it reads") - SKIPPED on this adapter (both): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64) - The 1 failure is the same on both and not from this PR: `test_title_runs_and_game_folder_is_untouched` (e2e.rs:225, `presents` 0), because these runs are in an isolated non-interactive session where `CreateSwapChainForHwnd` returns 0x887A0022. An interactive run of main at 7ebf1b8 on this machine passed it. **Not tested** - a retail title / smoke run, so not the draw-time cost this PR is about - AMD, Intel Tested and written with Claude Code (Claude Opus 5.5); the runs are real, on the hardware above.
ethandepstein-del commented 2026-11-24 07:06:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-24T03:54:34Z.


Code audit + NVIDIA RTX 5080 test run on f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0:

Review

Looks clean — checking mirrored(va, bytes) before gpu::shader::readable(va as usize, bytes) safely avoids the VirtualQuery walk on every subsequent bind of an already-mirrored vertex/index buffer, while sync_title_buffers continues to validate what it reads from title memory.

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), rustc 1.100.0 (MSVC), debug build.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 691 passed, 0 failed, 41 ignored.
  • New test hle::d3d12x::list_x::tests::a_mirrored_buffer_binds_its_mirror_without_asking_readable: passed.
  • SKIPPED GPU tests (2, wave32-only adapter): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64.

Not tested

  • Retail title / scripts/smoke.ps1 run (test suite only).
  • AMD / Intel GPUs.

AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.

<!-- greyfinch-sync:ivall/xcl:comment:7121532033 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121532033). Originally posted by [ethandepstein-del](https://github.com/ethandepstein-del) on 2026-11-24T03:54:34Z. --- Code audit + NVIDIA RTX 5080 test run on `f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0`: ### Review Looks clean — checking `mirrored(va, bytes)` before `gpu::shader::readable(va as usize, bytes)` safely avoids the `VirtualQuery` walk on every subsequent bind of an already-mirrored vertex/index buffer, while `sync_title_buffers` continues to validate what it reads from title memory. ### Tested - Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), `rustc 1.100.0` (MSVC), debug build. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: **691 passed, 0 failed, 41 ignored**. - New test `hle::d3d12x::list_x::tests::a_mirrored_buffer_binds_its_mirror_without_asking_readable`: **passed**. - `SKIPPED` GPU tests (2, wave32-only adapter): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64`. ### Not tested - Retail title / `scripts/smoke.ps1` run (test suite only). - AMD / Intel GPUs. *AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.*
relativespace2K commented 2026-11-24 07:06:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-24T03:56:58Z.


Tested — re-tested at the new head, native Windows / AMD RDNA2

  • PR head 03912e8de71cd43700fc3fa4857fd51fa2a0e552, based on 1ec4c98 (the branch
    now includes main up to #873; the previous report was for f44cc79).
  • 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 MSVC; DXC 1.9.2602.17; debug;
    no XCL_SAMPLE_*.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:
tree passed failed ignored
base 1ec4c98 712 3 41
PR head 03912e8 713 3 41
  • The three failures are the same known RDNA2 tests as on the base: the title-texture
    test (here 3D 64x64x64 4 mips: subresource 2 mismatch, its isolated failure) and the
    two PoisonError follow-ons. This PR does not touch them. Current main 077ce40
    also gives 672/3/41 in the lib tests, the same as this head.
  • Focused a_mirrored_buffer_binds_its_mirror_without_asking_readable: 1 passed,
    0 failed. The log shows the test buffer outside unified memory taking the mirror path
    (mirrored at 0x420010000, each draw copies what it reads).
  • 0 SKIPPED GPU tests on this adapter.

Not tested: retail title / smoke.ps1 (so not the draw-time cost this PR targets),
release build, Intel.

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

<!-- greyfinch-sync:ivall/xcl:comment:7121568085 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121568085). Originally posted by [relativespace2K](https://github.com/relativespace2K) on 2026-11-24T03:56:58Z. --- **Tested** — re-tested at the new head, native Windows / AMD RDNA2 - PR head `03912e8de71cd43700fc3fa4857fd51fa2a0e552`, based on `1ec4c98` (the branch now includes `main` up to #873; the previous report was for `f44cc79`). - 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 MSVC; DXC 1.9.2602.17; debug; no `XCL_SAMPLE_*`. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: | tree | passed | failed | ignored | |---|---:|---:|---:| | base `1ec4c98` | 712 | 3 | 41 | | PR head `03912e8` | 713 | 3 | 41 | - The three failures are the same known RDNA2 tests as on the base: the title-texture test (here `3D 64x64x64 4 mips: subresource 2 mismatch`, its isolated failure) and the two `PoisonError` follow-ons. This PR does not touch them. Current `main` `077ce40` also gives 672/3/41 in the lib tests, the same as this head. - Focused `a_mirrored_buffer_binds_its_mirror_without_asking_readable`: 1 passed, 0 failed. The log shows the test buffer outside unified memory taking the mirror path (`mirrored at 0x420010000, each draw copies what it reads`). - 0 `SKIPPED` GPU tests on this adapter. **Not tested**: retail title / `smoke.ps1` (so not the draw-time cost this PR targets), release build, Intel. **AI use**: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report.
MesshM commented 2026-11-24 07:06:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T03:59:59Z.


Test run of f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0 on AMD RDNA4. I merged it onto current main f4ce27c 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: 702 passed, 0 failed, 41 ignored, exit code 0; 0 SKIPPED
  • a_mirrored_buffer_binds_its_mirror_without_asking_readable passes.

Review: A buffer with a mirror is bound to the mirror before readable() is asked, so the VirtualQuery walk is skipped for it, and the mirror is read without touching the source. I found nothing to change.

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.

<!-- greyfinch-sync:ivall/xcl:comment:7121612866 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121612866). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T03:59:59Z. --- Test run of `f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0` on AMD RDNA4. I merged it onto current `main` `f4ce27c` 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: **702 passed, 0 failed, 41 ignored**, exit code 0; 0 `SKIPPED` - `a_mirrored_buffer_binds_its_mirror_without_asking_readable` passes. **Review:** A buffer with a mirror is bound to the mirror before `readable()` is asked, so the `VirtualQuery` walk is skipped for it, and the mirror is read without touching the source. I found nothing to change. **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.
lordon1a commented 2026-11-24 07:06:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lordon1a on 2026-11-24T04:10:27Z.


Independent test report on f44cc79:

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build
  • cargo test -p xcl --lib hle::d3d12x::list_x -- --test-threads=1 --nocapture: 17 passed, 0 failed, 0 ignored in 0.15s (including a_mirrored_buffer_binds_its_mirror_without_asking_readable)

Not tested

  • AMD / Intel GPU, retail title (xcl-smoke)

AI use

  • Antigravity (Google DeepMind agent) — fetched f44cc79 in a detached worktree, audited the diff, ran list_x tests, and posted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7121774633 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121774633). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T04:10:27Z. --- Independent test report on `f44cc79`: **Tested** - Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver `616.64`, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`), debug build - `cargo test -p xcl --lib hle::d3d12x::list_x -- --test-threads=1 --nocapture`: **17 passed, 0 failed, 0 ignored** in `0.15s` (including `a_mirrored_buffer_binds_its_mirror_without_asking_readable`) **Not tested** - AMD / Intel GPU, retail title (`xcl-smoke`) **AI use** - Antigravity (Google DeepMind agent) — fetched `f44cc79` in a detached worktree, audited the diff, ran `list_x` tests, and posted this report.
brainhay5 commented 2026-11-24 07:06:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-24T04:10:45Z.


Retail result on main f4ce27c + this PR (merge, clean), RTX 5070 Ti, driver 32.0.16.1088, Windows 11 22631, interactive session, XCL_NETWORK=0, release, full launch.

It changes the failure rather than fixing it:

  • Frames are presented to 77 s (2100 frames, 28.8 fps), then stop.
  • Wait64BitValueX timeouts return at 124 s — this time expecting 0x8c8 (plain f4ce27c expects 0x623 in the same run), memory holds 0.
  • The game_scarlett_master.exe+0x23cf683 write-to-null is logged at 126.7 s, but the process stays alive and hung (13.5 GB working set, Responding: True, no further output) instead of exiting.

Plain main at the same commit exits cleanly at ~120 s with the same fault. So this PR is not the cause of the crash, and it does not clear it; the run now stalls after the fault instead of terminating.

The BufferLocation = 0x3063, SizeInBytes = 0, StrideInBytes = 0 view I saw in the IASetVertexBuffers trace on plain main is not obviously changed by this PR, but I did not re-trace with it applied.

Not tested: AMD, other titles, XCL_SAMPLE_*.

AI use: OpenCode, DeepSeek V4.1 Flash 1017.

<!-- greyfinch-sync:ivall/xcl:comment:7121779255 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121779255). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-24T04:10:45Z. --- Retail result on `main` `f4ce27c` + this PR (merge, clean), RTX 5070 Ti, driver 32.0.16.1088, Windows 11 22631, interactive session, `XCL_NETWORK=0`, release, full launch. It changes the failure rather than fixing it: - Frames are presented to **77 s** (2100 frames, 28.8 fps), then stop. - `Wait64BitValueX` timeouts return at 124 s — this time expecting **`0x8c8`** (plain `f4ce27c` expects `0x623` in the same run), memory holds `0`. - The `game_scarlett_master.exe+0x23cf683` write-to-null is logged at 126.7 s, but the process **stays alive and hung** (13.5 GB working set, `Responding: True`, no further output) instead of exiting. Plain `main` at the same commit exits cleanly at ~120 s with the same fault. So this PR is not the cause of the crash, and it does not clear it; the run now stalls after the fault instead of terminating. The `BufferLocation = 0x3063, SizeInBytes = 0, StrideInBytes = 0` view I saw in the `IASetVertexBuffers` trace on plain main is not obviously changed by this PR, but I did not re-trace with it applied. **Not tested:** AMD, other titles, `XCL_SAMPLE_*`. AI use: OpenCode, DeepSeek V4.1 Flash 1017.
JoaoPauluu commented 2026-11-24 07:06:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T04:11:41Z.


Test report: #693 under Wine (Linux, NVIDIA): GTA VI reaches the mirrored-buffer path

A retail-title run of this PR under Wine / vkd3d-proton, base main 91f9a5e against head f44cc79. No regression, and GTA VI does bind mirrored vertex and index buffers outside unified memory, the case this PR changes, though only in the last seconds of these runs.

Setup

  • CachyOS, kernel 7.3.3-1-cachyos, Intel i5-10400F, 16 GB RAM, NVIDIA GeForce RTX 3060 12 GB, driver 620.70.06
  • Proton Experimental experimental-11.0-20261112 (wine-11.0), vkd3d-proton v3.1 (4522cc1a) + the patch from #257, DXVK from Proton, DXC 1.9.2609, DXVK_CONFIG="dxgi.hideNvidiaGpu = False"
  • Rust 1.100.0, x86_64-pc-windows-gnu (mingw-w64-gcc 16.2.0), release builds
  • GTA VI 1.0.2.1 (my own dump), 60 s runs with scripts/linux/smoke.sh from #257, XCL_NETWORK=0, alternating base / PR / PR / base
build frames shown removals / crashes
91f9a5e 986, 972 0 / 0
f44cc79 971, 984 0 / 0

Both PR runs log, at about 59 s:

[WARN ] UMA: 13391 MB of commit free, under 17408 MB: the title's GPU heaps stay outside unified memory (a larger page file gives them the coherent window)
[INFO ] D3D12.X: bottom-of-pipe writes outside unified memory are done by the CPU after the GPU (2 in the first submission)
[WARN ] D3D12.X: index buffer at 0x18c8b900 (393216 bytes) is outside unified memory – 0x18c80000..0x18cf0000 mirrored at 0x463a70000, each draw copies what it reads (1 mirrors, 0 MB)
[WARN ] D3D12.X: vertex buffer at 0x1b694a80 (1179648 bytes) is outside unified memory – 0x1b690000..0x1b7c0000 mirrored at 0x469a00000, each draw copies what it reads (2 mirrors, 1 MB)

The base runs didn't get that far into the scene before the 60 s ended (in one 60 s run of mine on main 63cdc25, for #667, the same two lines appear at 58.9 s), so these runs don't show the per-bind VirtualQuery cost either way: the mirrors exist for under a second before the title is ended.

xcl-smoke v1
commit: 91f9a5e9f03156ea82dc55a18f7704862da7a5db
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 986 (PresentX 986)
presents per 2 s (last 3): 49 60 23
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 971 (PresentX 971)
presents per 2 s (last 3): 60 31 0
device removals: 0
crashes: 0
peak commit: 0 MB

(The first pair. peak commit: 0 MB is XCL reading 0 MB committed under Wine, see #257.)

Not tested

  • The unit tests on this branch; Windows, AMD; runs long enough to spend time on the mirrored binds; the picture

AI use: Claude Code (Claude Opus 5.5) built both commits, ran every run above on the machine above and wrote this report. The blocks and counts are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.

<!-- greyfinch-sync:ivall/xcl:comment:7121793876 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121793876). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T04:11:41Z. --- ### Test report: #693 under Wine (Linux, NVIDIA): GTA VI reaches the mirrored-buffer path A retail-title run of this PR under Wine / vkd3d-proton, base `main` `91f9a5e` against head `f44cc79`. No regression, and GTA VI does bind mirrored vertex and index buffers outside unified memory, the case this PR changes, though only in the last seconds of these runs. **Setup** - CachyOS, kernel 7.3.3-1-cachyos, Intel i5-10400F, 16 GB RAM, NVIDIA GeForce RTX 3060 12 GB, driver 620.70.06 - Proton Experimental `experimental-11.0-20261112` (wine-11.0), vkd3d-proton v3.1 (`4522cc1a`) + the patch from #257, DXVK from Proton, DXC 1.9.2609, `DXVK_CONFIG="dxgi.hideNvidiaGpu = False"` - Rust 1.100.0, `x86_64-pc-windows-gnu` (mingw-w64-gcc 16.2.0), release builds - GTA VI 1.0.2.1 (my own dump), 60 s runs with `scripts/linux/smoke.sh` from #257, `XCL_NETWORK=0`, alternating base / PR / PR / base | build | frames shown | removals / crashes | |---|---|---| | `91f9a5e` | 986, 972 | 0 / 0 | | `f44cc79` | 971, 984 | 0 / 0 | Both PR runs log, at about 59 s: ``` [WARN ] UMA: 13391 MB of commit free, under 17408 MB: the title's GPU heaps stay outside unified memory (a larger page file gives them the coherent window) [INFO ] D3D12.X: bottom-of-pipe writes outside unified memory are done by the CPU after the GPU (2 in the first submission) [WARN ] D3D12.X: index buffer at 0x18c8b900 (393216 bytes) is outside unified memory – 0x18c80000..0x18cf0000 mirrored at 0x463a70000, each draw copies what it reads (1 mirrors, 0 MB) [WARN ] D3D12.X: vertex buffer at 0x1b694a80 (1179648 bytes) is outside unified memory – 0x1b690000..0x1b7c0000 mirrored at 0x469a00000, each draw copies what it reads (2 mirrors, 1 MB) ``` The base runs didn't get that far into the scene before the 60 s ended (in one 60 s run of mine on `main` `63cdc25`, for #667, the same two lines appear at 58.9 s), so these runs don't show the per-bind `VirtualQuery` cost either way: the mirrors exist for under a second before the title is ended. ``` xcl-smoke v1 commit: 91f9a5e9f03156ea82dc55a18f7704862da7a5db gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 986 (PresentX 986) presents per 2 s (last 3): 49 60 23 device removals: 0 crashes: 0 peak commit: 0 MB ``` ``` xcl-smoke v1 commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 971 (PresentX 971) presents per 2 s (last 3): 60 31 0 device removals: 0 crashes: 0 peak commit: 0 MB ``` (The first pair. `peak commit: 0 MB` is XCL reading 0 MB committed under Wine, see #257.) **Not tested** - The unit tests on this branch; Windows, AMD; runs long enough to spend time on the mirrored binds; the picture **AI use:** Claude Code (Claude Opus 5.5) built both commits, ran every run above on the machine above and wrote this report. The blocks and counts are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.
LocranKing commented 2026-11-24 07:06:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by LocranKing on 2026-11-24T04:18:22Z.


Tested on Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32).

Tested

  • Commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0 (pr-693, clean tree)
  • Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2101), rustc 1.100.0 (x86_64-pc-windows-msvc, MSVC 14.44.35207), DXC 1.9.2602.17 (SDK 10.0.26100.0), --release
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4: 691 passed, 0 failed, 41 ignored, exit 0; 2 (no wave64) skipped (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware)

Regression run (scripts/smoke.ps1, 60 s, XCL_NETWORK=0, title folder name redacted)

main (f4ce27c):

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 537 (PresentX 538)
presents per 2 s (last 3): 17 17 18
device removals: 0
crashes: 0
peak commit: 15475 MB

PR #693 (f44cc79):

xcl-smoke v1
commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 951 (PresentX 952)
presents per 2 s (last 3): 53 55 55
device removals: 0
crashes: 0
peak commit: 15465 MB

Not tested: Debug build, XCL_SAMPLE_* tests on this branch, runs past 60 s, AMD / wave64 hardware.

AI use: Antigravity (Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.

<!-- greyfinch-sync:ivall/xcl:comment:7121896863 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7121896863). Originally posted by [LocranKing](https://github.com/LocranKing) on 2026-11-24T04:18:22Z. --- Tested on Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32). **Tested** - Commit: `f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0` (`pr-693`, clean tree) - Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (`8024 MiB VRAM`, driver `32.0.16.2101`), `rustc 1.100.0` (`x86_64-pc-windows-msvc`, MSVC `14.44.35207`), DXC `1.9.2602.17` (SDK `10.0.26100.0`), `--release` - `cargo test --workspace --release --no-fail-fast -- --test-threads=4`: **691 passed, 0 failed, 41 ignored**, exit `0`; `2 (no wave64)` skipped (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`) **Regression run** (`scripts/smoke.ps1`, 60 s, `XCL_NETWORK=0`, title folder name redacted) main (`f4ce27c`): ``` xcl-smoke v1 commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 537 (PresentX 538) presents per 2 s (last 3): 17 17 18 device removals: 0 crashes: 0 peak commit: 15475 MB ``` PR #693 (`f44cc79`): ``` xcl-smoke v1 commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 951 (PresentX 952) presents per 2 s (last 3): 53 55 55 device removals: 0 crashes: 0 peak commit: 15465 MB ``` **Not tested:** Debug build, `XCL_SAMPLE_*` tests on this branch, runs past 60 s, AMD / wave64 hardware. **AI use:** Antigravity (`Gemini 4 Hydrogen`) ran the build, tests, and smoke runs and drafted this report from the command outputs.
iggyvilla commented 2026-11-24 07:06:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-24T05:29:53Z.


@brainhay5 Thanks for the retail run. I went through the path after a title access violation on f4ce27c + #693 (eh.rs unhandled_filter → report::write_final → the title's own unhandled-exception filter → hk_nt_terminate_process). Nothing on that path takes the mirror table (MIRRORS in list_x.rs) or a lock that #693's mirrored() call holds. mirrored() takes and drops the lock in one expression and is never called with another lock held, and the waits in write_final are bounded at 2 s. So I don't see a way for #693 itself to block the exit.

#693 does change what the GPU gets for a buffer whose title memory is unreadable at a later bind. Before, the bind got the title's address, which the PC's GPU has no address for. Now it gets the buffer's mirror, with the unreadable part not copied. That can explain why the run gets further: the counter it waits on reaches 0x8c8 instead of 0x623, and 2100 frames presented is close to 0x8c8 = 2248. But that is an inference.

To find where the process is stuck after the fault, could you capture the threads of the hung process (a minidump, or Process Explorer's thread stacks) and check whether WerFault.exe is running for it, and whether report.json has a crash entry?

(Analysis written with Claude Code, Claude Opus 5.5, from reading the code; nothing was run for it.)

<!-- greyfinch-sync:ivall/xcl:comment:7123003202 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7123003202). Originally posted by [iggyvilla](https://github.com/iggyvilla) on 2026-11-24T05:29:53Z. --- @brainhay5 Thanks for the retail run. I went through the path after a title access violation on f4ce27c + #693 (`eh.rs` `unhandled_filter` → `report::write_final` → the title's own unhandled-exception filter → `hk_nt_terminate_process`). Nothing on that path takes the mirror table (`MIRRORS` in `list_x.rs`) or a lock that #693's `mirrored()` call holds. `mirrored()` takes and drops the lock in one expression and is never called with another lock held, and the waits in `write_final` are bounded at 2 s. So I don't see a way for #693 itself to block the exit. #693 does change what the GPU gets for a buffer whose title memory is unreadable at a later bind. Before, the bind got the title's address, which the PC's GPU has no address for. Now it gets the buffer's mirror, with the unreadable part not copied. That can explain why the run gets further: the counter it waits on reaches `0x8c8` instead of `0x623`, and 2100 frames presented is close to `0x8c8` = 2248. But that is an inference. To find where the process is stuck after the fault, could you capture the threads of the hung process (a minidump, or Process Explorer's thread stacks) and check whether `WerFault.exe` is running for it, and whether `report.json` has a `crash` entry? (Analysis written with Claude Code, Claude Opus 5.5, from reading the code; nothing was run for it.)
milas6669 commented 2026-11-24 07:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T06:01:22Z.


Regression run of f44cc7937cc6 (PR head, built as it is, not merged onto main) against main e50836b, on a retail title.

Tested

  • NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0, release builds
  • scripts/smoke.ps1 -Seconds 60, the same title and time for both, one run each, main first:

main (e50836b):

xcl-smoke v1
commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a
gpu: NVIDIA GeForce RTX 3070
title: dumped
seconds: 60
exit: 0x0
frames shown: 287 (PresentX 287)
presents per 2 s (last 3): 9 10 10
device removals: 0
crashes: 0
peak commit: 15863 MB

this PR (f44cc79):

xcl-smoke v1
commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0
gpu: NVIDIA GeForce RTX 3070
title: dumped
seconds: 60
exit: 0x0
frames shown: 384 (PresentX 385)
presents per 2 s (last 3): 18 18 18
device removals: 0
crashes: 0
peak commit: 15413 MB

What this does and does not say

  • It is a regression check: no crash, no device removal, and the frame count and peak commit are within the limits in CONTRIBUTING.md (at least 80 % of main's frames, at most 125 % of its peak commit).
  • It is not a speed measurement. One 60 s run varies a lot here: four runs of main on this machine gave 424, 359, 370 and 287 frames. A difference of this size between main and the PR is inside that noise.

Not tested

  • cargo test on this head (I did not run the test suite for this report)
  • AMD / wave64 hardware, visual correctness (I did not look at the picture)

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7123496030 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7123496030). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-24T06:01:22Z. --- Regression run of `f44cc7937cc6` (PR head, built as it is, not merged onto main) against `main` e50836b, on a retail title. **Tested** - NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0, release builds - `scripts/smoke.ps1 -Seconds 60`, the same title and time for both, one run each, main first: main (e50836b): ``` xcl-smoke v1 commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a gpu: NVIDIA GeForce RTX 3070 title: dumped seconds: 60 exit: 0x0 frames shown: 287 (PresentX 287) presents per 2 s (last 3): 9 10 10 device removals: 0 crashes: 0 peak commit: 15863 MB ``` this PR (f44cc79): ``` xcl-smoke v1 commit: f44cc7937cc6afd7782d6d60ee2ca48e5c84c2d0 gpu: NVIDIA GeForce RTX 3070 title: dumped seconds: 60 exit: 0x0 frames shown: 384 (PresentX 385) presents per 2 s (last 3): 18 18 18 device removals: 0 crashes: 0 peak commit: 15413 MB ``` **What this does and does not say** - It is a regression check: no crash, no device removal, and the frame count and peak commit are within the limits in CONTRIBUTING.md (at least 80 % of main's frames, at most 125 % of its peak commit). - It is not a speed measurement. One 60 s run varies a lot here: four runs of main on this machine gave 424, 359, 370 and 287 frames. A difference of this size between main and the PR is inside that noise. **Not tested** - `cargo test` on this head (I did not run the test suite for this report) - AMD / wave64 hardware, visual correctness (I did not look at the picture) **AI use** - Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.
upstream-sync closed this pull request 2026-11-24 11:04:56 +00:00
ivall commented 2026-11-24 11:05:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-24T10:06:28Z.


Merged (02bfd1d). Checked on main 02bfd1d together with #891, #693, #551 and #631: cargo test --workspace -- --test-threads=4 green (685 lib tests), and a retail run through the menus and intro into the start of the world load with XCL_PSO_WAIT_MS=50: no crash, no device removal.

<!-- greyfinch-sync:ivall/xcl:comment:7128324000 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/693#issuecomment-7128324000). Originally posted by [ivall](https://github.com/ivall) on 2026-11-24T10:06:28Z. --- Merged (02bfd1d). Checked on main 02bfd1d together with #891, #693, #551 and #631: `cargo test --workspace -- --test-threads=4` green (685 lib tests), and a retail run through the menus and intro into the start of the world load with `XCL_PSO_WAIT_MS=50`: no crash, no device removal.
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
xcl-dev/xcl!688
No description provided.