D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #1435

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

@⁠lukastaro on GitHub · 2026-11-24 15:54 UTC · original
lukastaro:xg-copy-subresource-newer-form → main · +73 −3 · 1 files · 1 commits · open

A retail game crashed during its world loading, every run: an access violation in a memcpy writing to title memory that was never reserved, mapped or committed. The writer was XCL's XGTextureAddressComputer::CopyFromSubresource (vtable #9), which the game calls as (linear dst, plane, subresource, 0, tiled src, row pitch, slice pitch): its XG library has a 32-bit argument before the source pointer, which the library the oracle test uses does not have. Read the 6-argument way, the source was the 0 dword with the stack slot's old upper half, and the row pitch the low half of the real source pointer, so the second row went gigabytes past the destination.

The game calls both forms, so they are told apart per call: a value of 16 bits or less in the fourth slot with address space in use at the fifth is the newer form (address space, not readable memory: a title's pages are committed on first use). A nonzero added argument is logged once and ignored; its meaning is not known (the game passes 0).

What is in it

  • copy_args and the two copy methods taking either form (hle/xg.rs).
  • A unit test: both forms tile the same bytes and read them back, with garbage in the upper half of the added argument's slot (hle/xg.rs).

Tested

  • NVIDIA GeForce RTX 5060 Ti (driver 617.42, Agility SDK 1.620.2), Intel Core i7-14700K, Windows 10 22H2 (19045), Rust 1.100.0; tests in debug, smoke and game runs in release.
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware – no wave64 on this GPU).
  • The retail game: the crash was in every run before (8 runs, 60 – 112 s into the run); with the change the newer form is logged at that point and none of the runs since (more than 10) crashed there. They stop later for other reasons.

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5060 Ti
title: Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1371 (PresentX 1371)
presents per 2 s (last 3): 1 3 12
device removals: 0
crashes: 0
peak commit: 25566 MB

PR:

xcl-smoke v1
commit: 14c8a2d11a7b975bc7a0e98468cfeb705244af8b
gpu: NVIDIA GeForce RTX 5060 Ti
title: Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1620 (PresentX 1620)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17179 MB

