kernelx: physical page homes in window 0 first, from the top, keeping 64 MB free (#2867) #2905

Open
grahamster2 wants to merge 4 commits from upstream-pr/2905 into main
grahamster2 commented 2026-11-26 22:21:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grahamster2 on 2026-11-26T22:21:16Z.


Fixes #2867.

On the Series S profile with GPU heaps in the sparse windows, Build 16 crashes about 45 s into the world. Build 15 does not. The cause is 3292b096, which moved physical page homes out of window 0 and into windows 1+ (first fit). The retail title then reserves a pool of 63632 pages of 64 KiB (3977 MB). That pool needs nearly all of windows 1 and 2, and it no longer fits:

  • At the pool's reservation: 4367 MB free, 3911 MB at most in one run (window 0: 357 MB, window 1: 99 MB, window 2: 3911 MB). That was with homes already placed top-down in windows 1+, which is the first commit here.
  • Build 15 put the pool at 0x11f9d00000, in the sparse windows. Build 16 put it in plain write-watched memory (0xa4a690000, 0x94b290000, 0x98cd70000 in three runs).
  • The title faulted about 45 s after world load in 4 of 4 Build 16 runs.

New placement of physical page homes (Uma::sparse_alloc_home, kernelx::alloc_physical_home)

  1. Window 0 first, from the top down, as long as at least 64 MB of window 0 stays free in one run after the home.
  2. If that fails, windows 1+, from the top of the last window down. The title's own reservations (sparse_reserve, first fit from window 1 up) keep one free run between them and the homes.
  3. As a last resort, window 0 past the margin, also from its top. Its low addresses stay free for the title's 32-bit memory.

3292b096 was protecting a 38 MB view heap that had to fit in window 0 after the homes. The 64 MB margin covers that case, and the tests check that a 38 MB view heap still fits in window 0 after the homes. The figure is empirical: 256 MB left this title's pool 66 MB short, and 64 MB fits it. It was fitted to one title, so XCL_HOME_W0_KEEP_MB overrides it. A value that does not parse logs a warning and uses the default.

What is in it

  • kernelx: physical page homes come from the top of windows 1+ down (gpu/uma.rs, hle/kernelx.rs): take_sparse_top_in (top-down, never straddles a 4 GiB boundary) and a WARN when a GPU-visible reservation of 256 MB or more, small enough to fit the sparse windows, goes to plain memory. The WARN gives the free bytes and the largest run of each window, so this failure shows in a log.
  • kernelx: physical page homes go to the top of window 0 while it keeps 256 MB (gpu/uma.rs, hle/kernelx.rs): Uma::sparse_alloc_home, window 0 first, with a margin.
  • kernelx: physical page homes keep 64 MB of window 0 free, not 256 (hle/kernelx.rs): sets the default margin and adds XCL_HOME_W0_KEEP_MB. Its test rebuilds the failing layout: 256 MB gives the 99 / 3911 MB split above and no room for the pool, and 64 MB puts the pool at window 1 + 20 MB.
  • Review fixes (gpu/uma.rs, hle/kernelx.rs): the last-resort fallback takes window 0 from its top, not first fit from the bottom. The WARN fires for the first 4 distinct sizes instead of once per process, so an earlier fallback that is by design no longer hides a later one. On the 64 KiB-page fallback path it fires only for reservations that tried the sparse windows, not for committed GPU heaps that never did. The tests use the default margin whatever XCL_HOME_W0_KEEP_MB the shell has. There is a new test for a free range that crosses lo_bound in the top-down search. Code comments and commit messages name no title.

Tested

  • RTX 3080 10 GB, 31 GB RAM, Windows 11 Pro 26200, release build.
  • cargo build --release -p xcl: OK.
  • cargo test -p xcl --lib hle::kernelx: 67 passed, 0 failed, 1 ignored (also all passing together with gpu::uma with XCL_HOME_W0_KEEP_MB=300 set in the shell)
  • cargo test -p xcl --lib gpu::uma: 20 passed, 0 failed, 0 ignored
  • Retail title, Series S profile, XCL_UMA_WINDOWS=16, XCL_HEAP_WINDOWS=1, XCL_COHERENT_MB=1024, on the first three commits: the pool is at 0x1101400000 (window 1 + 20 MB, in the sparse windows). A 15-minute world run had no fault (2.1M draws, 0 skipped).

Regression run
Not run yet. There are no xcl-smoke blocks for this head, and I will add them.

main:

PR:

Not tested

  • The review-fix commit (window-0 fallback from the top, the WARN for the first 4 sizes and only after a sparse attempt) was not run in-game. It is only unit-tested. The in-game run above was on the first three commits.
  • The full cargo test --workspace suite. Only the hle::kernelx and gpu::uma unit tests ran.
  • The Series X profile, other titles, and AMD / Intel GPUs.

Interaction with #2886
The two are complementary: #2886 keeps single-window sparse_reserve reservations inside one window. #2886 alone does not fit this case, though. Window 2 had 3911 MB free and the pool needs 3977 MB, so the pool has to cross windows 1 and 2, and that only works if the homes leave that run free. Both PRs change the same tests in gpu/uma.rs, so they will conflict. I'll rebase onto whichever lands first.

AI use

  • Claude Code (Claude Opus 5.5): wrote the code, the tests and this description, and ran the unit tests. The in-game runs were done on the hardware above.
<!-- greyfinch-sync:ivall/xcl:issue:5517938608 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905). Originally posted by [grahamster2](https://github.com/grahamster2) on 2026-11-26T22:21:16Z. --- Fixes #2867. On the Series S profile with GPU heaps in the sparse windows, Build 16 crashes about 45 s into the world. Build 15 does not. The cause is 3292b096, which moved physical page homes out of window 0 and into windows 1+ (first fit). The retail title then reserves a pool of 63632 pages of 64 KiB (3977 MB). That pool needs nearly all of windows 1 and 2, and it no longer fits: - At the pool's reservation: 4367 MB free, 3911 MB at most in one run (window 0: 357 MB, window 1: 99 MB, window 2: 3911 MB). That was with homes already placed top-down in windows 1+, which is the first commit here. - Build 15 put the pool at `0x11f9d00000`, in the sparse windows. Build 16 put it in plain write-watched memory (`0xa4a690000`, `0x94b290000`, `0x98cd70000` in three runs). - The title faulted about 45 s after world load in 4 of 4 Build 16 runs. **New placement of physical page homes** (`Uma::sparse_alloc_home`, `kernelx::alloc_physical_home`) 1. Window 0 first, from the top down, as long as at least 64 MB of window 0 stays free in one run after the home. 2. If that fails, windows 1+, from the top of the last window down. The title's own reservations (`sparse_reserve`, first fit from window 1 up) keep one free run between them and the homes. 3. As a last resort, window 0 past the margin, also from its top. Its low addresses stay free for the title's 32-bit memory. 3292b096 was protecting a 38 MB view heap that had to fit in window 0 after the homes. The 64 MB margin covers that case, and the tests check that a 38 MB view heap still fits in window 0 after the homes. The figure is empirical: 256 MB left this title's pool 66 MB short, and 64 MB fits it. It was fitted to one title, so `XCL_HOME_W0_KEEP_MB` overrides it. A value that does not parse logs a warning and uses the default. **What is in it** - `kernelx: physical page homes come from the top of windows 1+ down` (`gpu/uma.rs`, `hle/kernelx.rs`): `take_sparse_top_in` (top-down, never straddles a 4 GiB boundary) and a WARN when a GPU-visible reservation of 256 MB or more, small enough to fit the sparse windows, goes to plain memory. The WARN gives the free bytes and the largest run of each window, so this failure shows in a log. - `kernelx: physical page homes go to the top of window 0 while it keeps 256 MB` (`gpu/uma.rs`, `hle/kernelx.rs`): `Uma::sparse_alloc_home`, window 0 first, with a margin. - `kernelx: physical page homes keep 64 MB of window 0 free, not 256` (`hle/kernelx.rs`): sets the default margin and adds `XCL_HOME_W0_KEEP_MB`. Its test rebuilds the failing layout: 256 MB gives the 99 / 3911 MB split above and no room for the pool, and 64 MB puts the pool at window 1 + 20 MB. - Review fixes (`gpu/uma.rs`, `hle/kernelx.rs`): the last-resort fallback takes window 0 from its top, not first fit from the bottom. The WARN fires for the first 4 distinct sizes instead of once per process, so an earlier fallback that is by design no longer hides a later one. On the 64 KiB-page fallback path it fires only for reservations that tried the sparse windows, not for committed GPU heaps that never did. The tests use the default margin whatever `XCL_HOME_W0_KEEP_MB` the shell has. There is a new test for a free range that crosses `lo_bound` in the top-down search. Code comments and commit messages name no title. **Tested** - RTX 3080 10 GB, 31 GB RAM, Windows 11 Pro 26200, release build. - `cargo build --release -p xcl`: OK. - `cargo test -p xcl --lib hle::kernelx`: 67 passed, 0 failed, 1 ignored (also all passing together with `gpu::uma` with `XCL_HOME_W0_KEEP_MB=300` set in the shell) - `cargo test -p xcl --lib gpu::uma`: 20 passed, 0 failed, 0 ignored - Retail title, Series S profile, `XCL_UMA_WINDOWS=16`, `XCL_HEAP_WINDOWS=1`, `XCL_COHERENT_MB=1024`, on the first three commits: the pool is at `0x1101400000` (window 1 + 20 MB, in the sparse windows). A 15-minute world run had no fault (2.1M draws, 0 skipped). **Regression run** Not run yet. There are no `xcl-smoke` blocks for this head, and I will add them. main: PR: **Not tested** - The review-fix commit (window-0 fallback from the top, the WARN for the first 4 sizes and only after a sparse attempt) was not run in-game. It is only unit-tested. The in-game run above was on the first three commits. - The full `cargo test --workspace` suite. Only the `hle::kernelx` and `gpu::uma` unit tests ran. - The Series X profile, other titles, and AMD / Intel GPUs. **Interaction with #2886** The two are complementary: #2886 keeps single-window `sparse_reserve` reservations inside one window. #2886 alone does not fit this case, though. Window 2 had 3911 MB free and the pool needs 3977 MB, so the pool has to cross windows 1 and 2, and that only works if the homes leave that run free. Both PRs change the same tests in `gpu/uma.rs`, so they will conflict. I'll rebase onto whichever lands first. **AI use** - Claude Code (Claude Opus 5.5): wrote the code, the tests and this description, and ran the unit tests. The in-game runs were done on the hardware above.
tiagonleal commented 2026-11-26 22:56:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-26T22:56:00Z.


Tested d900644d on a 16 GB card with the default window layout (3 sparse windows, no view windows). Here the pool lands inside the sparse windows again and the new warning never fires, but the title still crashed in 4 of 4 runs. With 3292b096 reverted instead, 3 of 4 runs reached the 300 s limit.

Setup: retail title of #505, Series S profile, RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, release, shaders precompiled, 300 s limit per run. Tree: nvidia-dev ea0698d4 (one commit behind this PR's base; the PR's diff applies cleanly) + #2590 + #684 + #2551, plus a local 12-line working-set cap (XCL_WS_MAX_MB=13000, taken from MacieGx's lab branch) without which my 1 GB free-RAM guard ends every run at about 90 s. Env: XCL_DEVICE_TYPE=lockhart XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=1 XCL_GFX_PSO_WAIT_MS=200 XCL_PREPARE=0 XCL_PSO_PRELOAD=0 XCL_NETWORK=0, no XCL_UMA_WINDOWS, no XCL_COHERENT_HEAPS. UMA line in every run below except the first: 3 sparse VRAM window(s) (12 GiB VA) + 1 coherent window(s) (3407 MB) + 0 view window(s) for GPU views at 0x400000000.

tree pool (63632 pages) at runs of 300 s ends
as above, with 3292b096 0xfd4fe0000 (outside the windows) 3 0xc0000005 in the title at 175 s (+0x5182154, read at 0x3c54a9da013b), 104 s (+0x4e9a62e, read at 0xffffffffffffffff), 93 s (+0x4e735ed, read at 0xc8)
same, first run of the day (coherent window still 512 MB) 0x2cfd90000 1 0xc0000005 at 83 s in nvwgf2umx.dll+0x3b1722 (read at 0xe6d8)
3292b096 reverted 0x5f9d00000 (windows 1 and 2) 4 three reach 300 s, presenting until 266, 299 and 288 s; one 0xc0000005 at 83 s (+0x511e7d9, read at 0xffffffffffffffff)
with 3292b096 + this PR (d900644d) 0x501400000 (window 1) 4 0xc0000005 in the title at 186 s (+0x2215c35, write at 0x0), 97 s (+0x136ab, read at 0x648), 167 s (+0x4e735ed, read at 0xc8), 85 s (+0x7b619c, read at 0x0)
  • The PR does what it says for the pool on this layout: it is back in the sparse windows, and found no room in the sparse windows is not logged in any of the four runs.
  • The pool is not where the reverted tree puts it, though. Reverted, it starts at 0x5f9d00000 and runs into window 2. With the PR it starts at 0x501400000, 20 MB into window 1, and ends where the reverted one starts. I have not looked at what takes the first 3,977 MB of window 1 in the reverted tree, or where that goes with the PR. That may be the difference on this layout, or the crash here may have a second cause that the revert also removes.
  • +0x4e735ed (read at 0xc8) appears both with 3292b096 alone and with the PR.
  • No device removal in any run. The three reverted runs that finished were over the video memory budget from about 70 s (16.2 to 16.9 GB local against 15.06 GB).

So on a 3-window layout without XCL_UMA_WINDOWS=16 this PR alone did not stop the crash for me, while the revert mostly did. I can run a variant if you want one tested (for example another XCL_HOME_W0_KEEP_MB, or with XCL_UMA_WINDOWS=16).

Not tested: the PR on its exact base eae01502; the tree without the working-set cap (the runs do not live long enough here); XCL_UMA_WINDOWS=16; the Series X profile; more than four runs per row; AMD.

AI use: Claude Code with Claude Fable 5.2 ran the builds and runs, read the logs and wrote this; I checked it.

<!-- greyfinch-sync:ivall/xcl:comment:7205109945 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7205109945). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-26T22:56:00Z. --- Tested `d900644d` on a 16 GB card with the default window layout (3 sparse windows, no view windows). **Here the pool lands inside the sparse windows again and the new warning never fires, but the title still crashed in 4 of 4 runs. With `3292b096` reverted instead, 3 of 4 runs reached the 300 s limit.** **Setup:** retail title of #505, Series S profile, RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, release, shaders precompiled, 300 s limit per run. Tree: `nvidia-dev` `ea0698d4` (one commit behind this PR's base; the PR's diff applies cleanly) + #2590 + #684 + #2551, plus a local 12-line working-set cap (`XCL_WS_MAX_MB=13000`, taken from MacieGx's lab branch) without which my 1 GB free-RAM guard ends every run at about 90 s. Env: `XCL_DEVICE_TYPE=lockhart XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=1 XCL_GFX_PSO_WAIT_MS=200 XCL_PREPARE=0 XCL_PSO_PRELOAD=0 XCL_NETWORK=0`, no `XCL_UMA_WINDOWS`, no `XCL_COHERENT_HEAPS`. UMA line in every run below except the first: `3 sparse VRAM window(s) (12 GiB VA) + 1 coherent window(s) (3407 MB) + 0 view window(s) for GPU views at 0x400000000`. | tree | pool (63632 pages) at | runs of 300 s | ends | |---|---|---|---| | as above, with `3292b096` | `0xfd4fe0000` (outside the windows) | 3 | `0xc0000005` in the title at 175 s (`+0x5182154`, read at `0x3c54a9da013b`), 104 s (`+0x4e9a62e`, read at `0xffffffffffffffff`), 93 s (`+0x4e735ed`, read at `0xc8`) | | same, first run of the day (coherent window still 512 MB) | `0x2cfd90000` | 1 | `0xc0000005` at 83 s in `nvwgf2umx.dll+0x3b1722` (read at `0xe6d8`) | | `3292b096` reverted | `0x5f9d00000` (windows 1 and 2) | 4 | three reach 300 s, presenting until 266, 299 and 288 s; one `0xc0000005` at 83 s (`+0x511e7d9`, read at `0xffffffffffffffff`) | | with `3292b096` + this PR (`d900644d`) | `0x501400000` (window 1) | 4 | `0xc0000005` in the title at 186 s (`+0x2215c35`, write at `0x0`), 97 s (`+0x136ab`, read at `0x648`), 167 s (`+0x4e735ed`, read at `0xc8`), 85 s (`+0x7b619c`, read at `0x0`) | - The PR does what it says for the pool on this layout: it is back in the sparse windows, and `found no room in the sparse windows` is not logged in any of the four runs. - The pool is not where the reverted tree puts it, though. Reverted, it starts at `0x5f9d00000` and runs into window 2. With the PR it starts at `0x501400000`, 20 MB into window 1, and ends where the reverted one starts. I have not looked at what takes the first 3,977 MB of window 1 in the reverted tree, or where that goes with the PR. That may be the difference on this layout, or the crash here may have a second cause that the revert also removes. - `+0x4e735ed` (read at `0xc8`) appears both with `3292b096` alone and with the PR. - No device removal in any run. The three reverted runs that finished were over the video memory budget from about 70 s (16.2 to 16.9 GB local against 15.06 GB). So on a 3-window layout without `XCL_UMA_WINDOWS=16` this PR alone did not stop the crash for me, while the revert mostly did. I can run a variant if you want one tested (for example another `XCL_HOME_W0_KEEP_MB`, or with `XCL_UMA_WINDOWS=16`). **Not tested:** the PR on its exact base `eae01502`; the tree without the working-set cap (the runs do not live long enough here); `XCL_UMA_WINDOWS=16`; the Series X profile; more than four runs per row; AMD. AI use: Claude Code with Claude Fable 5.2 ran the builds and runs, read the logs and wrote this; I checked it.
thehollowedone commented 2026-11-26 22:57:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T22:57:11Z.


Found a fragmented-window case on head d900644d. sparse_alloc_home tries only the highest fitting hole in window 0 before applying the 64 MB largest-free-run check. If that hole fails the check, a lower hole may still preserve the margin; the current code spills the home into windows 1–2 instead.

I reproduced this with only XCL's synthetic UMA reservations: window 0 has a lower 32 MB hole and an upper 80 MB hole; window 1 is occupied, and window 2 has 4000 MB free. A 32 MB home placed in the lower hole leaves the upper 80 MB intact, so a subsequent 3977 MB pool fits in window 2. On the unmodified PR head, the home instead goes into window 2 and the pool has only 3968 MB there. The new regression fails on that head (0 passed, 1 failed, 0 ignored, 0 skipped). A local change that retries lower free runs after a margin rejection makes it pass. The relevant physical-home tests then pass 8/8, and gpu::uma::tests:: passes 21/21 (0 failed, 0 ignored, 0 skipped for both).

Commands: cargo test --offline --locked -p xcl --lib physical_home -- --test-threads=1 and cargo test --offline --locked -p xcl --lib gpu::uma::tests:: -- --test-threads=1. Windows 11 build 26300, Ryzen 7 9800X3D; this test uses synthetic address-space reservations and does not call the GPU. I did not run the full workspace suite or a retail title. The existing retail crash report above is a separate observation; this case does not establish its cause.

Candidate fix and regression test
diff --git a/crates/xcl/src/gpu/uma.rs b/crates/xcl/src/gpu/uma.rs
--- a/crates/xcl/src/gpu/uma.rs
+++ b/crates/xcl/src/gpu/uma.rs
@@
-            if let Some(at) = take_sparse_top_in(&mut g, lo, hi, size, align) {
+            let mut search_hi = hi;
+            while let Some(at) = take_sparse_top_in(&mut g, lo, search_hi, size, align) {
                 if free_runs_in(&g, lo, hi).1 >= w0_keep {
                     return Some((at, size));
                 }
                 give_back(&mut g, at);
+                // Moving within this free run cannot leave a larger remainder; try the
+                // next lower run before giving up on window 0.
+                search_hi = *g.0.range(..=at).next_back().unwrap().0;
             }
@@
     fn take_sparse_top_in_a_free_range_across_lo_bound() {
@@
     }

+    #[test]
+    fn physical_home_uses_lower_hole_when_it_preserves_window_0_margin() {
+        let u = Uma::for_runtime(16 << 20).unwrap();
+        let (free0, _) = u.sparse_free_in(0);
+        let low = u.sparse_alloc(32 << 20, GRAIN).unwrap().0;
+        let middle = u.sparse_alloc(free0 - (112 << 20), GRAIN).unwrap().0;
+        assert_eq!(u.sparse_release(low), Some(32 << 20));
+        assert_eq!(u.sparse_free_in(0), (112 << 20, 80 << 20));
+
+        let w1 = u.sparse_reserve(WINDOW).unwrap();
+        let w2_start = u.sparse_reserve(WINDOW - (4000 << 20)).unwrap();
+        assert_eq!(u.window_of(w2_start), Some(2));
+
+        let home = u.sparse_alloc_home(32 << 20, GRAIN, 64 << 20).unwrap().0;
+        assert_eq!(home, low, "lower hole leaves the 80 MB run intact");
+        assert_eq!(u.sparse_free_in(0).1, 80 << 20);
+        let pool = u.sparse_reserve(3977 << 20).expect("page pool still fits window 2");
+        assert_eq!(u.window_of(pool), Some(2));
+
+        for p in [home, middle, w1, w2_start, pool] {
+            assert!(u.sparse_release(p).is_some());
+        }
+        assert_eq!(u.sparse_used(), 0);
+    }

AI use: Codex (GPT-6.2 Sol) investigated, wrote and ran the regression, tested the candidate change, and drafted this report; Codex (GPT-6.2 Astra) assisted with the initial static review.

<!-- greyfinch-sync:ivall/xcl:comment:7205126878 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7205126878). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-26T22:57:11Z. --- Found a fragmented-window case on [head `d900644d`](https://github.com/xcl-dev/xcl/commit/d900644d90006e08a3fcde630515e339a550f4d5). `sparse_alloc_home` tries only the highest fitting hole in window 0 before applying the 64 MB largest-free-run check. If that hole fails the check, a lower hole may still preserve the margin; the current code spills the home into windows 1–2 instead. I reproduced this with only XCL's synthetic UMA reservations: window 0 has a lower 32 MB hole and an upper 80 MB hole; window 1 is occupied, and window 2 has 4000 MB free. A 32 MB home placed in the lower hole leaves the upper 80 MB intact, so a subsequent 3977 MB pool fits in window 2. On the unmodified PR head, the home instead goes into window 2 and the pool has only 3968 MB there. The new regression fails on that head (0 passed, 1 failed, 0 ignored, 0 skipped). A local change that retries lower free runs after a margin rejection makes it pass. The relevant physical-home tests then pass 8/8, and `gpu::uma::tests::` passes 21/21 (0 failed, 0 ignored, 0 skipped for both). Commands: `cargo test --offline --locked -p xcl --lib physical_home -- --test-threads=1` and `cargo test --offline --locked -p xcl --lib gpu::uma::tests:: -- --test-threads=1`. Windows 11 build 26300, Ryzen 7 9800X3D; this test uses synthetic address-space reservations and does not call the GPU. I did not run the full workspace suite or a retail title. The existing retail crash report above is a separate observation; this case does not establish its cause. <details><summary>Candidate fix and regression test</summary> ```diff diff --git a/crates/xcl/src/gpu/uma.rs b/crates/xcl/src/gpu/uma.rs --- a/crates/xcl/src/gpu/uma.rs +++ b/crates/xcl/src/gpu/uma.rs @@ - if let Some(at) = take_sparse_top_in(&mut g, lo, hi, size, align) { + let mut search_hi = hi; + while let Some(at) = take_sparse_top_in(&mut g, lo, search_hi, size, align) { if free_runs_in(&g, lo, hi).1 >= w0_keep { return Some((at, size)); } give_back(&mut g, at); + // Moving within this free run cannot leave a larger remainder; try the + // next lower run before giving up on window 0. + search_hi = *g.0.range(..=at).next_back().unwrap().0; } @@ fn take_sparse_top_in_a_free_range_across_lo_bound() { @@ } + #[test] + fn physical_home_uses_lower_hole_when_it_preserves_window_0_margin() { + let u = Uma::for_runtime(16 << 20).unwrap(); + let (free0, _) = u.sparse_free_in(0); + let low = u.sparse_alloc(32 << 20, GRAIN).unwrap().0; + let middle = u.sparse_alloc(free0 - (112 << 20), GRAIN).unwrap().0; + assert_eq!(u.sparse_release(low), Some(32 << 20)); + assert_eq!(u.sparse_free_in(0), (112 << 20, 80 << 20)); + + let w1 = u.sparse_reserve(WINDOW).unwrap(); + let w2_start = u.sparse_reserve(WINDOW - (4000 << 20)).unwrap(); + assert_eq!(u.window_of(w2_start), Some(2)); + + let home = u.sparse_alloc_home(32 << 20, GRAIN, 64 << 20).unwrap().0; + assert_eq!(home, low, "lower hole leaves the 80 MB run intact"); + assert_eq!(u.sparse_free_in(0).1, 80 << 20); + let pool = u.sparse_reserve(3977 << 20).expect("page pool still fits window 2"); + assert_eq!(u.window_of(pool), Some(2)); + + for p in [home, middle, w1, w2_start, pool] { + assert!(u.sparse_release(p).is_some()); + } + assert_eq!(u.sparse_used(), 0); + } ``` </details> AI use: Codex (GPT-6.2 Sol) investigated, wrote and ran the regression, tested the candidate change, and drafted this report; Codex (GPT-6.2 Astra) assisted with the initial static review.
tiagonleal commented 2026-11-27 00:07:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-27T00:07:29Z.


Correction to my comment above: the "3 of 4 runs reached 300 s with 3292b096 reverted" row does not support what I concluded from it, and I withdraw the comparison.

I went back through the logs of those runs. The three reverted runs that reached 300 s were the ones where the driver's shader cache was cold for that build:

run driver blob absent compiles 2 s activity windows with 0 presents and 0 submits end
reverted s1 11 94 reached 300 s
reverted s2 1 5 0xc0000005 at 83 s
reverted s3 18 65 reached 300 s
reverted s4 14 79 reached 300 s
PR d900644d s1 to s4 1 each 20, 5, 6, 6 0xc0000005 in all four

So the survivors spent 130 to 190 of their 300 s blocked on compute PSO compiles, with no submits and no streaming, and did far less work than the runs that crashed. The one reverted run without that blocking crashed like the others. The PR runs came later, when the cache was warm.

Since then I ran 13 more reverted runs with a warm cache (same profile, same cap, four base commits from eae01502 to eff3bcab): 12 ended in an access violation in the title between 106 and 221 s, and one stopped on a breakpoint in the title at 195 s. So on this machine the revert does not stop the crash either, and my runs say nothing about this PR against the revert. The crash I see with the default 3-window layout looks independent of where the pool lands.

The part about the PR itself stands: the pool goes back into the sparse windows and the warning is not logged.

AI use: Claude Code with Claude Fable 5.2 read the logs and wrote this; I checked it.

<!-- greyfinch-sync:ivall/xcl:comment:7206190996 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7206190996). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-27T00:07:29Z. --- Correction to my comment above: the "3 of 4 runs reached 300 s with `3292b096` reverted" row does not support what I concluded from it, and I withdraw the comparison. I went back through the logs of those runs. The three reverted runs that reached 300 s were the ones where the driver's shader cache was cold for that build: | run | `driver blob absent` compiles | 2 s activity windows with 0 presents and 0 submits | end | |---|---|---|---| | reverted s1 | 11 | 94 | reached 300 s | | reverted s2 | 1 | 5 | `0xc0000005` at 83 s | | reverted s3 | 18 | 65 | reached 300 s | | reverted s4 | 14 | 79 | reached 300 s | | PR `d900644d` s1 to s4 | 1 each | 20, 5, 6, 6 | `0xc0000005` in all four | So the survivors spent 130 to 190 of their 300 s blocked on compute PSO compiles, with no submits and no streaming, and did far less work than the runs that crashed. The one reverted run without that blocking crashed like the others. The PR runs came later, when the cache was warm. Since then I ran 13 more reverted runs with a warm cache (same profile, same cap, four base commits from `eae01502` to `eff3bcab`): 12 ended in an access violation in the title between 106 and 221 s, and one stopped on a breakpoint in the title at 195 s. So on this machine the revert does not stop the crash either, and my runs say nothing about this PR against the revert. The crash I see with the default 3-window layout looks independent of where the pool lands. The part about the PR itself stands: the pool goes back into the sparse windows and the warning is not logged. AI use: Claude Code with Claude Fable 5.2 read the logs and wrote this; I checked it.
LocranKing commented 2026-11-27 03:56:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by LocranKing on 2026-11-27T03:56:44Z.


