kernelx: XCL_PAGE_ALIAS=1 shows a physical page at every address it is mapped at #2307
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2307
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2307"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@adiologydev on GitHub · 2026-11-25 13:27 UTC · original
adiologydev:kernelx/page-alias→main· +1389 −11 · 9 files · 4 commits · openStacked on #2294; only the top commit (
f30ca3f) belongs here. Third part of the plan on #1031: behindXCL_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), withXCL_PAGE_ALIAS=1:crates/xcl/src/hle/kernelx.rs: the switch inVirtualAlloc/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=4onf30ca3f: 1114 passed, 4 failed, 26 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState→E_OUTOFMEMORYon this card, #1905);main568e7dbfails the same 4 here (1094 passed, 4 failed, 26 ignored). SKIPPED (23, the same onmain): 20 need 64-lane waves ("no wave64"), 3 per-lane f16 refusals inlower_dxil::tests::{f16,f32}_programs_on_the_gpu.The retail title with
XCL_PAGE_ALIAS=1, againstmain568e7db, 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):XCL_PAGE_ALIAS=1(f30ca3f)main568e7dbmain568e7dbXCL_PAGE_ALIAS=1(f30ca3f)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,mainfirst, same machine (each run'sxcl.exebuilt from a clean checkout of its commit):Not tested
AI use
@SlopTart on GitHub · 2026-11-25 14:37 UTC · original
Tested: head
f30ca3fmerged onto currentorigin/main(auto-merge, clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun 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 plainorigin/mainreproduces 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_bothFAILEDa_page_moved_outside_the_spaces_goes_and_comes_back_with_its_bytesFAILEDpages_read_and_written_by_number_are_the_pages_the_title_seesFAILEDa_page_not_from_the_title_is_refusedok,remapping_an_address_shows_the_new_page_and_keeps_the_old_oneokOn 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.
@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
cargo test --locked -p xcl --lib hle::kernelx::alias::tests:: -- --nocapture --test-threads=1withXCL_PAGE_ALIASunset and1in separate processes gave 5 passed, 0 failed each.gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesandXCL_ADAPTER=AMD Radeon. Unset: 1 passed, 0 failed. With1: 0 passed, 1 failed attitle_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.
@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_ALIASunset (A) vsXCL_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
cargo build --release -p xclat the head above), copied under a new exe name for every run (the driver keeps a shader cache per exe name).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 addsXCL_PAGE_ALIAS=1. The log also showsXCL_NETWORK=0.Results (MB unless noted; times are seconds from the start of the run; "process commit" = the
memory:log line, "private" and "WS" = sampler)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
#101stub 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
#101call. 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
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.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.Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).
@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!
@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 anint3in 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
int3is. It is atgame_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 executesint3and returns 0.Its caller fixes up a pointer that sits inside a loaded resource. Its value should be a resource-relative address:
0x5xxxxxxxfor virtual or0x6xxxxxxxfor physical. At the crash,r11is the first range's base (0x50000000or0x60000000). The pointer being fixed up was garbage:0xCBCBCBCB…(inrdxandrdi)0x7991710xb2ac626837eab3eSo 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
main2898511+ #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=1int3aboveWithout 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 hadXCL_PAGE_ALIAS=1.Update: a later run with
XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1and the same settings went 304 s with noint3. 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 theint3comes 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 theint3shows again.What I have not checked:
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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.