An offline shader precompile ran on the same machine during the main run (and less of it during the PR's), so the frame and commit numbers differ more than the change does; the 60 s stay in the game's menus, before the copy this changes.

Not tested

  • AMD and Intel GPUs (the change is CPU-side).
  • The console library itself: no copy of the newer XG library is at hand, so the newer form is inferred from the game's call sites (game code calling vtable #9 with the seven arguments above), not checked against it like xg_oracle.
  • What the added argument means when it is not 0.
  • Other titles with the newer library.

AI use

  • Claude Code (Claude Opus 5.5): found the crash (disassembly of the game's call site, XCL's logs), wrote the change, the test and this description; the runs above were made on the hardware named.

🤖 Generated with Claude Code

**@⁠lukastaro** on GitHub · 2026-11-24 15:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435) `lukastaro:xg-copy-subresource-newer-form` → `main` · +73 −3 · 1 files · 1 commits · open A retail game crashed during its world loading, every run: an access violation in a `memcpy` writing to title memory that was never reserved, mapped or committed. The writer was XCL's `XGTextureAddressComputer::CopyFromSubresource` (vtable #9), which the game calls as `(linear dst, plane, subresource, 0, tiled src, row pitch, slice pitch)`: its XG library has a 32-bit argument before the source pointer, which the library the oracle test uses does not have. Read the 6-argument way, the source was the 0 dword with the stack slot's old upper half, and the row pitch the low half of the real source pointer, so the second row went gigabytes past the destination. The game calls both forms, so they are told apart per call: a value of 16 bits or less in the fourth slot with address space in use at the fifth is the newer form (address space, not readable memory: a title's pages are committed on first use). A nonzero added argument is logged once and ignored; its meaning is not known (the game passes 0). **What is in it** - `copy_args` and the two copy methods taking either form (`hle/xg.rs`). - A unit test: both forms tile the same bytes and read them back, with garbage in the upper half of the added argument's slot (`hle/xg.rs`). **Tested** - NVIDIA GeForce RTX 5060 Ti (driver 617.42, Agility SDK 1.620.2), Intel Core i7-14700K, Windows 10 22H2 (19045), Rust 1.100.0; tests in debug, smoke and game runs in release. - `cargo build --workspace`, then `cargo test --workspace -- --test-threads=4`: 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` – no wave64 on this GPU). - The retail game: the crash was in every run before (8 runs, 60 – 112 s into the run); with the change the newer form is logged at that point and none of the runs since (more than 10) crashed there. They stop later for other reasons. **Regression run** main: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 5060 Ti title: Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1371 (PresentX 1371) presents per 2 s (last 3): 1 3 12 device removals: 0 crashes: 0 peak commit: 25566 MB ``` PR: ``` xcl-smoke v1 commit: 14c8a2d11a7b975bc7a0e98468cfeb705244af8b gpu: NVIDIA GeForce RTX 5060 Ti title: Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1620 (PresentX 1620) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17179 MB ``` An offline shader precompile ran on the same machine during the main run (and less of it during the PR's), so the frame and commit numbers differ more than the change does; the 60 s stay in the game's menus, before the copy this changes. **Not tested** - AMD and Intel GPUs (the change is CPU-side). - The console library itself: no copy of the newer XG library is at hand, so the newer form is inferred from the game's call sites (game code calling vtable #9 with the seven arguments above), not checked against it like `xg_oracle`. - What the added argument means when it is not 0. - Other titles with the newer library. **AI use** - Claude Code (Claude Opus 5.5): found the crash (disassembly of the game's call site, XCL's logs), wrote the change, the test and this description; the runs above were made on the hardware named. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A retail game crashed during its world loading, every run: an
access violation in a memcpy writing to title memory that was never
reserved, mapped or committed. The writer was XCL's
XGTextureAddressComputer::CopyFromSubresource (vtable #9), called by the
game as (linear dst, plane, subresource, 0, tiled src, row pitch, slice
pitch): its library has a 32-bit argument before the source pointer,
which the library the oracle test uses (XDefiant's) does not. Read the
6-argument way, the source was the 0 dword with the stack slot's old
upper half, and the row pitch the low half of the real source pointer,
so the second row went gigabytes past the destination.

The game calls both forms, so they are told apart per call: a value of
16 bits or less in the fourth slot with address space in use at the
fifth is the newer form (address space, not readable memory: title pages
are committed on first use). A nonzero added argument is logged once and
ignored; its meaning is not known.

New test: both forms tile the same bytes and read them back, with
garbage in the upper half of the added argument's slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:48 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 16:53 UTC · original · edited 2026-11-24 17:09 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 14c8a2d (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: subresource_copies_take_both_argument_forms.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 16:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7138359335) · edited 2026-11-24 17:09 UTC Full-suite run, since this PR has no test report yet. Tested exact head `14c8a2d` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `subresource_copies_take_both_argument_forms`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 18:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7141272114) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠iggyvilla on GitHub · 2026-11-25 08:03 UTC · original

Test report on 14c8a2d (merged with #2120 on main cbc296a as b5c481f;
cargo build --release -p xcl), 2 world-load walks on RX 6650 XT 8 GB (RDNA2)
/ Adrenalin 32.0.21045.29003 / 32 GB RAM (PRELOAD=0, XCL_PSO_WAIT_MS=2000,
-FromSave, commit stop at 37.8 GB).

Tested: same tree and runs as the #2120 report on this machine
(b5c481f, walks auto-20261125-154354 and auto-20261125-155228).

What was measured: the PR's per-form logging fires once per copy form in
both walks — in the 6-argument form at 2.5 s / 2.7 s and in the newer 7-argument form at 125.5 s / 126.9 s (during world load). No 0x80000003
and no +0x4dcbc9d in either log: the packet-stream assert did not fire here.

Not tested: a run that reaches the account-prompt assert itself (these runs
come from a save); suite run on this tree; other GPUs.

AI use: Measured by an omp agent running DeepSeek v4.1 Flash; text drafted
by Muse Spark 1.3; checked and posted by Claude Code (Claude Opus 5.5) on my
behalf; I did not run the tests or write the text.

**@⁠iggyvilla** on GitHub · 2026-11-25 08:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7156550184) Test report on `14c8a2d` (merged with #2120 on `main cbc296a` as `b5c481f`; `cargo build --release -p xcl`), 2 world-load walks on RX 6650 XT 8 GB (RDNA2) / Adrenalin 32.0.21045.29003 / 32 GB RAM (`PRELOAD=0`, `XCL_PSO_WAIT_MS=2000`, `-FromSave`, commit stop at 37.8 GB). **Tested:** same tree and runs as the #2120 report on this machine (`b5c481f`, walks `auto-20261125-154354` and `auto-20261125-155228`). **What was measured:** the PR's per-form logging fires once per copy form in both walks — `in the 6-argument form` at 2.5 s / 2.7 s and `in the newer 7-argument form` at 125.5 s / 126.9 s (during world load). No `0x80000003` and no `+0x4dcbc9d` in either log: the packet-stream assert did not fire here. **Not tested:** a run that reaches the account-prompt assert itself (these runs come from a save); suite run on this tree; other GPUs. **AI use:** Measured by an omp agent running DeepSeek v4.1 Flash; text drafted by Muse Spark 1.3; checked and posted by Claude Code (Claude Opus 5.5) on my behalf; I did not run the tests or write the text.
Author
Owner

@⁠xpatfussy69x on GitHub · 2026-11-25 11:57 UTC · original

Test report for head 14c8a2d as pushed (not merged onto current main) – NVIDIA, wave32.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64)
  • this PR's test subresource_copies_take_both_argument_forms ran and passed
  • no XCL_SAMPLE_* data set (game-data tests not run, so not with the title's real xg library)

Not tested

  • a smoke run on a title; AMD / native wave64; release build; the head merged onto current main

AI use

  • Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
**@⁠xpatfussy69x** on GitHub · 2026-11-25 11:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7161729583) Test report for head `14c8a2d` as pushed (not merged onto current `main`) – NVIDIA, wave32. **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5 - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 752 passed, 0 failed, 41 ignored - SKIPPED GPU tests on this adapter: 2 (no wave64) - this PR's test `subresource_copies_take_both_argument_forms` ran and passed - no `XCL_SAMPLE_*` data set (game-data tests not run, so not with the title's real `xg` library) **Not tested** - a smoke run on a title; AMD / native wave64; release build; the head merged onto current `main` **AI use** - Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
Author
Owner

@⁠ClosetPie107 on GitHub · 2026-11-25 12:28 UTC · original

Linux / AMD RDNA4 (RADV) test report for head 14c8a2d merged locally onto main 1a0bbe3 (clean merge).

Environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS
  • Proton Experimental (experimental-11.0-20261112), vkd3d-proton v3.1 (#257 + dxil-spirv 53aac418), DXVK v3.1.1-209, DXC 1.9.2609.5, x86_64-pc-windows-gnu cross-compile

Tested (debug test binary under Wine, --test-threads=1 --nocapture)

  • hle::xg::tests: 4 passed, 0 failed, 0 ignored, 0 skipped (0.00 s), including subresource_copies_take_both_argument_forms.

Not tested: full workspace suite, retail title run, native Windows.

AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.

**@⁠ClosetPie107** on GitHub · 2026-11-25 12:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7162417040) Linux / AMD RDNA4 (RADV) test report for head `14c8a2d` merged locally onto `main` `1a0bbe3` (clean merge). **Environment** - AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS - Proton Experimental (`experimental-11.0-20261112`), vkd3d-proton v3.1 (`#257` + `dxil-spirv` `53aac418`), DXVK `v3.1.1-209`, DXC `1.9.2609.5`, `x86_64-pc-windows-gnu` cross-compile **Tested** (debug test binary under Wine, `--test-threads=1 --nocapture`) - `hle::xg::tests`: **4 passed, 0 failed, 0 ignored, 0 skipped** (0.00 s), including `subresource_copies_take_both_argument_forms`. **Not tested:** full workspace suite, retail title run, native Windows. **AI use:** T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
Author
Owner

@⁠Placebola on GitHub · 2026-11-25 17:07 UTC · original

Test report on 14c8a2d merged onto main 06c9f55 (clean merge, release build): it removes the memcpy access violation during the retail title's world load on this machine.

Tested

  • NVIDIA GeForce RTX 4060 Ti 8 GB, driver 621.40 (32.0.16.2140), Intel Core i7-7700, 32 GB RAM, Windows 10 22H2 (19045), release build.
  • xcl run on the retail title, XCL_NETWORK=0, XCL_RUN_SECONDS=200, A pressed every 4 s from 20 s, warm DXIL cache.
  • main 06c9f55 alone: 2 runs out of 2 end with 0xc0000005 in VCRUNTIME140!memcpy (write past the destination, at 130 s and 138 s), called from xcl::hle::xg::copy_from. One of my own manual runs on main ended the same way.
  • main 06c9f55 + this PR: 3 runs out of 3 reach 200 s with no crash and no device removal (2191 – 2466 frames shown). Each run logs both forms: called in the 6-argument form at about 3 s, then called in the newer 7-argument form at 133 – 161 s, which is when main alone crashes.

This title calls both forms in the same run. #684 fixes the same crash, and an older tree of mine with it (main 9633138 + #684) got past this point too. But #684 reads CopyFromSubresource in the 7-argument form only and leaves CopyIntoSubresource as it is. This PR tells the two forms apart on every call, for both methods, so it covers more of what this title does.

Not tested

  • cargo test, scripts/smoke.ps1; AMD; #684 on 06c9f55.

AI use

  • Claude Code (Claude Opus 5.5) ran the runs, read the crash dumps and logs, and wrote this comment.
**@⁠Placebola** on GitHub · 2026-11-25 17:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7169047055) Test report on `14c8a2d` merged onto `main` `06c9f55` (clean merge, release build): **it removes the `memcpy` access violation during the retail title's world load on this machine.** **Tested** - NVIDIA GeForce RTX 4060 Ti 8 GB, driver 621.40 (32.0.16.2140), Intel Core i7-7700, 32 GB RAM, Windows 10 22H2 (19045), release build. - `xcl run` on the retail title, `XCL_NETWORK=0`, `XCL_RUN_SECONDS=200`, A pressed every 4 s from 20 s, warm DXIL cache. - `main` `06c9f55` alone: 2 runs out of 2 end with `0xc0000005` in `VCRUNTIME140!memcpy` (write past the destination, at 130 s and 138 s), called from `xcl::hle::xg::copy_from`. One of my own manual runs on `main` ended the same way. - `main` `06c9f55` + this PR: 3 runs out of 3 reach 200 s with no crash and no device removal (2191 – 2466 frames shown). Each run logs both forms: `called in the 6-argument form` at about 3 s, then `called in the newer 7-argument form` at 133 – 161 s, which is when `main` alone crashes. This title calls both forms in the same run. #684 fixes the same crash, and an older tree of mine with it (`main` `9633138` + #684) got past this point too. But #684 reads `CopyFromSubresource` in the 7-argument form only and leaves `CopyIntoSubresource` as it is. This PR tells the two forms apart on every call, for both methods, so it covers more of what this title does. **Not tested** - `cargo test`, `scripts/smoke.ps1`; AMD; #684 on `06c9f55`. **AI use** - Claude Code (Claude Opus 5.5) ran the runs, read the crash dumps and logs, and wrote this comment.
Author
Owner

@⁠DLampos on GitHub · 2026-11-25 19:06 UTC · original

Independent confirmation on Linux. This is not a run of this PR's commit: I hit the same crash on a retail title (build 1.0.2.1) and made the same change locally, on main at c160d86. In that change, copy_from takes the extra u32 between the subresource and the source pointer. I did not build this PR's branch.

Tested

  • Fedora 45 (kernel 7.3), AMD Ryzen 7 9700X, 30 GB RAM, NVIDIA RTX 4070 SUPER 12 GB, driver 620.70 (open kernel module).
  • XCL cross-built for x86_64-pc-windows-gnu (release), running under Proton Experimental's Wine 11 with DXVK's dxgi and vkd3d-proton. vkd3d-proton was built from Proton's commit 2576c0b4 with two local patches for XCL's vtable swap.
  • Before the change: 4 runs, with VKD3D_CONFIG=no_upload_hvv to get past an unrelated vkd3d-proton abort.
    • All 4 ended at 62.9–66.1 s with an access violation in memcpy called from xcl::hle::xg::copy_from. The writes went to 0x8_070c_c5f0 – 0x8_4fe0_74a0, outside anything mapped.
    • At the title's call site (+0x979f31), dword 0 is at [rsp+0x20], the source at [rsp+0x28] and the pitches at [rsp+0x30] / [rsp+0x38]. Read as six arguments, the row pitch became the low half of the source pointer.
  • After the change: 2 runs, one with the default config and one with no_upload_hvv.
    • Both passed that point and kept presenting frames until 92–94 s.
    • The title's own watchdog then ended them during long compute pipeline builds, which is unrelated to XG.

Not tested

  • This PR's own commit.
  • Windows and AMD GPUs.
  • The test suite with this change.

AI use

  • Claude Code with Claude Opus 5.5 did the investigation and wrote this report.
**@⁠DLampos** on GitHub · 2026-11-25 19:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7171834912) Independent confirmation on Linux. This is not a run of this PR's commit: I hit the same crash on a retail title (build 1.0.2.1) and made the same change locally, on `main` at c160d86. In that change, `copy_from` takes the extra `u32` between the subresource and the source pointer. I did not build this PR's branch. **Tested** - Fedora 45 (kernel 7.3), AMD Ryzen 7 9700X, 30 GB RAM, NVIDIA RTX 4070 SUPER 12 GB, driver 620.70 (open kernel module). - XCL cross-built for `x86_64-pc-windows-gnu` (release), running under Proton Experimental's Wine 11 with DXVK's dxgi and vkd3d-proton. vkd3d-proton was built from Proton's commit 2576c0b4 with two local patches for XCL's vtable swap. - Before the change: 4 runs, with `VKD3D_CONFIG=no_upload_hvv` to get past an unrelated vkd3d-proton abort. - All 4 ended at 62.9–66.1 s with an access violation in `memcpy` called from `xcl::hle::xg::copy_from`. The writes went to 0x8_070c_c5f0 – 0x8_4fe0_74a0, outside anything mapped. - At the title's call site (`+0x979f31`), dword 0 is at `[rsp+0x20]`, the source at `[rsp+0x28]` and the pitches at `[rsp+0x30]` / `[rsp+0x38]`. Read as six arguments, the row pitch became the low half of the source pointer. - After the change: 2 runs, one with the default config and one with `no_upload_hvv`. - Both passed that point and kept presenting frames until 92–94 s. - The title's own watchdog then ended them during long compute pipeline builds, which is unrelated to XG. **Not tested** - This PR's own commit. - Windows and AMD GPUs. - The test suite with this change. **AI use** - Claude Code with Claude Opus 5.5 did the investigation and wrote this report.
Author
Owner

