Skip to content

Memory/configurable uma windows - #822

Open
broccolize wants to merge 5 commits into
xcl-dev:mainfrom
broccolize:memory/configurable-uma-windows
Open

broccolize wants to merge 5 commits into
xcl-dev:mainfrom
broccolize:memory/configurable-uma-windows

Conversation

@broccolize

Copy link
Copy Markdown

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.

RemingtonWilcox and others added 5 commits November 24, 2026 05:30
…itch

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 xcl-dev#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 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: anes66 <37009523+anes66@users.noreply.github.com>
…d heaps

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 xcl-dev#187 by Remington Wilcox (8b4e398).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…the switch form

NVIDIA 616.92 (RTX 5070 Ti, reported in xcl-dev#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 xcl-dev#187 by Remington Wilcox (41d4506).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Keep the four-window runtime layout while making reservation bounds and coherent-window lookup follow the actual window list. Part of xcl-dev#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 xcl-dev#697.

Assisted-by: Codex (GPT-6)
@broccolize

Copy link
Copy Markdown
Author

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?

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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: #680 (comment)

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.

@Anon64

Anon64 commented Nov 24, 2026

Copy link
Copy Markdown

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.

@SlopTart

Copy link
Copy Markdown

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.

@maximecmb

Copy link
Copy Markdown
Contributor

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:

(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 Recompiler: memory windows from the descriptor heap (no per-access switch) #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.

@broccolize

Copy link
Copy Markdown
Author

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?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants