Memory: a crash report names the faulting address's memory state #1177

Open
themaoci wants to merge 2 commits from upstream-pr/1186 into main
themaoci commented 2026-11-24 12:58:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by themaoci on 2026-11-24T12:58:00Z.


Part of the retail-title bring-up (no issue filed for it). A newer retail title now boots through its first-boot screens and menus at 30 fps, decodes its BCPack streams and loads into the world; it then dies with an access violation as it spawns into the first cutscene. The old crash report gave the faulting module and address but not what that address was, which is exactly the distinction this crash needs.

With this change the unhandled-access-violation line says what the faulting address is in Windows (reserve / commit / free, protection, region) and, inside unified memory, which UMA window and whether a live sparse allocation or a free reservation holds it. kernelx::lazy::mark warns when it is given an address that is not 64 KiB aligned – the fault handler keys the fault's own 64 KiB page, so such a mark can never be claimed – and a fault nobody claims names the page and the marks around it.

What it showed on the title:

  • debug build: a 256 KB write at 0x80994ca20 – reserve, no access, private region 0x80994c000+0x2024000;
  • release build: a 2 KB write at 0x84cae0dc0 – reserve, no access, private region 0x84cae0000+0x3b8b10000;
  • one access violation in each log, so XCL's lazy commit did not claim the page. Both regions start at an address that is 4 KiB but not 64 KiB aligned, which is the mark/fault key mismatch this PR makes visible.

What is in it

  • crates/xcl/src/eh.rs: describe_fault, appended to the access-violation line; a unit test for reserved versus committed pages.
  • crates/xcl/src/gpu/uma.rs: Uma::describe (window kind, live sparse allocation or free reservation), with try_lock in the report path so a fault on a lock holder cannot deadlock the report.
  • crates/xcl/src/hle/kernelx/lazy.rs: an unaligned mark warning naming its caller, and an unclaimed-fault log with the page and the nearby marks.

Tested

  • AMD Radeon RX 7900 XTX, Windows 10 Enterprise LTSC 19044, rustc 1.98.1, debug and release.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPED.
  • The title: menus at 30 fps; BCPack BC1 / BC5 / BC7 / BC6H streams unpack; loads into the world; the crash reproduces on both builds with the reports above.

Regression run

main (47efa2e):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 7900 XTX
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1420 (PresentX 1420)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14993 MB

this PR (681c0c8):

xcl-smoke v1
commit: 681c0c8fe51c1781f43d6c4969a43ec2d4dfc9b2
gpu: AMD Radeon RX 7900 XTX
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1412 (PresentX 1412)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15357 MB

Not tested

  • NVIDIA and wave32-only GPUs.
  • The lazy-mapping fix itself is not in this PR: the crash still happens, it is now attributable.
  • The title's data is not part of the repository.

AI use

  • Quantum Code CLI — a private agent CLI with a persistent hivemind memory (recall across sessions), context refill/compaction and automatic stale-context cleanup — running deepseek-v4.1-flash; it wrote the code, the test and this description. A person ran the tests, the smoke runs and the title. The model is disclosed as written: CONTRIBUTING.md does not accept it for code, so the PR checks workflow refuses this description.
