kernelx: XCL_PAGE_ALIAS=1 shows a physical page at every address it is mapped at #2307

Open
github-bot wants to merge 4 commits from github-bot/gh-2307 into main AGit
Owner

@⁠adiologydev on GitHub · 2026-11-25 13:27 UTC · original
adiologydev:kernelx/page-alias → main · +1389 −11 · 9 files · 4 commits · open

Stacked on #2294; only the top commit (f30ca3f) belongs here. Third part of the plan on #1031: behind XCL_PAGE_ALIAS=1 (off by default), a physical page shows at every address the title maps it at.

Measured in a traced run of a retail title first (local logging, not in the PR): it allocates 3 blocks of physical pages (11 360, 2 960 and 99 776 pages), and in 150 s makes 131 072 map calls, nearly all single pages, into its plain reservations of 64 KiB pages (the CPU view of its 24 GB pair and its 6.2 GB pool) – never at a page's home, and it never commits memory of its own inside them. 5 calls (2 960 pages) go into a placeholder region it made in a sparse window.

What is in it (f30ca3f)

  • crates/xcl/src/hle/kernelx/alias.rs (new), with XCL_PAGE_ALIAS=1:
    • a block of physical pages is a section (#2293) with a view of its own, through which XCL reads and writes pages by number (DirectStorage); homes are plain address space, not the sparse windows, since the title never maps a page there;
    • the title's reservations of 64 KiB pages with no commit (CPU view, GPU view, pool) are placeholders; a page mapped there is a view of its slice, guarded (#2294), so a write through one view is uploaded at all of them;
    • a page mapped anywhere else is moved there and back with its bytes, as without the switch;
    • whether a page is committed is a bit per page: asking Windows walked the rest of a fresh block, and 100 000 single-page maps delayed the first frame by 20 s;
    • 5 unit tests.
  • crates/xcl/src/hle/kernelx.rs: the switch in VirtualAlloc / VirtualFree(Ex), Allocate/Free/MapTitlePhysicalPages, XMemMapPhysicalPagesScatter, read/write_physical_pages, physical_page_at; a commit inside such a reservation is refused (never seen) with a warning.
  • d3d12x/title_textures.rs: the guarded pages join what the write watch found. lazy.rs: a view the lazy handler commits sets its bit. sections.rs: release_all.

Tested

  • NVIDIA GeForce RTX 5090 32 GB (driver 621.40), AMD Ryzen 9 7950X, 64 GB RAM, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2609 (XCL_DXC_DIR), debug tests, release runs.

  • cargo test --workspace -- --test-threads=4 on f30ca3f: 1114 passed, 4 failed, 26 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (CreateComputePipelineState → E_OUTOFMEMORY on this card, #1905); main 568e7db fails the same 4 here (1094 passed, 4 failed, 26 ignored). SKIPPED (23, the same on main): 20 need 64-lane waves ("no wave64"), 3 per-lane f16 refusals in lower_dxil::tests::{f16,f32}_programs_on_the_gpu.

  • The retail title with XCL_PAGE_ALIAS=1, against main 568e7db, the same route into its world (pad A at the account prompt, A A at the title screen), 240 s each, runs interleaved (the pipeline cache warms with every run):

    run (in order) frames in 240 s peak commit last frame before the cold pipeline compiles (#2088) crashes / device removals
    XCL_PAGE_ALIAS=1 (f30ca3f) 4 516 23 525 MB 180 s 0 / 0
    main 568e7db 5 001 30 813 MB 192 s 0 / 0
    main 568e7db 4 085 31 855 MB 160 s 0 / 0
    XCL_PAGE_ALIAS=1 (f30ca3f) 4 252 24 341 MB 168 s 0 / 0

    About 7 GB less peak commit with the switch; frames and the time of the last frame are within the run-to-run spread (an earlier single pair showed more frames with the switch; it did not hold up here).

Regression run (the switch off, as the PR checks run it)
scripts/smoke.ps1 -Game <retail title> -Seconds 60, no input, main first, same machine (each run's xcl.exe built from a clean checkout of its commit):

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 5090
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1015 (PresentX 1015)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16257 MB
xcl-smoke v1
commit: f30ca3f037e474fe1ca1720835313db161b36004
gpu: NVIDIA GeForce RTX 5090
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1530 (PresentX 1530)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15857 MB

Not tested

  • AMD and Intel GPUs; Wine / Proton.
  • The title's world as a picture: on this machine every run stops presenting in the driver's cold pipeline compiles once the world loads (#2088), with or without the switch.
  • Shaders still cannot read the GPU view: it is outside the memory windows (#697). That is the plan's parts 5–6; this PR fixes what the CPU side sees.

AI use

  • Claude Code (Claude Opus 5.5): wrote the code, the tests and this description, and made the runs above on this hardware. I read every line of the diff and checked it.
**@⁠adiologydev** on GitHub · 2026-11-25 13:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/2307) `adiologydev:kernelx/page-alias` → `main` · +1389 −11 · 9 files · 4 commits · open Stacked on #2294; only the top commit (`f30ca3f`) belongs here. Third part of the plan on #1031: behind `XCL_PAGE_ALIAS=1` (off by default), a physical page shows at every address the title maps it at. Measured in a traced run of a retail title first (local logging, not in the PR): it allocates 3 blocks of physical pages (11 360, 2 960 and 99 776 pages), and in 150 s makes 131 072 map calls, nearly all single pages, into its plain reservations of 64 KiB pages (the CPU view of its 24 GB pair and its 6.2 GB pool) – never at a page's home, and it never commits memory of its own inside them. 5 calls (2 960 pages) go into a placeholder region it made in a sparse window. **What is in it** (`f30ca3f`) - `crates/xcl/src/hle/kernelx/alias.rs` (new), with `XCL_PAGE_ALIAS=1`: - a block of physical pages is a section (#2293) with a view of its own, through which XCL reads and writes pages by number (DirectStorage); homes are plain address space, not the sparse windows, since the title never maps a page there; - the title's reservations of 64 KiB pages with no commit (CPU view, GPU view, pool) are placeholders; a page mapped there is a view of its slice, guarded (#2294), so a write through one view is uploaded at all of them; - a page mapped anywhere else is moved there and back with its bytes, as without the switch; - whether a page is committed is a bit per page: asking Windows walked the rest of a fresh block, and 100 000 single-page maps delayed the first frame by 20 s; - 5 unit tests. - `crates/xcl/src/hle/kernelx.rs`: the switch in `VirtualAlloc` / `VirtualFree(Ex)`, `Allocate/Free/MapTitlePhysicalPages`, `XMemMapPhysicalPagesScatter`, `read/write_physical_pages`, `physical_page_at`; a commit inside such a reservation is refused (never seen) with a warning. - `d3d12x/title_textures.rs`: the guarded pages join what the write watch found. `lazy.rs`: a view the lazy handler commits sets its bit. `sections.rs`: `release_all`. **Tested** - NVIDIA GeForce RTX 5090 32 GB (driver 621.40), AMD Ryzen 9 7950X, 64 GB RAM, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2609 (`XCL_DXC_DIR`), debug tests, release runs. - `cargo test --workspace -- --test-threads=4` on `f30ca3f`: 1114 passed, 4 failed, 26 ignored. The 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3` (`CreateComputePipelineState` → `E_OUTOFMEMORY` on this card, #1905); `main` 568e7db fails the same 4 here (1094 passed, 4 failed, 26 ignored). SKIPPED (23, the same on `main`): 20 need 64-lane waves ("no wave64"), 3 per-lane f16 refusals in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu`. - The retail title with `XCL_PAGE_ALIAS=1`, against `main` 568e7db, the same route into its world (pad A at the account prompt, A A at the title screen), 240 s each, runs interleaved (the pipeline cache warms with every run): | run (in order) | frames in 240 s | peak commit | last frame before the cold pipeline compiles (#2088) | crashes / device removals | |---|---|---|---|---| | `XCL_PAGE_ALIAS=1` (`f30ca3f`) | 4 516 | 23 525 MB | 180 s | 0 / 0 | | `main` 568e7db | 5 001 | 30 813 MB | 192 s | 0 / 0 | | `main` 568e7db | 4 085 | 31 855 MB | 160 s | 0 / 0 | | `XCL_PAGE_ALIAS=1` (`f30ca3f`) | 4 252 | 24 341 MB | 168 s | 0 / 0 | About 7 GB less peak commit with the switch; frames and the time of the last frame are within the run-to-run spread (an earlier single pair showed more frames with the switch; it did not hold up here). **Regression run** (the switch off, as the PR checks run it) `scripts/smoke.ps1 -Game <retail title> -Seconds 60`, no input, `main` first, same machine (each run's `xcl.exe` built from a clean checkout of its commit): ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: NVIDIA GeForce RTX 5090 title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1015 (PresentX 1015) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16257 MB ``` ``` xcl-smoke v1 commit: f30ca3f037e474fe1ca1720835313db161b36004 gpu: NVIDIA GeForce RTX 5090 title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1530 (PresentX 1530) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15857 MB ``` **Not tested** - AMD and Intel GPUs; Wine / Proton. - The title's world as a picture: on this machine every run stops presenting in the driver's cold pipeline compiles once the world loads (#2088), with or without the switch. - Shaders still cannot read the GPU view: it is outside the memory windows (#697). That is the plan's parts 5–6; this PR fixes what the CPU side sees. **AI use** - Claude Code (Claude Opus 5.5): wrote the code, the tests and this description, and made the runs above on this hardware. I read every line of the diff and checked it.
On the console a physical page mapped at several addresses is one page. XCL
keeps a page at one address at a time and copies it when the title maps it
elsewhere (`move_away`), so the other addresses go stale; a retail title maps
its streamed pages into a pool, into the CPU view of a 24 GB reservation and
into that reservation's GPU view (#1031).

`kernelx::sections` is the base for real aliasing: a block of physical pages
is one pagefile-backed SEC_RESERVE section, and a page is mapped as a view of
its 64 KiB slice into a placeholder (MapViewOfFile3 with
MEM_REPLACE_PLACEHOLDER). Every view of a slice is the same memory and a page
takes commit once, when it is committed through any view. Unmapping leaves a
placeholder for the next view. Ordinary reserved memory (write-watched if
asked) can replace part of a placeholder and go back to one.

Nothing calls it yet. Measured in a standalone program on Windows 11 26200
over 200 000 pages: map 2.2 us, unmap 2.75 us, commit 0.9 us a page.
GetWriteWatch refuses a range that holds a view (error 87), and one call
cannot span two neighbouring reservations either.
The upload of title memory to video memory (`d3d12x::sparse`) and the
textures kept in step with title memory learn what the CPU wrote from the
write watch, and a view of a section (`kernelx::sections`) cannot be
write-watched: GetWriteWatch refuses any range that holds one.

`kernelx::guards` keeps the views of a physical page read-only. The first
write through any of them faults; a vectored handler makes that view
writable, notes the page and lets the write go on. `take_dirty` hands over
the pages of every view of each page written – a write through one view is
a write to all of them – and guards those views again before their bytes are
read, so a later write is caught again and an earlier one is in what is read.

Kernel calls do not fault into the handler, they fail: `lazy::ensure`, which
XCL already calls before a kernel call or its own code writes title memory,
opens the guards there first and counts the write. A view committed by the
lazy handler is writable and counts as written. Both take no lock until a
view has been watched.

Nothing watches a view yet.
A guarded view of a physical page (`kernelx::guards`) is read-only until it
is written. Code of XCL's own that writes there faults into the guard and
goes on, but a kernel call does not fault: ReadFile into such a view fails.
`lazy::ensure` opened the views first, yet the submit thread's `take_dirty`
could guard them again before the write – between DirectStorage's check of
its destination and the copy, or before the kernel wrote a ReadFile buffer.

`guards::open` now returns `Opened`, which keeps its views writable until it
is dropped; `take_dirty` uploads a pinned view but does not guard it again,
and the end of the write counts as a write. `lazy::ensure` returns it and its
callers hold it across their write: the routed ReadFile for a synchronous
read, and the destination checks of DirectStorage and the CPU-side
bottom-of-pipe writes. An overlapped ReadFile writes after the call returns:
its views stay open until its OVERLAPPED is no longer STATUS_PENDING, which
`take_dirty` reads without faulting (the title may free it once done). A
retail title reads 271 MB that way into the CPU view of its 24 GB
reservation 8.5 s after start.

`guards::written` counts a page as written through all its views when XCL
writes it by page number.

Nothing watches a view yet, so nothing changes without views.
Without it XCL keeps a physical page at one address at a time and copies it
when the title maps it elsewhere; the console shows the page at every
address it is mapped at. A retail title maps its streamed pages into a pool,
into the CPU view of a 24 GB reservation and into that reservation's GPU
view (#1031).

With `XCL_PAGE_ALIAS=1` (`kernelx::alias`):
- a block of physical pages is a section (`kernelx::sections`) with a view
  of its own, through which XCL reads and writes pages by number
  (DirectStorage); the title never maps a page there;
- the title's reservations of 64 KiB pages with no commit (its CPU view, GPU
  view and pool) are placeholders, and a page mapped there is a view of its
  slice, guarded (`kernelx::guards`) so that a write through one view is
  uploaded at all of them; `title_textures` adds those pages to what the
  write watch found;
- a page mapped anywhere else (a placeholder region the title made in a
  sparse window) is moved there and back with its bytes, as before.

Pages are committed on first use as before (`kernelx::lazy`); whether a page
is committed is a bit per page: asking Windows walked the rest of a fresh
block, and a title mapping 100 000 new pages one at a time took 20 s longer
to its first frame.

Measured in a traced run of a retail title: 3 blocks (11 360, 2 960 and
99 776 pages), 131 072 map calls in 150 s, nearly all single pages into its
plain reservations, none at a page's home, no commit inside them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:26:36 +00:00
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 14:37 UTC · original

Tested: head f30ca3f merged onto current origin/main (auto-merge, clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). Note the branch carries its open ancestors (#2294, #2293) on top of main, same as it will when reviewed.

Default (switch off): gpu_ suite 141 passed / 4 failed / 1 ignored. Three are the rig's known baseline (fuzz seed 1003 of #2115, gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu_depth_buffer_created_for_unordered_access_is_placed); the fourth, gpu_geometry_wave32_prefix_count_over_a_mask, is this rig's known flaky family: solo reruns 3/3 green on this branch, and plain origin/main reproduces the same failure under the same conditions. Not attributable to this change.

With XCL_PAGE_ALIAS=1: the alias tests added by the top commit fail on this lane, deterministically (2/2 reruns, --test-threads=1):

  • a_page_mapped_into_two_spaces_is_one_page_and_writes_reach_both FAILED
  • a_page_moved_outside_the_spaces_goes_and_comes_back_with_its_bytes FAILED
  • pages_read_and_written_by_number_are_the_pages_the_title_sees FAILED
  • a_page_not_from_the_title_is_refused ok, remapping_an_address_shows_the_new_page_and_keeps_the_old_one ok

On the #2308 branch, which carries these same alias tests unmodified apart from one added test, flag-off runs also fail at real assertion lines (alias.rs:452, alias.rs:495, alias.rs:518), so this is not just switch gating. These are in-process unit tests (0.03 s), not timing-sensitive game runs, so the red looks like a real behavior difference on the Wine/vkd3d-proton lane rather than flakiness.

Not tested: native Windows CI behavior (upstream CI presumably sees these green, so the delta is lane-specific); retail titles (no title data on this lane, counts only).

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

**@⁠SlopTart** on GitHub · 2026-11-25 14:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2307#issuecomment-7165560936) **Tested**: head `f30ca3f` merged onto current `origin/main` (auto-merge, clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). Note the branch carries its open ancestors (#2294, #2293) on top of main, same as it will when reviewed. **Default (switch off)**: `gpu_` suite 141 passed / 4 failed / 1 ignored. Three are the rig's known baseline (fuzz seed 1003 of #2115, `gpu_nonfused_mad_and_mac_prevent_fma_contraction`, `gpu_depth_buffer_created_for_unordered_access_is_placed`); the fourth, `gpu_geometry_wave32_prefix_count_over_a_mask`, is this rig's known flaky family: solo reruns 3/3 green on this branch, and plain `origin/main` reproduces the same failure under the same conditions. Not attributable to this change. **With `XCL_PAGE_ALIAS=1`**: the alias tests added by the top commit fail on this lane, deterministically (2/2 reruns, `--test-threads=1`): - `a_page_mapped_into_two_spaces_is_one_page_and_writes_reach_both` FAILED - `a_page_moved_outside_the_spaces_goes_and_comes_back_with_its_bytes` FAILED - `pages_read_and_written_by_number_are_the_pages_the_title_sees` FAILED - `a_page_not_from_the_title_is_refused` ok, `remapping_an_address_shows_the_new_page_and_keeps_the_old_one` ok On the #2308 branch, which carries these same alias tests unmodified apart from one added test, flag-off runs also fail at real assertion lines (`alias.rs:452`, `alias.rs:495`, `alias.rs:518`), so this is not just switch gating. These are in-process unit tests (0.03 s), not timing-sensitive game runs, so the red looks like a real behavior difference on the Wine/vkd3d-proton lane rather than flakiness. **Not tested**: native Windows CI behavior (upstream CI presumably sees these green, so the delta is lane-specific); retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 14:47 UTC · original

Native Windows check of f30ca3f037e474fe1ca1720835313db161b36004. The alias unit tests pass here. The existing mirror upload test stops at a write-watch setup assertion when aliasing is enabled.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, unoptimized profile. AMD Radeon(TM) Graphics driver 32.0.21042.62, SDK DXC/DXIL 1.8.2502.11.
  • cargo test --locked -p xcl --lib hle::kernelx::alias::tests:: -- --nocapture --test-threads=1 with XCL_PAGE_ALIAS unset and 1 in separate processes gave 5 passed, 0 failed each.
  • Same command with filter gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes and XCL_ADAPTER=AMD Radeon. Unset: 1 passed, 0 failed. With 1: 0 passed, 1 failed at title_textures.rs:1287, fallback must be write-watched. The log confirmed the Radeon. The assertion is in the test reservation setup, before the texture readback. No skips or ignores.

Not tested

A mirror readback using an alias-aware fixture, Wine, retail smoke, and the full workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) ran the checks and wrote this report.

**@⁠nnonno91** on GitHub · 2026-11-25 14:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2307#issuecomment-7165808335) Native Windows check of `f30ca3f037e474fe1ca1720835313db161b36004`. The alias unit tests pass here. The existing mirror upload test stops at a write-watch setup assertion when aliasing is enabled. **Tested** - Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, unoptimized profile. AMD Radeon(TM) Graphics driver 32.0.21042.62, SDK DXC/DXIL 1.8.2502.11. - `cargo test --locked -p xcl --lib hle::kernelx::alias::tests:: -- --nocapture --test-threads=1` with `XCL_PAGE_ALIAS` unset and `1` in separate processes gave 5 passed, 0 failed each. - Same command with filter `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` and `XCL_ADAPTER=AMD Radeon`. Unset: 1 passed, 0 failed. With `1`: 0 passed, 1 failed at `title_textures.rs:1287`, `fallback must be write-watched`. The log confirmed the Radeon. The assertion is in the test reservation setup, before the texture readback. No skips or ignores. **Not tested** A mirror readback using an alias-aware fixture, Wine, retail smoke, and the full workspace suite. **AI use** OpenAI Codex (GPT-6.2 Sol) ran the checks and wrote this report.
Author
Owner

@⁠tiagonleal on GitHub · 2026-11-25 15:37 UTC · original

Tested: PR #2307 at head f30ca3f037e474fe1ca1720835313db161b36004, release build, Newer Retail Game, 6 guarded runs of 300 s on one Windows machine, XCL_PAGE_ALIAS unset (A) vs XCL_PAGE_ALIAS=1 (B), n=3 each. In short: peak process commit 25.0 to 25.7 GB with the switch against 30.2 to 32.4 GB without, total system commit only about 1 GB lower, no device removal or crash in either, and the one run my memory guard cut was without the switch.

Setup

  • Windows 11 Pro 10.0.26300, Developer Mode on, NVIDIA GeForce RTX 5070 Ti 16 GB, driver 617.42 (32.0.16.1742), Ryzen 7 9800X3D, 32 GB RAM.
  • One binary (cargo build --release -p xcl at the head above), copied under a new exe name for every run (the driver keeps a shader cache per exe name).
  • Env, the same for all six except the switch: XCL_DIRECT_DXIL=1 XCL_PSO_PRELOAD=0 XCL_FRAME_DUMP=60 XCL_PRESS_A_AT=15,22,25,30,35,40,50,60,80,100, XCL_DXIL_CACHE = the same warm cache folder; B adds XCL_PAGE_ALIAS=1. The log also shows XCL_NETWORK=0.
  • Memory guard (my own, outside XCL): it kills the process if free physical RAM drops below 1.0 GB, process commit goes above 70 GB, free commit below 6 GB, or the NVIDIA driver logs a reset event.
  • Order: A1, B1, B2, A2, A3, B3. An earlier attempt was discarded because of a bug in my launcher; it is not in the table. Read-only sampler every 1 to 2 s (memory, GPU memory), process census every 5 s.

Results (MB unless noted; times are seconds from the start of the run; "process commit" = the memory: log line, "private" and "WS" = sampler)

Run Free RAM at start System commit at start Peak process commit Peak private Peak WS Min free RAM (at s) Peak system commit Peak local VRAM Ended Frames shown Presents/s, 60 s to end Last present (s) First ListX #101 (s)
A1 17948 24688 31269 31298 16479 1467 (303) 56604 13891 300 s 1362 0.61 68 65.9
B1 18821 24709 25160 25113 14928 1940 (293) 55648 12726 300 s 1480 0.99 74 71.5
B2 19106 24810 25041 25112 15101 1649 (291) 56356 12544 300 s 1419 0.75 70 67.8
A2 19016 24843 30171 (to 156 s) 30211 15559 974 (155) 57701 13889 cut by guard at 156 s n/a 1.49 (60 to 150 s) 66 49.2
A3 19414 24352 32401 32147 17289 1401 (294) 57007 13820 300 s 1318 0.38 66 64.2
B3 19756 24273 25659 25694 15738 1978 (301) 55791 12484 300 s 1413 0.77 70 65.0

All six: 0 device removals, 0 crashes, 0 driver events, no ERROR lines. Peak private working set (not in the table): A 16317 / 15400 / 17122, B 11315 / 11595 / 12091.

Not a measure of "world entry": the title never got past loading in any run. All six stop presenting between about 66 and 74 s and show 0 presents for the rest of the 300 s. I use the first ListX #101 stub line as the marker; the log's "target pages above 5 GB" line is at 48.0 s in all six runs, so it does not separate anything.

Log content: the same 25 to 26 WARN types in every run, no type present only in A or only in B. Counts: 80 / 77 (cut at 156 s) / 79 WARN lines in A, 77 / 79 / 77 in B. 40 "mesh pipeline ... refused" lines in each run. DirectStorage "request failed" lines: A 3 / 0 / 2, B 0 / 2 / 0 (different files each run). No log line mentions the switch; the 16 "CreatePlacedResourceX ... aliases an earlier resource" lines are in A and B alike.

Reading

  • With the switch, peak process commit was 25.0 to 25.7 GB against 30.2 to 32.4 GB without; the ranges do not overlap (n=3 each). Private working set and local VRAM peak were also lower (VRAM 12.5 to 12.7 GB against 13.8 to 13.9 GB).
  • Total system commit only dropped by about 1 GB (55.6 to 56.4 GB against 56.6 to 57.7 GB). The one process census I looked at with the switch on (B1) shows about 188,000 mapped section views holding about 12.4 GB of commit, so part of the process saving moves into mapped sections.
  • Lowest free RAM was 1.65 to 1.98 GB with the switch and 0.97 to 1.47 GB without. Run A2 was cut by my guard at 156 s because free RAM fell to 0.94 GB, under my own 1 GB threshold on this 32 GB machine; that says nothing about a machine with more RAM or a different threshold.
  • The title kept presenting until 66 to 68 s (A) and 70 to 74 s (B), then stopped in every run, within a few seconds of its first ListX #101 call. I do not read anything into that difference with n=3.

Frames: I looked at the frame dumps of all six runs (XCL_FRAME_DUMP=60). They show a loading-screen artwork slideshow and black frames; same frame number is not the same moment of the slideshow. Picture not compared.

Not tested

  • Full workspace test suite. Only cargo test -p xcl --lib kernelx -- --test-threads=4: 60 passed, 0 failed, 1 ignored (scatter_timing), 0 skipped. That filter does not include the GPU mirror upload tests, which another tester reported failing with the switch on.
  • Picture (see above), AMD, runs longer than 300 s, anything past the loading screen.
  • Current main: it has moved by more than 100 commits since the base this branch was built on (568e7db); I ran the head as it is.
  • One machine, order fixed (not randomised), n=3 per variant.

Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).

**@⁠tiagonleal** on GitHub · 2026-11-25 15:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2307#issuecomment-7167126612) **Tested**: PR #2307 at head `f30ca3f037e474fe1ca1720835313db161b36004`, release build, Newer Retail Game, 6 guarded runs of 300 s on one Windows machine, `XCL_PAGE_ALIAS` unset (A) vs `XCL_PAGE_ALIAS=1` (B), n=3 each. In short: peak process commit 25.0 to 25.7 GB with the switch against 30.2 to 32.4 GB without, total system commit only about 1 GB lower, no device removal or crash in either, and the one run my memory guard cut was without the switch. **Setup** - Windows 11 Pro 10.0.26300, Developer Mode on, NVIDIA GeForce RTX 5070 Ti 16 GB, driver 617.42 (32.0.16.1742), Ryzen 7 9800X3D, 32 GB RAM. - One binary (`cargo build --release -p xcl` at the head above), copied under a new exe name for every run (the driver keeps a shader cache per exe name). - Env, the same for all six except the switch: `XCL_DIRECT_DXIL=1 XCL_PSO_PRELOAD=0 XCL_FRAME_DUMP=60 XCL_PRESS_A_AT=15,22,25,30,35,40,50,60,80,100`, `XCL_DXIL_CACHE` = the same warm cache folder; B adds `XCL_PAGE_ALIAS=1`. The log also shows `XCL_NETWORK=0`. - Memory guard (my own, outside XCL): it kills the process if free physical RAM drops below 1.0 GB, process commit goes above 70 GB, free commit below 6 GB, or the NVIDIA driver logs a reset event. - Order: A1, B1, B2, A2, A3, B3. An earlier attempt was discarded because of a bug in my launcher; it is not in the table. Read-only sampler every 1 to 2 s (memory, GPU memory), process census every 5 s. **Results** (MB unless noted; times are seconds from the start of the run; "process commit" = the `memory:` log line, "private" and "WS" = sampler) | Run | Free RAM at start | System commit at start | Peak process commit | Peak private | Peak WS | Min free RAM (at s) | Peak system commit | Peak local VRAM | Ended | Frames shown | Presents/s, 60 s to end | Last present (s) | First ListX #101 (s) | |---|---|---|---|---|---|---|---|---|---|---|---|---|---| | A1 | 17948 | 24688 | 31269 | 31298 | 16479 | 1467 (303) | 56604 | 13891 | 300 s | 1362 | 0.61 | 68 | 65.9 | | B1 | 18821 | 24709 | 25160 | 25113 | 14928 | 1940 (293) | 55648 | 12726 | 300 s | 1480 | 0.99 | 74 | 71.5 | | B2 | 19106 | 24810 | 25041 | 25112 | 15101 | 1649 (291) | 56356 | 12544 | 300 s | 1419 | 0.75 | 70 | 67.8 | | A2 | 19016 | 24843 | 30171 (to 156 s) | 30211 | 15559 | 974 (155) | 57701 | 13889 | cut by guard at 156 s | n/a | 1.49 (60 to 150 s) | 66 | 49.2 | | A3 | 19414 | 24352 | 32401 | 32147 | 17289 | 1401 (294) | 57007 | 13820 | 300 s | 1318 | 0.38 | 66 | 64.2 | | B3 | 19756 | 24273 | 25659 | 25694 | 15738 | 1978 (301) | 55791 | 12484 | 300 s | 1413 | 0.77 | 70 | 65.0 | All six: 0 device removals, 0 crashes, 0 driver events, no ERROR lines. Peak private working set (not in the table): A 16317 / 15400 / 17122, B 11315 / 11595 / 12091. Not a measure of "world entry": the title never got past loading in any run. All six stop presenting between about 66 and 74 s and show 0 presents for the rest of the 300 s. I use the first ListX `#101` stub line as the marker; the log's "target pages above 5 GB" line is at 48.0 s in all six runs, so it does not separate anything. Log content: the same 25 to 26 WARN types in every run, no type present only in A or only in B. Counts: 80 / 77 (cut at 156 s) / 79 WARN lines in A, 77 / 79 / 77 in B. 40 "mesh pipeline ... refused" lines in each run. DirectStorage "request failed" lines: A 3 / 0 / 2, B 0 / 2 / 0 (different files each run). No log line mentions the switch; the 16 "CreatePlacedResourceX ... aliases an earlier resource" lines are in A and B alike. **Reading** - With the switch, peak process commit was 25.0 to 25.7 GB against 30.2 to 32.4 GB without; the ranges do not overlap (n=3 each). Private working set and local VRAM peak were also lower (VRAM 12.5 to 12.7 GB against 13.8 to 13.9 GB). - Total system commit only dropped by about 1 GB (55.6 to 56.4 GB against 56.6 to 57.7 GB). The one process census I looked at with the switch on (B1) shows about 188,000 mapped section views holding about 12.4 GB of commit, so part of the process saving moves into mapped sections. - Lowest free RAM was 1.65 to 1.98 GB with the switch and 0.97 to 1.47 GB without. Run A2 was cut by my guard at 156 s because free RAM fell to 0.94 GB, under my own 1 GB threshold on this 32 GB machine; that says nothing about a machine with more RAM or a different threshold. - The title kept presenting until 66 to 68 s (A) and 70 to 74 s (B), then stopped in every run, within a few seconds of its first ListX `#101` call. I do not read anything into that difference with n=3. **Frames**: I looked at the frame dumps of all six runs (`XCL_FRAME_DUMP=60`). They show a loading-screen artwork slideshow and black frames; same frame number is not the same moment of the slideshow. Picture not compared. **Not tested** - Full workspace test suite. Only `cargo test -p xcl --lib kernelx -- --test-threads=4`: 60 passed, 0 failed, 1 ignored (`scatter_timing`), 0 skipped. That filter does not include the GPU mirror upload tests, which another tester reported failing with the switch on. - Picture (see above), AMD, runs longer than 300 s, anything past the loading screen. - Current `main`: it has moved by more than 100 commits since the base this branch was built on (568e7db); I ran the head as it is. - One machine, order fixed (not randomised), n=3 per variant. Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:41 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 17:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/2307#issuecomment-7169856243) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠claudetools-gh on GitHub · 2026-11-25 21:16 UTC · original · edited 2026-11-25 22:08 UTC

@⁠adiologydev a data point from the retail title on an RTX 5070 Ti that may point at this PR. With XCL_PAGE_ALIAS=1, the title hits an int3 in its resource pointer fix-up; without it, the same run got past that point. One run each, so treat it as a lead, not a proof.

What the int3 is. It is at game_scarlett_master.exe+0x4da6315. The function there takes a table of {base, size, delta} ranges and one pointer value. It returns the delta of the range the pointer falls in. If the pointer falls in none of them, it executes int3 and returns 0.

Its caller fixes up a pointer that sits inside a loaded resource. Its value should be a resource-relative address: 0x5xxxxxxx for virtual or 0x6xxxxxxx for physical. At the crash, r11 is the first range's base (0x50000000 or 0x60000000). The pointer being fixed up was garbage:

run crashed at pointer value
1 197 s 0xCBCBCBCB… (in rdx and rdi)
2 129.7 s 0x799171
3 158 s 0xb2ac626837eab3e

So the resource's bytes are not what was read from the file when the title walks them. Either they were never written, or they were written where the CPU is not looking. Our game crash logs put it during the intro's streaming ("Prestream").

The A/B. The tree is main 2898511 + #2372 + #2404 + #2426 + #2384 + local GPU-view windows. Common settings: XCL_DIRECT_DXIL=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0; RT resolve programs refused.

XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1 neither switch
int3 above at 129.7 s, right after world geometry first reached the depth target none by 265 s
world on the 2560×1440 targets depth 50 %, G-buffer 38–41 % (122 s) depth 84 %, G-buffer 66 % (151 s)
local video memory also over budget: 21 GB at 120 s, peaks of 29 GB (two later runs with the same settings; I first wrote "in budget" here without having checked) 27 GB at 116 s, 36 GB at 256 s, against a 14.7 GB budget

Without the switches, the over-budget video memory went into system RAM. I stopped the run at 265 s with 0.4 GB of RAM free; a repeat was stopped at 134 s at 35 GB. With the switches the run is over budget too, but system RAM held: a later run lasted 304 s.

The earlier runs with the same int3 (158 s and 197 s) also had XCL_PAGE_ALIAS=1.

Update: a later run with XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1 and the same settings went 304 s with no int3. It ended in a different title crash, a write to address 0. Two more stopped earlier, on device removals at 88 s and 120 s. So the int3 comes and goes, and one run without the switches is not enough to pin it on this PR. I am logging the page history at the crash and will post that when the int3 shows again.

What I have not checked:

  • which of the two switches matters;
  • whether the bad resource came in through DirectStorage (its requests here go to "physical pages" destinations) or through a plain file read;
  • whether the CPU sees a page that was mapped again after the request was queued.

If you have a trace switch for "a page shown at an address got new contents through another mapping", I can run it.

AI-assisted.

**@⁠claudetools-gh** on GitHub · 2026-11-25 21:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/2307#issuecomment-7174846273) · edited 2026-11-25 22:08 UTC @⁠adiologydev a data point from the retail title on an RTX 5070 Ti that may point at this PR. **With `XCL_PAGE_ALIAS=1`, the title hits an `int3` in its resource pointer fix-up; without it, the same run got past that point.** One run each, so treat it as a lead, not a proof. **What the `int3` is.** It is at `game_scarlett_master.exe+0x4da6315`. The function there takes a table of `{base, size, delta}` ranges and one pointer value. It returns the delta of the range the pointer falls in. If the pointer falls in none of them, it executes `int3` and returns 0. Its caller fixes up a pointer that sits inside a loaded resource. Its value should be a resource-relative address: `0x5xxxxxxx` for virtual or `0x6xxxxxxx` for physical. At the crash, `r11` is the first range's base (`0x50000000` or `0x60000000`). The pointer being fixed up was garbage: | run | crashed at | pointer value | |---|---|---| | 1 | 197 s | `0xCBCBCBCB…` (in `rdx` and `rdi`) | | 2 | 129.7 s | `0x799171` | | 3 | 158 s | `0xb2ac626837eab3e` | So the resource's bytes are not what was read from the file when the title walks them. Either they were never written, or they were written where the CPU is not looking. Our game crash logs put it during the intro's streaming ("Prestream"). **The A/B.** The tree is `main` `2898511` + #2372 + #2404 + #2426 + #2384 + local GPU-view windows. Common settings: `XCL_DIRECT_DXIL=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0`; RT resolve programs refused. | | `XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1` | neither switch | |---|---|---| | `int3` above | at 129.7 s, right after world geometry first reached the depth target | none by 265 s | | world on the 2560×1440 targets | depth 50 %, G-buffer 38–41 % (122 s) | depth 84 %, G-buffer 66 % (151 s) | | local video memory | also over budget: 21 GB at 120 s, peaks of 29 GB (two later runs with the same settings; I first wrote "in budget" here without having checked) | 27 GB at 116 s, 36 GB at 256 s, against a 14.7 GB budget | Without the switches, the over-budget video memory went into system RAM. I stopped the run at 265 s with 0.4 GB of RAM free; a repeat was stopped at 134 s at 35 GB. With the switches the run is over budget too, but system RAM held: a later run lasted 304 s. The earlier runs with the same `int3` (158 s and 197 s) also had `XCL_PAGE_ALIAS=1`. **Update:** a later run with `XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1` and the same settings went 304 s with no `int3`. It ended in a different title crash, a write to address 0. Two more stopped earlier, on device removals at 88 s and 120 s. So the `int3` comes and goes, and one run without the switches is not enough to pin it on this PR. I am logging the page history at the crash and will post that when the `int3` shows again. **What I have not checked:** - which of the two switches matters; - whether the bad resource came in through DirectStorage (its requests here go to "physical pages" destinations) or through a plain file read; - whether the CPU sees a page that was mapped again after the request was queued. If you have a trace switch for "a page shown at an address got new contents through another mapping", I can run it. AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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