Memory/configurable uma windows #822

Open
github-bot wants to merge 5 commits from github-bot/gh-822 into main AGit
Owner

@⁠broccolize on GitHub · 2026-11-24 06:05 UTC · original
broccolize:memory/configurable-uma-windows → main · +814 −84 · 16 files · 5 commits · open

Stacked on #680.

Part of #697. Large title reservations can spill outside the four-window shader address range. This adds opt-in eight- and sixteen-window layouts through the shared descriptor heap.

What is in it

  • Add XCL_UMA_WINDOWS=8 and 16 for the runtime and shader precompiler. Expanded layouts reserve address space below the title's 40-bit address limit.
  • Bind every expanded window in the shared descriptor heap and use the full window index in translated shaders.
  • Cover a 24 GiB reservation, descriptor placement, and GPU reads, writes, and atomics in window 15.

Tested

  • Candidate e9705bb on Windows 11 build 26300, Core i5-10300H, GeForce GTX 1650 driver 32.0.16.1714, Rust 1.100.0 MSVC, and DXC 1.9.2609.5. Debug build.
  • cargo build --locked --workspace passed.
  • cargo test --locked --workspace -- --test-threads=4 --show-output with XCL_ADAPTER=1650. Cargo reported 709 passed, 0 failed, and 41 ignored.
  • Five tests reported SKIPPED. gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware require wave64. placed_title_textures_share_vram_and_preserve_pixels requires a reserved cube with mips. test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state require the D3D12 debug layer.
  • cargo test --locked -p xcl --test e2e test_title_runs_and_game_folder_is_untouched -- --exact --show-output passed with both eight and sixteen windows. The GPU opened all configured windows, and the synthetic title completed both runs with zero failures.

Regression run

Paired real-title smoke runs are pending for main and the final PR head.

Not tested

AMD hardware, real-title rendering and memory impact, and the full suite on the eventual rebased head.

AI use

Codex investigated #697, implemented the two commits, wrote and ran the local tests.

**@⁠broccolize** on GitHub · 2026-11-24 06:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/822) `broccolize:memory/configurable-uma-windows` → `main` · +814 −84 · 16 files · 5 commits · open Stacked on #680. Part of #697. Large title reservations can spill outside the four-window shader address range. This adds opt-in eight- and sixteen-window layouts through the shared descriptor heap. **What is in it** - Add `XCL_UMA_WINDOWS=8` and `16` for the runtime and shader precompiler. Expanded layouts reserve address space below the title's 40-bit address limit. - Bind every expanded window in the shared descriptor heap and use the full window index in translated shaders. - Cover a 24 GiB reservation, descriptor placement, and GPU reads, writes, and atomics in window 15. **Tested** - Candidate `e9705bb` on Windows 11 build 26300, Core i5-10300H, GeForce GTX 1650 driver `32.0.16.1714`, Rust 1.100.0 MSVC, and DXC 1.9.2609.5. Debug build. - `cargo build --locked --workspace` passed. - `cargo test --locked --workspace -- --test-threads=4 --show-output` with `XCL_ADAPTER=1650`. Cargo reported 709 passed, 0 failed, and 41 ignored. - Five tests reported `SKIPPED`. `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` require wave64. `placed_title_textures_share_vram_and_preserve_pixels` requires a reserved cube with mips. `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` require the D3D12 debug layer. - `cargo test --locked -p xcl --test e2e test_title_runs_and_game_folder_is_untouched -- --exact --show-output` passed with both eight and sixteen windows. The GPU opened all configured windows, and the synthetic title completed both runs with zero failures. **Regression run** Paired real-title smoke runs are pending for `main` and the final PR head. **Not tested** AMD hardware, real-title rendering and memory impact, and the full suite on the eventual rebased head. **AI use** Codex investigated #697, implemented the two commits, wrote and ran the local tests.
With more than one memory window every memory access of a translated shader was
inlined once per window: a switch over the root UAVs mem, mem1.. Now window k is
also a raw UAV at MEM_HEAP_BASE + k of the shared shader-visible heap, and an access
is one ResourceDescriptorHeap load or store.

- Options::heap_windows, and the HEAP_WINDOWS flag in the windows count, so that the
  translation and DXIL cache keys differ; on unless XCL_HEAP_WINDOWS=0 or the views
  could not be made (then the switch, as before).
- console_heap: the first 4 descriptors of the shared heap are the windows' raw
  views, 2^30 - 1 dwords at most: a sparse window's last 64 KiB tile is reachable,
  only the window's last dword is not.
- Lists bind the shared heap before an ABI dispatch or draw when they set none.
- xcl shaders --precompile uses the same key.
- Tests: gpu_memory_windows_from_the_heap (the windows test in the heap form),
  gpu_raw_window_view_reaches_its_top (the view on a 4 GiB reserved buffer); the
  runner and the fake draw list bind the heap.
- The windows' views are made after the shared heap's lock is released: the device may be
  an adopted one whose UAV hook takes the heaps' lock, which other paths take first
  (found and fixed by anes66 in review; test window_views_do_not_hold_global_during_device_calls).

From #187 by Remington Wilcox (c3fb89e, 864ce8e, 33c92dd), closed without being
merged: carried onto current main without that PR's aperture experiments and
compile-time bench.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: anes66 <[email protected]>
Unbinding every heap left the list's record of bound heaps as it was, so
ensure_view_heap saw a heap and did not bind the shared one: the next translated
draw or dispatch read the memory windows (ResourceDescriptorHeap[0..3]) with no
heap bound.

Test: unbinding_all_heaps_lets_the_shared_heap_be_bound_again.

From #187 by Remington Wilcox (8b4e398).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
NVIDIA 616.92 (RTX 5070 Ti, reported in #156) refuses some big programs whose
descriptor-heap index depends on the memory window with E_OUTOFMEMORY, and builds
the same programs in the switch form. A translated compute, graphics, mesh or GS
pipeline whose driver call fails that way with heap windows is now translated again
in the switch form (other cache keys; same root signature and binds) and built from
that before the stand-in or the error path.

Test: heap_window_out_of_memory_falls_back_to_the_switch_form injects the refusals
through the CreateComputePipelineState hook, then dispatches the rebuilt pipeline
and checks every thread's output.

From #187 by Remington Wilcox (41d4506).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Keep the four-window runtime layout while making reservation bounds and coherent-window lookup follow the actual window list. Part of #697.

Assisted-by: Codex (GPT-6)
Allow large title reservations to stay in UMA when the shared descriptor heap is available. Keep the four-window ABI and refuse switch-form retries for wider layouts. Part of #697.

Assisted-by: Codex (GPT-6)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:33:43 +00:00
Author
Owner

@⁠broccolize on GitHub · 2026-11-24 06:22 UTC · original

Does anyone know of a small Xbox Series title or demo that works in XCL and is available as an authorized unpacked download? I’d like to reproduce the smoke runs and do more testing locally. Would that title count for the PR’s regression check?

**@⁠broccolize** on GitHub · 2026-11-24 06:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7123865991) Does anyone know of a small Xbox Series title or demo that works in XCL and is available as an authorized unpacked download? I’d like to reproduce the smoke runs and do more testing locally. Would that title count for the PR’s regression check?
Author
Owner

@⁠ryosen0 on GitHub · 2026-11-24 06:36 UTC · original

Cross-check on RTX 3060 Ti 8 GB (driver 32.0.16.1742, Windows 11): this head currently cannot boot the retail title here in the default (heap-window) form — but the cause is in the base #680, not in this PR's own commits. Details and controls posted there: https://github.com/ivall/xcl/pull/680#issuecomment-7124104236

Short version: e9705bb default and XCL_UMA_WINDOWS=8 both end at t≈2.5 s with the device suspended before the first draw (first sparse CreateHeap refused 0x887a0005, then 0x887a0001 / title breakpoint); the base 2c1a521 alone does the same; XCL_HEAP_WINDOWS=0 on this same head boots clean (2442 frames, 60 presents / 2 s, peak commit 14473 MB). Once #680's NVIDIA boot issue is resolved this stack should be re-measured — the eight-window layout itself was not reached on this machine.

AI use: GPT-6.2 Astra (API model selector) in DSH ran the builds/smokes and drafted this comment; the human contributor reviewed before posting.

**@⁠ryosen0** on GitHub · 2026-11-24 06:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7124109384) Cross-check on RTX 3060 Ti 8 GB (driver 32.0.16.1742, Windows 11): this head currently cannot boot the retail title here in the default (heap-window) form — but the cause is in the base #680, not in this PR's own commits. Details and controls posted there: https://github.com/ivall/xcl/pull/680#issuecomment-7124104236 Short version: `e9705bb` default and `XCL_UMA_WINDOWS=8` both end at t≈2.5 s with the device suspended before the first draw (first sparse `CreateHeap` refused 0x887a0005, then 0x887a0001 / title breakpoint); the base `2c1a521` alone does the same; `XCL_HEAP_WINDOWS=0` on this same head boots clean (2442 frames, 60 presents / 2 s, peak commit 14473 MB). Once #680's NVIDIA boot issue is resolved this stack should be re-measured — the eight-window layout itself was not reached on this machine. **AI use:** GPT-6.2 Astra (API model selector) in DSH ran the builds/smokes and drafted this comment; the human contributor reviewed before posting.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 07:17 UTC · original

Regression runs for this PR's head e9705bb and for its base main 64b3f35, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1649 (PresentX 1649)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16734 MB

this PR:

xcl-smoke v1
commit: e9705bb935c4a4e2064127d3f5bfa26fab89e674
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17022 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0

Not tested

  • the unit tests on this machine
  • other window counts than the default; this is a regression check of the default only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7124834904) Regression runs for this PR's head `e9705bb` and for its base `main` `64b3f35`, on a retail title (same title, 60 s each), made with `scripts/smoke.ps1` (release, clean tree at each commit) and pasted unedited, for **Regression run**. main: ``` xcl-smoke v1 commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1649 (PresentX 1649) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16734 MB ``` this PR: ``` xcl-smoke v1 commit: e9705bb935c4a4e2064127d3f5bfa26fab89e674 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1615 (PresentX 1615) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17022 MB ``` **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0 **Not tested** - the unit tests on this machine - other window counts than the default; this is a regression check of the default only Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 07:17 UTC · original

Heads-up from a test rig: e9705bb does not merge onto current main (beaa245) - content conflict in crates/xcl/src/gpu/recomp/emit.rs. Needs a rebase before it can run in any lane. Once rebased I'll gladly test it on RDNA3 / Wine (my Linux rows: #42 / #718).

AI use: Hermes agent (local Qwen-class) ran the merge check and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7124836143) Heads-up from a test rig: `e9705bb` does not merge onto current main (`beaa245`) - content conflict in `crates/xcl/src/gpu/recomp/emit.rs`. Needs a rebase before it can run in any lane. Once rebased I'll gladly test it on RDNA3 / Wine (my Linux rows: #42 / #718). AI use: Hermes agent (local Qwen-class) ran the merge check and drafted this; I checked it before posting.
Author
Owner

@⁠maximecmb on GitHub · 2026-11-24 10:20 UTC · original

A run report, and a regression to look at: with XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16, the retail title's intro video shows green.

Build: main 6efdabc + #680's three current commits (341b209, a0c6676, 95f34c1) + this PR's 70209d1 and e9705bb, rebased locally. There were two conflicts:

  • emit.rs: I kept main's xcl_w = select(hi == 0, 0, hi - xcl_uma_base) from #792 instead of & mask.
  • shaders.rs: I took this PR's window-count block, with #680's opt-in comment.

(Plus #956's diagnostics, which only log.) RTX 5080 (driver 617.42), Windows 11 26300, Rust 1.100.0 MSVC, release.

Tests:

  • cargo test -p xcl --lib -- --test-threads=4 with default settings: 694 passed, 1 failed. The failure is expanded_heap_window_shaders_use_the_full_window_index, which asserts the text xcl_w < {windows}u, while #680's current accessors emit xcl_w >= {windows}u → 0. gpu_memory_windows_beyond_the_root_uavs (window 15 reads, writes and atomics) passes.
  • With XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 for the whole process, these also fail: gpu_sparse_vram_descriptors_buffers_and_xmem ("runtime layout has 4 shader windows", 16 ≠ 4) and gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes (its reserve-only allocation now lands inside the windows, the effect this PR wants), plus the three tests on its poisoned lock. All of them look like tests written for the 4-window layout, not faults.

The run: UMA: 15 sparse VRAM window(s) (60 GiB VA) + 4095 MB coherent window at 0x1000000000. The title boots, but the intro video is a full green screen, and the loading screen after it is black (its audio plays). On main both show normally on this machine. Green is what the kernelx::mirrors comment describes for the Bink planes when the GPU view isn't linked to the CPU view ("its colour of zero luma and chroma"). I haven't bisected whether #680's heap windows or this PR's layout causes it.

The empty buffer views of #697 did not go away with 16 windows: the 24 GB 64 KiB-page reservation pair never goes to the windows (details on #697).

AI use: Claude Code (Claude Opus 5.5) rebased the stack, ran the tests, read the log and wrote this comment. I ran the title.

**@⁠maximecmb** on GitHub · 2026-11-24 10:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7128654291) A run report, and a regression to look at: **with `XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16`, the retail title's intro video shows green**. **Build:** `main` `6efdabc` + #680's three current commits (`341b209`, `a0c6676`, `95f34c1`) + this PR's `70209d1` and `e9705bb`, rebased locally. There were two conflicts: - `emit.rs`: I kept `main`'s `xcl_w = select(hi == 0, 0, hi - xcl_uma_base)` from #792 instead of `& mask`. - `shaders.rs`: I took this PR's window-count block, with #680's opt-in comment. (Plus #956's diagnostics, which only log.) RTX 5080 (driver 617.42), Windows 11 26300, Rust 1.100.0 MSVC, release. **Tests:** - `cargo test -p xcl --lib -- --test-threads=4` with default settings: 694 passed, 1 failed. The failure is `expanded_heap_window_shaders_use_the_full_window_index`, which asserts the text `xcl_w < {windows}u`, while #680's current accessors emit `xcl_w >= {windows}u` → 0. `gpu_memory_windows_beyond_the_root_uavs` (window 15 reads, writes and atomics) passes. - With `XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16` for the whole process, these also fail: `gpu_sparse_vram_descriptors_buffers_and_xmem` ("runtime layout has 4 shader windows", 16 ≠ 4) and `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` (its reserve-only allocation now lands inside the windows, the effect this PR wants), plus the three tests on its poisoned lock. All of them look like tests written for the 4-window layout, not faults. **The run:** `UMA: 15 sparse VRAM window(s) (60 GiB VA) + 4095 MB coherent window at 0x1000000000`. The title boots, but the intro video is a **full green screen**, and the loading screen after it is black (its audio plays). On `main` both show normally on this machine. Green is what the `kernelx::mirrors` comment describes for the Bink planes when the GPU view isn't linked to the CPU view ("its colour of zero luma and chroma"). I haven't bisected whether #680's heap windows or this PR's layout causes it. The empty buffer views of #697 did **not** go away with 16 windows: the 24 GB 64 KiB-page reservation pair never goes to the windows (details on #697). AI use: Claude Code (Claude Opus 5.5) rebased the stack, ran the tests, read the log and wrote this comment. I ran the title.
Author
Owner