Independent paired verification on an 8 GB RTX 3060 Ti (Series S / lockhart profile): reproduces #2867 on nvidia-dev (ecc0bb57) and confirms #2905 fixes it.

Setup

  • Machine: Windows 11 Home build 26300, AMD Ryzen 5 5500 (6C/12T), 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8 GB, driver 621.40, nvprofile shader heap 2048 MB), DXC 1.9.2602.17.
  • Title & cache: Retail title 9cc6a39e, release builds, both runs starting from identical copies of a warm lockhart cache snapshot (1,296 used pipelines, 3,206 driver blobs), 250 s each.
  • Env: XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_PSO_WAIT_MS=50 XCL_GFX_PSO_WAIT_MS=200 XCL_CS_PSO_WAIT_MS=50 XCL_PREPARE_GRAPHICS=0 XCL_DRED=1 + XCL_PRESS_AT sequence (18:A..74:A).
  • PR build note: pr-2905-head (d900644d) merged cleanly with origin/nvidia-dev (ecc0bb57; only a test change over eae01502).

Results (250 s paired runs)

tree result frames shown peak commit local / non-local VRAM peak
nvidia-dev (ecc0bb57) crash at 181.5 s (0xc0000005 read at 0xffffffffffffffff in game_scarlett_master.exe+0x51822b3; ended 186.1 s) none logged (1,732 presents in report.json before crash) 25,994 MB 9,022 / 4,708 MB
PR #2905 (d900644d + ecc0bb57) exit 0x0 (no crash, no device removal) 1,977 (presents per 2 s: 1 0 1) 29,327 MB 12,333 / 5,055 MB
xcl-smoke v1
commit: ecc0bb57976b1bc94854199ddf4f915fd00e0a59
gpu: NVIDIA GeForce RTX 3060 Ti
title: 9cc6a39e
seconds: 250
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 2
peak commit: 25994 MB
xcl-smoke v1
commit: d900644d90006e08a3fcde630515e339a550f4d5
gpu: NVIDIA GeForce RTX 3060 Ti
title: 9cc6a39e
seconds: 250
exit: 0x0
frames shown: 1977 (PresentX 1977)
presents per 2 s (last 3): 1 0 1
device removals: 0
crashes: 0
peak commit: 29327 MB

Not tested: XCL_COHERENT_HEAPS=sparse:1024, Series X (anaconda) profile, multiple runs per arm.

<!-- greyfinch-sync:ivall/xcl:comment:7209395048 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7209395048). Originally posted by [LocranKing](https://github.com/LocranKing) on 2026-11-27T03:56:44Z. --- Independent paired verification on an **8 GB RTX 3060 Ti** (`Series S` / `lockhart` profile): reproduces **#2867** on `nvidia-dev` (`ecc0bb57`) and confirms **#2905** fixes it. **Setup** - **Machine:** Windows 11 Home build 26300, AMD Ryzen 5 5500 (6C/12T), 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8 GB, driver `621.40`, `nvprofile` shader heap 2048 MB), DXC `1.9.2602.17`. - **Title & cache:** Retail title `9cc6a39e`, release builds, both runs starting from identical copies of a warm `lockhart` cache snapshot (`1,296` used pipelines, `3,206` driver blobs), `250 s` each. - **Env:** `XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_PSO_WAIT_MS=50 XCL_GFX_PSO_WAIT_MS=200 XCL_CS_PSO_WAIT_MS=50 XCL_PREPARE_GRAPHICS=0 XCL_DRED=1` + `XCL_PRESS_AT` sequence (`18:A..74:A`). - **PR build note:** `pr-2905-head` (`d900644d`) merged cleanly with `origin/nvidia-dev` (`ecc0bb57`; only a test change over `eae01502`). **Results (250 s paired runs)** | tree | result | frames shown | peak commit | local / non-local VRAM peak | |---|---|---:|---:|---:| | `nvidia-dev` (`ecc0bb57`) | **crash** at `181.5 s` (`0xc0000005` read at `0xffffffffffffffff` in `game_scarlett_master.exe+0x51822b3`; ended `186.1 s`) | none logged (`1,732` presents in `report.json` before crash) | 25,994 MB | 9,022 / 4,708 MB | | **PR `#2905`** (`d900644d` + `ecc0bb57`) | **exit `0x0` (no crash, no device removal)** | **1,977** (`presents per 2 s: 1 0 1`) | 29,327 MB | 12,333 / 5,055 MB | ```text xcl-smoke v1 commit: ecc0bb57976b1bc94854199ddf4f915fd00e0a59 gpu: NVIDIA GeForce RTX 3060 Ti title: 9cc6a39e seconds: 250 exit: 0xc0000005 frames shown: none logged (the run did not reach its end) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 2 peak commit: 25994 MB ``` ```text xcl-smoke v1 commit: d900644d90006e08a3fcde630515e339a550f4d5 gpu: NVIDIA GeForce RTX 3060 Ti title: 9cc6a39e seconds: 250 exit: 0x0 frames shown: 1977 (PresentX 1977) presents per 2 s (last 3): 1 0 1 device removals: 0 crashes: 0 peak commit: 29327 MB ``` **Not tested:** `XCL_COHERENT_HEAPS=sparse:1024`, Series X (`anaconda`) profile, multiple runs per arm.
pr1sm-dev commented 2026-11-27 08:19:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pr1sm-dev on 2026-11-27T08:19:21Z.


Test of d900644d on an 8 GB card (RTX 3070): the pool is back in the sparse windows, but both runs lost the device on the loading screen, and with the GPU heaps in the sparse windows another reservation no longer fits. One run per row, so these are data points.

Setup: RTX 3070 8 GB, driver 621.40, 64 GB RAM, Windows 11 26300, release build. Tree: nvidia-dev eae01502 + this PR's four commits (d900644d), nothing else. Series S profile, XCL_UMA_WINDOWS=16 XCL_HEAP_WINDOWS=1 XCL_TWO_PASS_MB=3072 XCL_GFX_PSO_WAIT_MS=100 XCL_PREPARE_GRAPHICS=0 XCL_NETWORK=0, NVIDIA shader heap 2048 MB (#2590), warm caches (every compute pipeline of the pack built ahead), A pressed every 10 s. UMA line in both runs: 3 sparse windows, 1 coherent window, 6 view windows.

run XCL_COHERENT_HEAPS pool (63632 pages) the new WARN end
1 sparse:1024 in the sparse windows, window 1 + 20 MB as in the PR fired 16 s after the title started 0x887a0006 43 s after the title started, on the loading screen (1,018 presents)
2 not set (coherent window 3407 MB, 3008 MB used) same place did not fire 0x887a0006 28 s after the title started, on the loading screen (607 presents)
  • The WARN in run 1: a GPU-visible reservation of 1811 MB (0x71380000 bytes) found no room in the sparse windows (41 MB free, 41 MB at most in one run; window 0: 41 MB, 41 MB in one run, window 1: 0 MB, 0 MB in one run, window 2: 0 MB, 0 MB in one run). The sparse windows held 11,734 MB right after it. Without the PR, same settings, the windows grew by 1,880 MB at the same stage (7,689 to 9,569 MB), which I read as that reservation fitting while the pool was outside. With the two GPU heaps (1162 + 1277 MB) in the windows as well, the pool, the heaps and this reservation together need about 1.8 GB more than the 12 GiB of sparse windows. Run 2 takes the heaps out of the windows and the WARN is gone (sparse windows 11,106 MB).
  • Both removals: XCL logs DRED device state 7 and no breadcrumbs (0x887a0004: DRED is not on with the launch preparation, #2920). Local video memory was 10.2 GB (run 1) and 8.4 GB (run 2) on a 7.1 GB budget. The last draws recorded are the loading screen's (10 and 8 pipelines).
  • For comparison on this card: on eae01502 without the PR, 1 of 7 runs ended with 0x887a0006 and state 7 on the loading screen (69 s after the title started; the one run that had XCL_DRED=1 and the graphics prebuild on). Two more ended there with 0x887a0005 at 97 to 98 s, before the shader-heap profile was installed; the other four got to the world load. With 3292b096 reverted instead, on e0821b12, none of 3 runs did, and with sparse:1024 the title then stayed in the world for 523 s and 801 s (I will put those on #2867). The revert runs are on a newer base, so this is not a clean pair.

Not tested: more than one run per row; this PR on e0821b12; XCL_HOME_W0_KEEP_MB other than the default; the Series X profile; a run with DRED really on (XCL_PREPARE=0).

AI use: Claude Code (Claude Fable 5.2) ran the runs, read the logs and wrote this under my direction; I reviewed it.

<!-- greyfinch-sync:ivall/xcl:comment:7213406415 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7213406415). Originally posted by [pr1sm-dev](https://github.com/pr1sm-dev) on 2026-11-27T08:19:21Z. --- **Test of `d900644d` on an 8 GB card (RTX 3070): the pool is back in the sparse windows, but both runs lost the device on the loading screen, and with the GPU heaps in the sparse windows another reservation no longer fits.** One run per row, so these are data points. **Setup:** RTX 3070 8 GB, driver 621.40, 64 GB RAM, Windows 11 26300, release build. Tree: `nvidia-dev` `eae01502` + this PR's four commits (`d900644d`), nothing else. Series S profile, `XCL_UMA_WINDOWS=16 XCL_HEAP_WINDOWS=1 XCL_TWO_PASS_MB=3072 XCL_GFX_PSO_WAIT_MS=100 XCL_PREPARE_GRAPHICS=0 XCL_NETWORK=0`, NVIDIA shader heap 2048 MB (#2590), warm caches (every compute pipeline of the pack built ahead), A pressed every 10 s. UMA line in both runs: 3 sparse windows, 1 coherent window, 6 view windows. | run | `XCL_COHERENT_HEAPS` | pool (63632 pages) | the new WARN | end | |---|---|---|---|---| | 1 | `sparse:1024` | in the sparse windows, window 1 + 20 MB as in the PR | fired 16 s after the title started | `0x887a0006` 43 s after the title started, on the loading screen (1,018 presents) | | 2 | not set (coherent window 3407 MB, 3008 MB used) | same place | did not fire | `0x887a0006` 28 s after the title started, on the loading screen (607 presents) | - **The WARN in run 1:** `a GPU-visible reservation of 1811 MB (0x71380000 bytes) found no room in the sparse windows (41 MB free, 41 MB at most in one run; window 0: 41 MB, 41 MB in one run, window 1: 0 MB, 0 MB in one run, window 2: 0 MB, 0 MB in one run)`. The sparse windows held 11,734 MB right after it. Without the PR, same settings, the windows grew by 1,880 MB at the same stage (7,689 to 9,569 MB), which I read as that reservation fitting while the pool was outside. With the two GPU heaps (1162 + 1277 MB) in the windows as well, the pool, the heaps and this reservation together need about 1.8 GB more than the 12 GiB of sparse windows. Run 2 takes the heaps out of the windows and the WARN is gone (sparse windows 11,106 MB). - **Both removals:** XCL logs DRED device state 7 and no breadcrumbs (`0x887a0004`: DRED is not on with the launch preparation, #2920). Local video memory was 10.2 GB (run 1) and 8.4 GB (run 2) on a 7.1 GB budget. The last draws recorded are the loading screen's (10 and 8 pipelines). - **For comparison on this card:** on `eae01502` without the PR, 1 of 7 runs ended with `0x887a0006` and state 7 on the loading screen (69 s after the title started; the one run that had `XCL_DRED=1` and the graphics prebuild on). Two more ended there with `0x887a0005` at 97 to 98 s, before the shader-heap profile was installed; the other four got to the world load. With `3292b096` reverted instead, on `e0821b12`, none of 3 runs did, and with `sparse:1024` the title then stayed in the world for 523 s and 801 s (I will put those on #2867). The revert runs are on a newer base, so this is not a clean pair. **Not tested:** more than one run per row; this PR on `e0821b12`; `XCL_HOME_W0_KEEP_MB` other than the default; the Series X profile; a run with DRED really on (`XCL_PREPARE=0`). **AI use:** Claude Code (Claude Fable 5.2) ran the runs, read the logs and wrote this under my direction; I reviewed it.
kole07139 commented 2026-11-27 20:58:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by kole07139 on 2026-11-27T20:58:38Z.


RTX 3070 8 GB without Resizable BAR, 32 GB RAM, Series S, default window layout, warm caches: with d900644d the title reached the first playable section in 4 of 6 runs (in the last one I moved the character on screen); 2 of the 6 runs held, to the 1,200 s limit and to 694 s when I stopped it, and 4 ended in the title's own code at 201–838 s, each at a different place. Without this PR the same base tree ended at 313 s. One run without the PR, six with it, on two trees, so these are data points. It adds runs longer than the 250 s of @LocranKing's check, on the default layout (@pr1sm-dev's runs were with XCL_UMA_WINDOWS=16), and on 32 GB of RAM.

Setup

  • RTX 3070 8 GB (driver 617.42, BAR1 256 MiB: no Resizable BAR), i9-9900K, 32 GB RAM, Windows 11 26200, release builds, NVIDIA shader heap 2048 MB (#2590).
  • Base: nvidia-dev d1be8103 + #609 (held presses). Tree A: base + this PR (d900644d). Tree B: base + this PR + @Kalmarv's #3007 head da9c69f7 (which carries #3003–#3006). Both merged cleanly.
  • XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_CS_PSO_WAIT_MS=200 XCL_TWO_PASS_MB=3072 XCL_PREPARE=0 XCL_NETWORK=0 XCL_FRAME_DUMP=120, A every 4 s held 3.5 s, default XCL_COHERENT_HEAPS and layout (3 sparse windows, coherent window 3407 MB). Every compute pipeline and graphics shader of the pack precompiled with the same build; each run on its own copy of that cache.

Results

run tree limit end draws (skipped) local video memory at the end
N base, without this PR 600 s 0xc0000005 at 313.8 s, title+0x4ea302e, read at 0x466768c0 79,196 (2,048) 12.7 GB
A1 A 1200 s 0xc0000005 at 563.0 s, title+0x4e334e6, read at 0x8d34 1,189,938 (7,162) 14.5 GB
A2 A 1200 s the 1,200 s limit, 2,913 frames 2,786,570 (17,905) 14.8 GB
A3 A 1200 s 0xc0000005 at 838.4 s, title+0x5035cd1, read at 0x508e3a2a 1,904,350 (16,384) 14.6 GB
B1 B 1200 s 0xc0000005 at 201.5 s, title+0x8655c1, read at 0x50 on 4 threads 48,819 (0) 13.7 GB
B2 B 1200 s 0xc0000005 at 233.8 s, title+0x4e2aacd, write at 0x8 65,536 (134) 13.6 GB
B3 B 1200 s stopped by me at 694 s, still running, in the playable section 3,487,924 (8,192) 14.6 GB
  • The new warning (a GPU-visible reservation of … found no room in the sparse windows) is in none of the logs.
  • On screen (a frame dump every 120th frame, and my screen in B3): all runs show the loading screen first (its last dumps black but for the spinner: 39 non-black samples of 518,400). From 309–406 s, A1, A2, A3 and B3 show the dark world: the skyline's horizon lights and a few lit pieces, the rest black (the dark view on NVIDIA in #505). Subtitles and sound play, and in B3 the character moved when I steered it. N, B1 and B2 ended before that point.
  • None of the ends is a read inside the windows (the windows start at 0x400000000). Four of the six are reads or writes near zero (0x8, 0x50, 0x8d34), and no two are at the same place. I found no issue with any of these offsets.
  • Memory on this machine, the same in all seven runs: system commit ran out during the load (269–355 MB left at its lowest, 72–257 s in, with the process at 22–28 GB; Windows grew the page file), and local video memory ended 5.6–7.7 GB over the 6.95–7.09 GB budget. XCL logged no failed allocation, so I cannot tie the ends to it.
  • Tree B's three ends came earlier than tree A's (201, 234 s, then one run that held, against 563, 838 s and one that held). With three runs each I would not call that a difference.
Log lines (the title's exe name shortened to title)
N  [  313.785] [ERROR] unhandled exception 0xc0000005 in title+0x4ea302e (read at address 0x466768c0) rax=0x466768c0 rbx=0x7ab585250 (vtable title+0x6678560) rcx=0x7ab58c530
A1 [  563.012] [ERROR] unhandled exception 0xc0000005 in title+0x4e334e6 (read at address 0x8d34) rax=0x0 rbx=0x437fe1530 rcx=0x8760 rdx=0x5a rsi=0x7a5061560 rdi=0x52e6f420
A2 [ 1132.520] D3D12.X: console code so far: 2786570 draws with translated pipelines (17905 skipped, 0 with PC pipelines), 2434610 dispatches (262144 skipped)
A2 [ 1200.001] XCL_RUN_SECONDS: 1200 s – ending the title (2913 frames shown, 2914 PresentX calls)
A2 [   72.098] memory: the system is running out of commit: 271 MB left of 39608 MB (RAM + page file). This process holds 21965 MB …
A3 [  838.413] [ERROR] unhandled exception 0xc0000005 in title+0x5035cd1 (read at address 0x508e3a2a) rax=0x26bfb rbx=0x21 rcx=0x50839240 rdx=0x7bff rsi=0x7c00 rdi=0x7a4ff8730
B1 [  201.492] [ERROR] unhandled exception 0xc0000005 in title+0x8655c1 (read at address 0x50) rax=0x0 rbx=0x509af9e0 rcx=0x0 rdx=0x0 rsi=0x81369
B2 [  233.846] [ERROR] unhandled exception 0xc0000005 in title+0x4e2aacd (write at address 0x8) rax=0x0 rbx=0x0 rcx=0x7ab3c9440 rdx=0x0 rsi=0x7ab3c9430
B3 [  681.721] D3D12.X: console code so far: 3487924 draws with translated pipelines (8192 skipped, 0 with PC pipelines)
B3 [  693.617] video memory: 14610 MB in use, 7596 MB over the budget of 7013 MB Windows gives this process

Not tested: more runs per arm; N with a 1,200 s limit; Series X; XCL_COHERENT_HEAPS=sparse; a machine with more RAM; the test suite on these trees.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the runs, read the logs and the frame dumps and wrote this; I watched the last run, checked the report and posted it.

<!-- greyfinch-sync:ivall/xcl:comment:7228016428 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7228016428). Originally posted by [kole07139](https://github.com/kole07139) on 2026-11-27T20:58:38Z. --- **RTX 3070 8 GB without Resizable BAR, 32 GB RAM, Series S, default window layout, warm caches: with `d900644d` the title reached the first playable section in 4 of 6 runs (in the last one I moved the character on screen); 2 of the 6 runs held, to the 1,200 s limit and to 694 s when I stopped it, and 4 ended in the title's own code at 201–838 s, each at a different place. Without this PR the same base tree ended at 313 s.** One run without the PR, six with it, on two trees, so these are data points. It adds runs longer than the 250 s of @LocranKing's check, on the default layout (@pr1sm-dev's runs were with `XCL_UMA_WINDOWS=16`), and on 32 GB of RAM. **Setup** - RTX 3070 8 GB (driver 617.42, BAR1 256 MiB: no Resizable BAR), i9-9900K, 32 GB RAM, Windows 11 26200, release builds, NVIDIA shader heap 2048 MB (#2590). - Base: `nvidia-dev` `d1be8103` + #609 (held presses). Tree A: base + this PR (`d900644d`). Tree B: base + this PR + @Kalmarv's #3007 head `da9c69f7` (which carries #3003–#3006). Both merged cleanly. - `XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_CS_PSO_WAIT_MS=200 XCL_TWO_PASS_MB=3072 XCL_PREPARE=0 XCL_NETWORK=0 XCL_FRAME_DUMP=120`, A every 4 s held 3.5 s, default `XCL_COHERENT_HEAPS` and layout (3 sparse windows, coherent window 3407 MB). Every compute pipeline and graphics shader of the pack precompiled with the same build; each run on its own copy of that cache. **Results** | run | tree | limit | end | draws (skipped) | local video memory at the end | |---|---|---|---|---|---| | N | base, without this PR | 600 s | `0xc0000005` at 313.8 s, `title+0x4ea302e`, read at `0x466768c0` | 79,196 (2,048) | 12.7 GB | | A1 | A | 1200 s | `0xc0000005` at 563.0 s, `title+0x4e334e6`, read at `0x8d34` | 1,189,938 (7,162) | 14.5 GB | | A2 | A | 1200 s | **the 1,200 s limit, 2,913 frames** | 2,786,570 (17,905) | 14.8 GB | | A3 | A | 1200 s | `0xc0000005` at 838.4 s, `title+0x5035cd1`, read at `0x508e3a2a` | 1,904,350 (16,384) | 14.6 GB | | B1 | B | 1200 s | `0xc0000005` at 201.5 s, `title+0x8655c1`, read at `0x50` on 4 threads | 48,819 (0) | 13.7 GB | | B2 | B | 1200 s | `0xc0000005` at 233.8 s, `title+0x4e2aacd`, write at `0x8` | 65,536 (134) | 13.6 GB | | B3 | B | 1200 s | **stopped by me at 694 s, still running, in the playable section** | 3,487,924 (8,192) | 14.6 GB | - **The new warning** (`a GPU-visible reservation of … found no room in the sparse windows`) is in none of the logs. - **On screen** (a frame dump every 120th frame, and my screen in B3): all runs show the loading screen first (its last dumps black but for the spinner: 39 non-black samples of 518,400). From 309–406 s, A1, A2, A3 and B3 show the dark world: the skyline's horizon lights and a few lit pieces, the rest black (the dark view on NVIDIA in #505). Subtitles and sound play, and in B3 the character moved when I steered it. N, B1 and B2 ended before that point. - **None of the ends is a read inside the windows** (the windows start at `0x400000000`). Four of the six are reads or writes near zero (`0x8`, `0x50`, `0x8d34`), and no two are at the same place. I found no issue with any of these offsets. - **Memory on this machine, the same in all seven runs:** system commit ran out during the load (269–355 MB left at its lowest, 72–257 s in, with the process at 22–28 GB; Windows grew the page file), and local video memory ended 5.6–7.7 GB over the 6.95–7.09 GB budget. XCL logged no failed allocation, so I cannot tie the ends to it. - Tree B's three ends came earlier than tree A's (201, 234 s, then one run that held, against 563, 838 s and one that held). With three runs each I would not call that a difference. <details><summary>Log lines (the title's exe name shortened to <code>title</code>)</summary> ``` N [ 313.785] [ERROR] unhandled exception 0xc0000005 in title+0x4ea302e (read at address 0x466768c0) rax=0x466768c0 rbx=0x7ab585250 (vtable title+0x6678560) rcx=0x7ab58c530 A1 [ 563.012] [ERROR] unhandled exception 0xc0000005 in title+0x4e334e6 (read at address 0x8d34) rax=0x0 rbx=0x437fe1530 rcx=0x8760 rdx=0x5a rsi=0x7a5061560 rdi=0x52e6f420 A2 [ 1132.520] D3D12.X: console code so far: 2786570 draws with translated pipelines (17905 skipped, 0 with PC pipelines), 2434610 dispatches (262144 skipped) A2 [ 1200.001] XCL_RUN_SECONDS: 1200 s – ending the title (2913 frames shown, 2914 PresentX calls) A2 [ 72.098] memory: the system is running out of commit: 271 MB left of 39608 MB (RAM + page file). This process holds 21965 MB … A3 [ 838.413] [ERROR] unhandled exception 0xc0000005 in title+0x5035cd1 (read at address 0x508e3a2a) rax=0x26bfb rbx=0x21 rcx=0x50839240 rdx=0x7bff rsi=0x7c00 rdi=0x7a4ff8730 B1 [ 201.492] [ERROR] unhandled exception 0xc0000005 in title+0x8655c1 (read at address 0x50) rax=0x0 rbx=0x509af9e0 rcx=0x0 rdx=0x0 rsi=0x81369 B2 [ 233.846] [ERROR] unhandled exception 0xc0000005 in title+0x4e2aacd (write at address 0x8) rax=0x0 rbx=0x0 rcx=0x7ab3c9440 rdx=0x0 rsi=0x7ab3c9430 B3 [ 681.721] D3D12.X: console code so far: 3487924 draws with translated pipelines (8192 skipped, 0 with PC pipelines) B3 [ 693.617] video memory: 14610 MB in use, 7596 MB over the budget of 7013 MB Windows gives this process ``` </details> **Not tested:** more runs per arm; N with a 1,200 s limit; Series X; `XCL_COHERENT_HEAPS=sparse`; a machine with more RAM; the test suite on these trees. AI use: Claude Code (Claude Opus 5.5) built the trees, ran the runs, read the logs and the frame dumps and wrote this; I watched the last run, checked the report and posted it.
Foniass commented 2026-12-01 06:02:02 +00:00 (Migrated from github.com)

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


Review (head d900644d, diff read, not a merge-check; it conflicts with main, so not built or run):

  • Still needed, but the rebase over #2886 (237b7181) changes behaviour. Main still puts physical page homes first-fit in windows 1+ (3292b096) and #2867 is open. But sparse_reserve now tries to fit a reservation in one window first, so this PR's physical_homes_in_window_0_leave_room_for_the_page_pool (expects the pool at title + 3997 MB, kernelx.rs ~5412) would see it wholly in window 2, and main's sparse_reserve_keeps_single_window_reservations_inside_one_window (uma.rs ~1595) expects homes in window 1 where top-down puts them in window 2. The in-game pool address (0x1101400000) was measured without #2886 and needs a new run.
  • It changes where homes go for every title. Window 0 is sparse in the default runtime layouts, so homes fill it from the top down to a 64 MB margin. That margin was fitted to one title (Series S, 16 windows), and a title that needs more window-0 memory after allocating its pages would hit the 3292b096 failure again. Series X and the default 4-window layout weren't run.
  • At about 486 lines it mixes the placement change, a WARN diagnostic and XCL_HOME_W0_KEEP_MB; CONTRIBUTING asks for the diagnostic and the switch as separate PRs. No xcl-smoke blocks and no full test run.

Fine: take_sparse_top_in (window-boundary handling, lo_bound and its test), the free_runs_in refactor, tests ignoring the shell's margin, and the WARN limited to the 64 KiB-page path.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7302402454 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2905#issuecomment-7302402454). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:02:02Z. --- Review (head d900644d, diff read, not a merge-check; it conflicts with main, so not built or run): - **Still needed, but the rebase over #2886 (237b7181) changes behaviour.** Main still puts physical page homes first-fit in windows 1+ (3292b096) and #2867 is open. But `sparse_reserve` now tries to fit a reservation in one window first, so this PR's `physical_homes_in_window_0_leave_room_for_the_page_pool` (expects the pool at `title + 3997 MB`, `kernelx.rs` ~5412) would see it wholly in window 2, and main's `sparse_reserve_keeps_single_window_reservations_inside_one_window` (`uma.rs` ~1595) expects homes in window 1 where top-down puts them in window 2. The in-game pool address (0x1101400000) was measured without #2886 and needs a new run. - **It changes where homes go for every title.** Window 0 is sparse in the default runtime layouts, so homes fill it from the top down to a 64 MB margin. That margin was fitted to one title (Series S, 16 windows), and a title that needs more window-0 memory after allocating its pages would hit the 3292b096 failure again. Series X and the default 4-window layout weren't run. - At about 486 lines it mixes the placement change, a WARN diagnostic and `XCL_HOME_W0_KEEP_MB`; CONTRIBUTING asks for the diagnostic and the switch as separate PRs. No xcl-smoke blocks and no full test run. Fine: `take_sparse_top_in` (window-boundary handling, `lo_bound` and its test), the `free_runs_in` refactor, tests ignoring the shell's margin, and the WARN limited to the 64 KiB-page path. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
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/2905:upstream-pr/2905'
git switch 'upstream-pr/2905'

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/2905'
git switch 'upstream-pr/2905'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2905'
git switch 'upstream-pr/2905'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2905'
git switch 'main'
git merge --squash 'upstream-pr/2905'
git switch 'main'
git merge --ff-only 'upstream-pr/2905'
git switch 'main'
git merge 'upstream-pr/2905'
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!2905
No description provided.