kernelx: XCL_PAGE_ALIAS=1 shows a physical page at every address it is mapped at #2297
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by adiologydev on 2026-11-25T13:27:22Z.
Stacked 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
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T14:37:16Z.
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.
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T14:47:02Z.
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.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-25T15:37:22Z.
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).
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T17:41:13Z.
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!
Imported from ivall/xcl. Originally posted by claudetools-gh on 2026-11-25T21:16:19Z.
@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.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T06:56:35Z.
Independent desktop NVIDIA verification of PR #2307 at head
f30ca3f037e474fe1ca1720835313db161b36004(4commits stacked on PR #2293 + PR #2294:03ceddb0be3d06287ca21ae800dbb0d7f98049e7->6602a7020122f508f72fed942286f488e3bd1bb9->d660e3070bef6e3ae095393dc134ecd517ab4a35->f30ca3f037e474fe1ca1720835313db161b36004; exact parent & merge-base:568e7db7729c8fa6c8f0f4b32d798faaf11462bb, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
f30ca3f0)cargo test --release -p xcl --lib hle::kernelx::alias:: -- --test-threads=1 --nocapture(default env, 3 runs)5 passed; 0 failed; 0 ignored; 1139 filtered out× 3 (0.02s× 3,0skipped:a_page_mapped_into_two_spaces_is_one_page_and_writes_reach_both,a_page_moved_outside_the_spaces_goes_and_comes_back_with_its_bytes,a_page_not_from_the_title_is_refused,pages_read_and_written_by_number_are_the_pages_the_title_sees,remapping_an_address_shows_the_new_page_and_keeps_the_old_one)cargo test --release -p xcl --lib hle::kernelx:: -- --test-threads=1(default env, 3 runs)58 passed; 0 failed; 1 ignored; 1085 filtered out× 3 (1.15s,1.14s,1.15s,0skipped)XCL_PAGE_ALIAS=1 cargo test --release -p xcl --lib hle::kernelx:: -- --test-threads=1(opt-in env, 3 runs)49 passed; 9 failed; 1 ignored; 1085 filtered out× 3 (0.97s,0.98s,0.98s; all5alias::,8guards::,7sections::, and2lazy::tests pass; see note below on the9pre-existing UMA-home unit tests)cargo build --release -p xcl1m 14s, exit0,0new warnings in non-test build; inherits 1unused_assignments#[cfg(test)]warning from stacked #2294 atcrates/xcl/src/hle/kernelx/guards.rs:366:9)Observation on
hle::kernelx::under process-wideXCL_PAGE_ALIAS=1: All58/58tests pass3/3in the default environment. WithXCL_PAGE_ALIAS=1set process-wide, all22alias::/guards::/sections::/lazy::tests pass3/3, while9pre-existing UMA-home tests inhle::kernelx::tests::fail deterministically (3/3):7(a_home_decommitted_in_the_same_call_is_asked_again,a_page_away_at_another_home_goes_home_with_it,a_page_away_from_home_is_committed_once,mapping_fresh_pages_does_not_query_each_page,mapping_lazy_pages_again_does_not_query_each_page,pages_mapped_again_at_another_address_keep_what_was_written,pages_mapped_again_at_the_same_address_keep_what_was_written) panic onpage_home(...).unwrap()returningNone(becauseXCL_PAGE_ALIAS=1backs physical pages with section slices instead of UMA homes), and2(physical_pages_in_umaatkernelx.rs:2371andscatter_matches_a_model_of_physical_pagesatkernelx.rs:2624) expectMapTitlePhysicalPages(NULL, ...)to return a UMA-home address.Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
568e7db7729c8fa6c8f0f4b32d798faaf11462bb, cached baseline on the same machine):PR #2307 (
f30ca3f037e474fe1ca1720835313db161b36004, default flags —XCL_PAGE_ALIASunset):PR #2307 (
f30ca3f037e474fe1ca1720835313db161b36004, opt-inXCL_PAGE_ALIAS=1):Observations & limits of coverage
XCL_PAGE_ALIASunset) and opt-in (XCL_PAGE_ALIAS=1) 60 s retail smokes ontitle: 29640639exited0x0with0device removals,0crashes, and steady60 60 60presents per 2 s; underXCL_PAGE_ALIAS=1, peak process commit dropped from14515 MBto13150 MB(-1365 MB,-9.4%vs. default run on the same commitf30ca3f0).1558vs.1608) between single 60 s runs was not multi-run profiled; visual texture correctness under extended gameplay beyond the 60 s startup/streaming window was not separately inspected.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by ZekkJJ on 2026-11-27T21:44:32Z.
Independent test on Windows 11 build 26200, Ryzen 7 8845HS, RTX 4060 Laptop 8 GiB (driver 32.0.16.1656), 16 GiB RAM, Rust 1.98.1 MSVC. I integrated the exact #2307 head
f30ca3f037e474fe1ca1720835313db161b36004with main6089122a1c96dff16e93b6fdf04c8ed20cfb6102. Two small follow-ups use the original dependency commits.map_aliased <- XMemMapPhysicalPagesScatter. The new two-entry regression and 22 other focused checks passed with aliases enabled. I reproduced the write-watch fixture setup failure reported above with aliasing enabled. The same GPU fixture passed byte-exact readback in conventional mode.785d7dc5with aliasing enabled: the request returned success and the intended 256 bytes remained zero. Oncfe04f43it passed byte-for-byte, including the stack snapshot case. The 7 alias and 19 DirectStorage tests passed with no explicit skips.Historical evidence from a separate earlier integration on this RTX 4060 Laptop at an exact matched Series S checkpoint (4,200 DirectStorage requests, 262 MiB, zero storage failures on both):
The system commit growth difference was 7,441 MiB. Both historical runs subsequently crashed in separate paths, one during a concurrent texture decommit and the other in the null scatter-unmap. World entry was unverified. These measurements belong to that integration. No fresh smoke block was generated. The clean Series S preflight expired at 3205 MiB free RAM and 13200 MiB free commit. The guarded runner requires 6,600 MiB RAM and 18,000 MiB free commit at startup. The last idle check still showed 4129 MiB RAM and 13941 MiB free commit. Series X was deferred.
AI use: Codex (GPT-6 family, exact runtime variant unavailable) recovered the private historical artifacts, compared sources, ran the focused tests, and drafted this comment.
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T21:26:52Z.
Review finding for
f30ca3f0(#3211 workstream B), with a regression test that fails here and passes with a one-line fix. I tested it at #3075's head4fdd2824, wheremap_onehas the same branch.With
XCL_PAGE_ALIAS=1, a page that already holds bytes is not uploaded when it is mapped at a new address.map_onecallsguards::watch(page, at), which guards the view but marks nothing dirty. Only a page that was never committed getslazy::mark.title_textures::refreshlearns about that address only throughguards::take_dirty.guards::forgetdrops the page's dirty record when its last view goes. A write, an unmap and a remap all before the next submit are therefore never uploaded either. The fix below covers that case too, because the remap marks the page again.Test (alias.rs):
sand write to it.s + PAGEand expects + PAGEintake_dirty.sand expects.Results:
4fdd2824it fails:the new view of a written page is uploaded.guards::written(page)for a committed page inmap_oneit passes. That marks every view of the page; marking onlyatwould upload less.Patch (fix + test)
Tested (RTX 2070 SUPER, Windows 11, debug,
cargo test -p xcl --lib hle::kernelx:: -- --test-threads=1, with this patch and the one in my #3075 comment): 68 passed, 0 failed, 1 ignored. WithXCL_PAGE_ALIAS=1: 59 passed, 9 failed. The same 9 conventional-path tests fail without the patch.Whether this explains any of the zero-sampled textures in #505 is not established. This is a static finding plus a unit test, with no retail run.
Not tested: retail title, AMD, GPU-side readback (the test checks what is handed to the upload, not what the GPU holds).
AI use: Claude Code (Claude Opus 5.5) found the issue and wrote the test and fix; the comment was checked by @KOLESNiii before posting.
Imported from ivall/xcl. Originally posted by claudetools-gh on 2026-11-29T11:01:59Z.
On
mainfa204595with this series on top (#2307f30ca3f0→ #3074785d7dc5→ #30754fdd2824, unchanged except for conflict context),XCL_PAGE_ALIAS=1leaves every GPU-view page thatCopyPageMappingsBatchXnames unmapped. Whatever the title reads through those views is zeros; in a retail title the loading-screen artwork comes out black.The
queue CopyPageMappingsBatchX:line at the end of each run (same exe, same title and scene):XCL_PAGE_ALIASMy reading of the code:
mirrors::apply_batchesresolves each pool page throughAway::title(kernelx.rs,away.as_ref().and_then(|a| a.title.get(&pool))) and then callsplace_of.MapTitlePhysicalPagesgoes tomap_aliased→alias::map. That keeps the mapping inalias's own state, but nothing fillsAway::title: onlymap_pages, the non-alias path, inserts into it.AllocateTitlePhysicalPagesdoesn't put the pages inPHYS_BLOCKSeither, sopage_homefinds nothing.Shows::Nothing.The mirrors code reached
mainafter this series was written, which would explain why the series never accounted for it.What I think a fix needs:
apply_batches, whenalias::enabled(), resolve the pool address throughalias: the physical page, and the address where its bytes live;alias::map/ unmap / move should callmirrors::page_at/page_placedthe way the non-alias path does, so that GPU views follow their physical page;Not tested: a fix; AMD. RTX 5070 Ti, driver 621.40, Windows 11.
AI use: Claude Code with Claude Opus 5.5 ran the runs, traced the code and wrote this. AI-assisted.
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T01:54:08Z.
Triage note: this no longer merges with current
main(mergeable=false), so it cannot be built or tested as it stands.Why I am asking rather than just noting it: we have run fifteen mergeable candidates on the retail title on an RTX 5070 Ti, and every one still stops presenting at 50–80 s (device removed, surfacing ~88 s later on the next allocation). The PRs whose descriptions actually match that symptom are the ones that no longer apply — this is one of them. A rebase would make it testable again, and we will run it and report the numbers.
If it has been superseded by merged work, saying so is enough and it can be closed.
AI use: an agent posted this triage note.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:48:03Z.
Triage (#1607) – head
f30ca3fStacked on #2294 / #2293 (only
f30ca3fbelongs here). #2308 builds on it, and #3074 / #3075 (another author) merge this branch and add fixes on top, so they are follow-ups, not duplicates.Points to handle on rebase, both already fixed in #3074 / #3075:
pagesinXMemMapPhysicalPagesScatter(unmap). The alias branch'spages.add(i)would then pass0x8,0x10, … tomap_aliased, which dereferences them.alias::State::pageonly checksi < section.pages(), so a freed page ID in a block that still has live pages can still be mapped and read. Also,freecan release a block's home whilebytes_of/move_tocopy from it on another thread, because they run outside the lock.The feature is off by default (
XCL_PAGE_ALIAS).Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.