@⁠anes66 on GitHub · 2026-11-25 20:01 UTC · original · edited 2026-11-25 20:31 UTC

Native Windows reproduction on unmodified main 2898511, followed by CPU checks of this PR.

A manual loading-screen run on Windows 10 22H2 / RTX 3060 12 GB ended at 612.097 s with a write AV in VCRUNTIME140.dll+0x1cc83, destination 0x808a1c840. The stack scan includes:

xcl.exe+0x9d180
game_scarlett_master.exe+0x979f5b
game_scarlett_master.exe+0x4fb0c2f
game_scarlett_master.exe+0x50bb3f0
game_scarlett_master.exe+0x979db0

Using the matching release PDB offline, Windows SDK dbh resolves xcl.exe+0x9d180 to xcl::hle::xg::copy_from+0x2d0, hle/xg.rs:713, the row-copy call. This matches the first failure in #662. The run logged no 0x8007000E, device-removal or GPU-wait-timeout message; that does not establish a general absence of memory pressure.

Unmodified head 14c8a2d passes all four hle::xg::tests here. I added CPU coverage for pitched mips, array slices, depth/stencil planes, BC formats, volumes and reserved source addresses in #2483: six tests pass both on your head and when carried onto main e0d93c8. The additional tests are authored under anes66; their dependency retains your original commit author.

Not tested: a title run with this PR on this machine, GPU tests or the full workspace suite. A separate build is being prepared for a manual before/after check; there is no claim yet that it removes our crash.


Manual A/B follow-up, 25 November

The separate release build is now tested manually: main 2898511 + your exact runtime change (14c8a2d, cherry-picked as cb9041c) + the test-only commit, head aec6fa1. Same machine, title and launcher settings as the baseline. Existing caches and saves were retained, so this is not a cold-cache comparison.

  • Baseline above: write AV in xg::copy_from at 612.097 s.
  • Patched run: the 6-argument form is logged at 3.899 s and the newer 7-argument form at 592.175 s. No access violation was recorded. The user closed the game window at 1203.425 s; the launcher and XCL report both record exit 0 and the report has crash: null.
  • The user saw loading finish and then a black window. The last activity interval with nonzero presents is at 592.175 s; no further presents were recorded before manual closure, although occasional dispatches continued. This is not a successful world-rendering result.
  • Final report: 17,292 presents, 1,844 translated pipelines, 40 translation errors (including the existing MS-in-AS-slot refusals); 123 DXIL compilations with 0 compilation failures.
  • Host-process sampling every two seconds: peak private bytes 31,386 MiB, peak working set 17,648 MiB. The final activity memory line reports 28,117 MB process commit, 12,552 MB local video memory and 4,759 MB non-local. These measurements do not identify the cause of the black screen.

This one run gets past the previous copy_from AV and remains alive until manual closure. It does not establish a general fix for the remaining loading/rendering stall. No title binaries, dumps or complete local logs are uploaded.

**@⁠anes66** on GitHub · 2026-11-25 20:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7173085675) · edited 2026-11-25 20:31 UTC Native Windows reproduction on unmodified `main` `2898511`, followed by CPU checks of this PR. A manual loading-screen run on Windows 10 22H2 / RTX 3060 12 GB ended at 612.097 s with a write AV in `VCRUNTIME140.dll+0x1cc83`, destination `0x808a1c840`. The stack scan includes: ```text xcl.exe+0x9d180 game_scarlett_master.exe+0x979f5b game_scarlett_master.exe+0x4fb0c2f game_scarlett_master.exe+0x50bb3f0 game_scarlett_master.exe+0x979db0 ``` Using the matching release PDB offline, Windows SDK `dbh` resolves `xcl.exe+0x9d180` to `xcl::hle::xg::copy_from+0x2d0`, `hle/xg.rs:713`, the row-copy call. This matches the first failure in #662. The run logged no `0x8007000E`, device-removal or GPU-wait-timeout message; that does not establish a general absence of memory pressure. Unmodified head `14c8a2d` passes all four `hle::xg::tests` here. I added CPU coverage for pitched mips, array slices, depth/stencil planes, BC formats, volumes and reserved source addresses in #2483: six tests pass both on your head and when carried onto `main` `e0d93c8`. The additional tests are authored under `anes66`; their dependency retains your original commit author. **Not tested:** a title run with this PR on this machine, GPU tests or the full workspace suite. A separate build is being prepared for a manual before/after check; there is no claim yet that it removes our crash. --- **Manual A/B follow-up, 25 November** The separate release build is now tested manually: `main` `2898511` + your exact runtime change (`14c8a2d`, cherry-picked as `cb9041c`) + the test-only commit, head `aec6fa1`. Same machine, title and launcher settings as the baseline. Existing caches and saves were retained, so this is not a cold-cache comparison. - Baseline above: write AV in `xg::copy_from` at 612.097 s. - Patched run: the 6-argument form is logged at 3.899 s and the newer 7-argument form at 592.175 s. No access violation was recorded. The user closed the game window at 1203.425 s; the launcher and XCL report both record exit 0 and the report has `crash: null`. - The user saw loading finish and then a black window. The last activity interval with nonzero presents is at 592.175 s; no further presents were recorded before manual closure, although occasional dispatches continued. This is not a successful world-rendering result. - Final report: 17,292 presents, 1,844 translated pipelines, 40 translation errors (including the existing MS-in-AS-slot refusals); 123 DXIL compilations with 0 compilation failures. - Host-process sampling every two seconds: peak private bytes 31,386 MiB, peak working set 17,648 MiB. The final activity memory line reports 28,117 MB process commit, 12,552 MB local video memory and 4,759 MB non-local. These measurements do not identify the cause of the black screen. This one run gets past the previous `copy_from` AV and remains alive until manual closure. It does not establish a general fix for the remaining loading/rendering stall. No title binaries, dumps or complete local logs are uploaded.
Author
Owner