@⁠broccolize on GitHub · 2026-11-24 10:56 UTC · original

Thanks for testing this, @⁠maximecmb. Could you share a link to the branch or patch from your local rebase?

If you have time to rerun on the same PC and retail build, could you compare these two configurations using the same main commit and diagnostics?

  • #680 alone with XCL_HEAP_WINDOWS=1.
  • #680 + #822 with XCL_HEAP_WINDOWS=1 and XCL_UMA_WINDOWS=16.

Does the intro turn green or the loading screen turn black in either run? That would help isolate where the rendering regression starts.

**@⁠broccolize** on GitHub · 2026-11-24 10:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7129448110) Thanks for testing this, @⁠maximecmb. Could you share a link to the branch or patch from your local rebase? If you have time to rerun on the same PC and retail build, could you compare these two configurations using the same `main` commit and diagnostics? - #680 alone with `XCL_HEAP_WINDOWS=1`. - #680 + #822 with `XCL_HEAP_WINDOWS=1` and `XCL_UMA_WINDOWS=16`. Does the intro turn green or the loading screen turn black in either run? That would help isolate where the rendering regression starts.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 10:48 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 10:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7160198430) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
Author
Owner

@⁠broccolize on GitHub · 2026-11-26 05:16 UTC · original

Thanks for testing this, @⁠maximecmb. Expanded UMA windows landed in #1998. Could you check whether the green intro still reproduces on current main with XCL_HEAP_WINDOWS=1, comparing 4 and 16 windows? I also staged the remaining shader precompiler fix on broccolize/xcl at 9f17a84. If you can run a 60-second smoke pair on clean b49be18 and 9f17a84 with the same retail title and settings, please share both unedited xcl-smoke blocks. Thanks!

**@⁠broccolize** on GitHub · 2026-11-26 05:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/822#issuecomment-7183334662) Thanks for testing this, @⁠maximecmb. Expanded UMA windows landed in #1998. Could you check whether the green intro still reproduces on current main with XCL_HEAP_WINDOWS=1, comparing 4 and 16 windows? I also staged the remaining shader precompiler fix on broccolize/xcl at 9f17a84. If you can run a 60-second smoke pair on clean b49be18 and 9f17a84 with the same retail title and settings, please share both unedited xcl-smoke blocks. Thanks!
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/xcl/src/gpu/recomp/emit.rs
  • crates/xcl/src/gpu/recomp/heap_window_tests.rs
  • crates/xcl/src/gpu/recomp/mod.rs
  • crates/xcl/src/gpu/recomp/pso.rs
  • crates/xcl/src/gpu/recomp/runner.rs
  • crates/xcl/src/gpu/recomp/tests.rs
  • crates/xcl/src/gpu/uma.rs
  • crates/xcl/src/hle/d3d12x/console_heap.rs
  • crates/xcl/src/hle/d3d12x/console_list.rs
  • crates/xcl/src/hle/d3d12x/list_x.rs
  • crates/xcl/src/hle/d3d12x/real.rs
  • crates/xcl/src/shaders.rs
  • crates/xcl/tests/gpu_compute_e2e.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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