<!-- greyfinch-sync:ivall/xcl:issue:5472589543 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1186). Originally posted by [themaoci](https://github.com/themaoci) on 2026-11-24T12:58:00Z. --- Part of the retail-title bring-up (no issue filed for it). A newer retail title now boots through its first-boot screens and menus at 30 fps, decodes its BCPack streams and loads into the world; it then dies with an access violation as it spawns into the first cutscene. The old crash report gave the faulting module and address but not what that address was, which is exactly the distinction this crash needs. With this change the unhandled-access-violation line says what the faulting address is in Windows (`reserve` / `commit` / `free`, protection, region) and, inside unified memory, which UMA window and whether a live sparse allocation or a free reservation holds it. `kernelx::lazy::mark` warns when it is given an address that is not 64 KiB aligned – the fault handler keys the fault's own 64 KiB page, so such a mark can never be claimed – and a fault nobody claims names the page and the marks around it. What it showed on the title: - debug build: a 256 KB write at `0x80994ca20` – `reserve, no access, private region 0x80994c000+0x2024000`; - release build: a 2 KB write at `0x84cae0dc0` – `reserve, no access, private region 0x84cae0000+0x3b8b10000`; - one access violation in each log, so XCL's lazy commit did not claim the page. Both regions start at an address that is 4 KiB but not 64 KiB aligned, which is the mark/fault key mismatch this PR makes visible. **What is in it** - `crates/xcl/src/eh.rs`: `describe_fault`, appended to the access-violation line; a unit test for reserved versus committed pages. - `crates/xcl/src/gpu/uma.rs`: `Uma::describe` (window kind, live sparse allocation or free reservation), with `try_lock` in the report path so a fault on a lock holder cannot deadlock the report. - `crates/xcl/src/hle/kernelx/lazy.rs`: an unaligned `mark` warning naming its caller, and an unclaimed-fault log with the page and the nearby marks. **Tested** - AMD Radeon RX 7900 XTX, Windows 10 Enterprise LTSC 19044, rustc 1.98.1, debug and release. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 742 passed, 0 failed, 41 ignored, no SKIPPED. - The title: menus at 30 fps; BCPack BC1 / BC5 / BC7 / BC6H streams unpack; loads into the world; the crash reproduces on both builds with the reports above. **Regression run** main (`47efa2e`): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 7900 XTX title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1420 (PresentX 1420) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14993 MB ``` this PR (`681c0c8`): ``` xcl-smoke v1 commit: 681c0c8fe51c1781f43d6c4969a43ec2d4dfc9b2 gpu: AMD Radeon RX 7900 XTX title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1412 (PresentX 1412) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15357 MB ``` **Not tested** - NVIDIA and wave32-only GPUs. - The lazy-mapping fix itself is not in this PR: the crash still happens, it is now attributable. - The title's data is not part of the repository. **AI use** - Quantum Code CLI — a private agent CLI with a persistent hivemind memory (recall across sessions), context refill/compaction and automatic stale-context cleanup — running `deepseek-v4.1-flash`; it wrote the code, the test and this description. A person ran the tests, the smoke runs and the title. The model is disclosed as written: CONTRIBUTING.md does not accept it for code, so the `PR checks` workflow refuses this description.
themaoci commented 2026-11-24 14:06:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by themaoci on 2026-11-24T13:06:30Z.


no idea why no deepseek - where this one is more accurate then any other ai i was using so far and way cheaper

<!-- greyfinch-sync:ivall/xcl:comment:7132358898 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1186#issuecomment-7132358898). Originally posted by [themaoci](https://github.com/themaoci) on 2026-11-24T13:06:30Z. --- no idea why no deepseek - where this one is more accurate then any other ai i was using so far and way cheaper
DavidM1911 commented 2026-11-24 14:06:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:07:51Z.


Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

  • cargo test -p xcl --lib lazy: 4 passed, 0 failed — lazy-page commit paths intact.
  • cargo test -p xcl --lib uma: 10 passed, 0 failed — the new fault-report naming in gpu/uma.rs + kernelx/lazy.rs doesn't disturb the UMA suite (gpu_uma_import_check_at_init green on this adapter).

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

<!-- greyfinch-sync:ivall/xcl:comment:7132390748 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1186#issuecomment-7132390748). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T13:07:51Z. --- Independent verification on current `main` `384f7f7` (branch already contains it — clean). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug. - `cargo test -p xcl --lib lazy`: **4 passed, 0 failed** — lazy-page commit paths intact. - `cargo test -p xcl --lib uma`: **10 passed, 0 failed** — the new fault-report naming in `gpu/uma.rs` + `kernelx/lazy.rs` doesn't disturb the UMA suite (`gpu_uma_import_check_at_init` green on this adapter). AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Foniass commented 2026-12-01 05:02:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:02:20Z.


Triage (#1607) – head 681c0c8

No open or merged PR makes the same change (#3027 dumps memory around the pointers, #488 is about failed lazy commits). eh::describe_fault and Uma::describe (with try_lock) look correct.
In kernelx/lazy.rs::handler the new warning fires for the first 8 access violations the lazy handler does not claim and says such a fault ends the process. This is a vectored handler that returns CONTINUE_SEARCH, so later handlers (the title's own SEH, for example) can still handle the fault, and the log can report faults that did no harm. The two lazy.rs warnings are also a second change beyond the crash line in the title. CI fails only on the PR description check, and the branch conflicts with main.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301358713 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1186#issuecomment-7301358713). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:02:20Z. --- **Triage (#1607)** – head 681c0c8 No open or merged PR makes the same change (#3027 dumps memory around the pointers, #488 is about failed lazy commits). `eh::describe_fault` and `Uma::describe` (with `try_lock`) look correct. In `kernelx/lazy.rs::handler` the new warning fires for the first 8 access violations the lazy handler does not claim and says such a fault ends the process. This is a vectored handler that returns CONTINUE_SEARCH, so later handlers (the title's own SEH, for example) can still handle the fault, and the log can report faults that did no harm. The two lazy.rs warnings are also a second change beyond the crash line in the title. CI fails only on the PR description check, and the branch conflicts with main. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1186:upstream-pr/1186'
git switch 'upstream-pr/1186'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1186'
git switch 'upstream-pr/1186'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1186'
git switch 'upstream-pr/1186'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1186'
git switch 'main'
git merge --squash 'upstream-pr/1186'
git switch 'main'
git merge --ff-only 'upstream-pr/1186'
git switch 'main'
git merge 'upstream-pr/1186'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1177
No description provided.