@⁠madaraXor on GitHub · 2026-11-25 21:55 UTC · original

Test report on the retail title: this fixes #646's VCRUNTIME140 memcpy crash here, and shows what the old reading does first. Tested commit: 14c8a2d (this PR's head).

Setup: RX 6700 XT (RDNA2), Windows 10 22H2, release build. Not plain main: main 65fc114 + #1803, #2229, #2384 (with a local fix of its deadlock), #1790, #2385, #1795, #2246, then this PR merged on top (no conflict). XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_GPU_VIEW_BUFFERS=1, same input script in every run.

Without this PR (two runs):

  • Run 1 crashed at 464 s in #646's stack: VCRUNTIME140.dll+0x1dcf3, write, rbx=0x40000 rdi=0x800, title frames +0x979f5b, +0x4fb0c2f, +0x50bb3f0. The return address on the stack is xg::copy_from+0x168, the instruction after its call memcpy (disassembled with the build's PDB).
  • Run 2 checked each destination row for writable memory first (local diagnostic):
    XG: CopyFromSubresource into 0x737700000: row 3 of 128 is not writable memory (level 0 of 10, 128x128 elements of 16 B, row 2048 B, row pitch 1167691776, slice pitch 2048, side 4, mode 5)
    XG: CopyFromSubresource into 0x7375951c0: row 3 of 32 is not writable memory (level 0 of 6, 32x32 elements of 8 B, row 256 B, row pitch 1175744512, slice pitch 256, side 4, mode 5)
    
    The "row pitch" is the low half of a pointer (0x45999000, the same value as r12 in run 1's crash), and the "slice pitch" is the real row pitch. Rows 1 and 2 had already been written ~1.1 GB and ~2.2 GB past the destination, into memory the title owns, before row 3 reached an uncommitted page. Presents stopped 4 s later.
  • So before the crash, this path silently corrupts title memory, and only when the wild row lands on an uncommitted page does it show as #646's crash.

With this PR: the log has called in the 6-argument form at 23 s and called in the newer 7-argument form at 453 s, as the PR says. There is no XG write outside the destination and no crash to the end of the run, which then waits on driver compiles, a separate matter. The PR's subresource_copies_take_both_argument_forms test was not run separately here.

The 464 s run was at 21.5 GB commit and 10 GB local VRAM, so on this machine #646's crash was not the commit wall.

Claude Code (Claude Opus 5.5): wrote this from the runs above (logs, cdb). Counts, times and RVAs only.

**@⁠madaraXor** on GitHub · 2026-11-25 21:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1435#issuecomment-7175720197) **Test report on the retail title: this fixes #646's `VCRUNTIME140` memcpy crash here, and shows what the old reading does first.** Tested commit: `14c8a2d` (this PR's head). **Setup:** RX 6700 XT (RDNA2), Windows 10 22H2, release build. Not plain `main`: `main 65fc114` + #1803, #2229, #2384 (with a local fix of its deadlock), #1790, #2385, #1795, #2246, then this PR merged on top (no conflict). `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_GPU_VIEW_BUFFERS=1`, same input script in every run. **Without this PR** (two runs): - Run 1 crashed at 464 s in #646's stack: `VCRUNTIME140.dll+0x1dcf3`, write, `rbx=0x40000 rdi=0x800`, title frames `+0x979f5b`, `+0x4fb0c2f`, `+0x50bb3f0`. The return address on the stack is `xg::copy_from+0x168`, the instruction after its `call memcpy` (disassembled with the build's PDB). - Run 2 checked each destination row for writable memory first (local diagnostic): ``` XG: CopyFromSubresource into 0x737700000: row 3 of 128 is not writable memory (level 0 of 10, 128x128 elements of 16 B, row 2048 B, row pitch 1167691776, slice pitch 2048, side 4, mode 5) XG: CopyFromSubresource into 0x7375951c0: row 3 of 32 is not writable memory (level 0 of 6, 32x32 elements of 8 B, row 256 B, row pitch 1175744512, slice pitch 256, side 4, mode 5) ``` The "row pitch" is the low half of a pointer (`0x45999000`, the same value as `r12` in run 1's crash), and the "slice pitch" is the real row pitch. Rows 1 and 2 had already been written ~1.1 GB and ~2.2 GB past the destination, into memory the title owns, before row 3 reached an uncommitted page. Presents stopped 4 s later. - So before the crash, this path silently corrupts title memory, and only when the wild row lands on an uncommitted page does it show as #646's crash. **With this PR:** the log has `called in the 6-argument form` at 23 s and `called in the newer 7-argument form` at 453 s, as the PR says. There is no XG write outside the destination and no crash to the end of the run, which then waits on driver compiles, a separate matter. The PR's `subresource_copies_take_both_argument_forms` test was not run separately here. The 464 s run was at 21.5 GB commit and 10 GB local VRAM, so on this machine #646's crash was not the commit wall. *Claude Code (Claude Opus 5.5): wrote this from the runs above (logs, cdb). Counts, times and RVAs only.*
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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